Repository navigation
fix: reject failed SSH configuration captures - #210
Merged
Merged
Conversation
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
TheWitness
approved these changes
Nov 17, 2026
TheWitness
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #209. Follow-up to #207/#208.
SSH capture now drains stdout and stderr together, checks the remote exit status before closing the channel, and rejects failed reads, nonzero status and unavailable status before writing an incoming backup. Successful commands may still emit stderr warnings. The capture deadline, output normalization and atomic file replacement are preserved.
Regression tests cover nonzero/missing status with output above the backup size threshold, stderr draining, read/open failures, delayed output, cleanup, and the full download/archive caller. The caller test verifies that a failed capture neither archives a stale/error file nor advances lastbackup. All four failure assertions fail against the original implementation.
Validation: 337 tests passed on PHP 8.5.12; 336 passed on PHP 8.3.36 with one root-only permission-test skip. The 27 focused capture tests passed, and Xdebug on PHP 8.4.25 exercised all 23 changed executable transport lines. The transport files are now included in the existing coverage filter. PHP syntax and formatter checks passed.
The tests use real local streams with doubles at the SSH extension boundary; no live SSH server or vendor device was exercised. Exit status comes from the ssh2 extension's stream metadata, not from shell-specific command wrapping. Servers that report success for their own error text still require vendor-specific output validation. Deploying this change does not remove previously archived failed captures.