fix: fail-closed rollback verification with apply→compare tests - #13
Merged
Merged
Conversation
verify_restored_files warned on drift but always returned 0, and restore_backup printed success regardless. New section drives both functions against fixtures under a fake HOME with a stub nginx, so nothing touches /etc/nginx or the real ~/.wp-test: checksum stability, match/mismatch/missing dest, failing and absent nginx -t, plus two end-to-end restore_backup runs (drift repaired; no-op restore.sh must not report success). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
verify_restored_files counted missing/mismatched files but always
returned 0, and a failed nginx -t only logged an error, so
restore_backup printed "Backup restored successfully!" after a bad
restore. Now a missing dest dir, a checksum mismatch, or a failing
nginx -t (when nginx is on PATH) all make the verifier return 1, and
restore_backup propagates that instead of claiming success. The empty
dir_pairs case is also guarded so bash 3.2 + set -u cannot crash on
"${dir_pairs[@]}" expansion.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The "nginx -t skipped when nginx is absent" assertion used PATH /usr/bin:/bin:/sbin:/usr/sbin. GitHub ubuntu-latest can have nginx in /usr/sbin, so the verifier ran a real nginx -t and failed closed. Build a fixture bin dir with find/hash tools only.
MarcinDudekDev
force-pushed
the
feat/rollback-verification
branch
from
September 13, 2026 18:45
0d9fd5c to
0813247
Compare
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 #12
Rollback verification is now fail-closed.
verify_restored_filesreturns non-zero on missing dest files, checksum mismatch, or failednginx -t(skipped if nginx is not on PATH).restore_backupno longer prints success / exits 0 when verification failed.dir_pairsno longer crashes bash 3.2 +set -u.Tests: fake HOME + stub nginx (does not touch
/etc/nginxor real~/.wp-test). Assertions fail on main. 116/116. shellcheck --severity=warning clean.