Skip to content

fix(#549,#551): verify plaintext archives before restore; clean up + restart on backup failure#571

Merged
VijitSingh97 merged 1 commit into
developfrom
claude/fix-549-551-backup-restore
Jul 17, 2026
Merged

fix(#549,#551): verify plaintext archives before restore; clean up + restart on backup failure#571
VijitSingh97 merged 1 commit into
developfrom
claude/fix-549-551-backup-restore

Conversation

@VijitSingh97

Copy link
Copy Markdown
Collaborator

Closes #549
Closes #551

Summary

Two companion backup/restore failure-path fixes in the pithead CLI:

Docs: docs/operations.md backup/restore section updated to state both behaviours.

Test evidence

Tier-1 (tests/stack/run.sh), full suite green with the fixes (run twice pre-rebase, backup/restore blocks re-verified post-rebase): 1273 passed, 0 failed.

New assertions, all passing with the fixes:

✓ truncated plaintext archive exits non-zero
✓ truncated plaintext archive names integrity failure
✓ truncated plaintext archive leaves config.json untouched
✓ truncated plaintext archive leaves .env untouched
✓ failed plaintext backup (running stack) exits non-zero
✓ failed plaintext backup names the cause
✓ failed plaintext backup leaves no archive behind
✓ failed plaintext backup restarts the stack

Revert-proof (fixes reverted to develop's pithead, tests kept):

✗ truncated plaintext archive names integrity failure   (tar aborts mid-extraction: "truncated gzip input", on_err fires)
✗ failed plaintext backup names the cause               (errexit fires straight through, no cleanup message)
✗ failed plaintext backup restarts the stack            (docker log has "compose down" but no "compose up")

make lint passes on every surface except lint-proto, which needs the Docker daemon (not running on this dev box) — unrelated to this change. make lint-sh, lint-md, lint-docs-voice all clean.

🤖 Generated with Claude Code

…restart on backup failure

restore (#549): the plaintext branch extracted with no integrity check —
mirror the encrypted branch's full-stream 'tar -tzf' verify so a
truncated/corrupt archive is refused before anything is written.

backup (#551): guard the plaintext 'sudo tar' (errexit fired straight
through before), remove the partial root-owned archive on failure, and
restart the stack when it was running — both branches — before erroring
with the cause.

Tier-1 tests: truncated plaintext restore is rejected with config.json/.env
byte-identical; a shadowed-tar backup failure removes the partial archive,
restarts the running stack (compose up in the docker log), and exits
non-zero.

Closes #549
Closes #551

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit d544dbe into develop Jul 17, 2026
15 checks passed
@VijitSingh97
VijitSingh97 deleted the claude/fix-549-551-backup-restore branch July 17, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant