fix(backup): make fatal errors JSON-safe#29
Open
tymrtn wants to merge 1 commit into
Open
Conversation
Backup export/verify/restore fatal errors now emit a structured `fatal_error` JSON event (with `ok`, `phase`, `error` fields) before exiting, so agents consuming `--json` output never see unstructured plain-text on stderr for these commands. - Add `FatalError` variant to `BackupEvent` enum - Wrap error return path in `backup::run()` to emit JSON event - Suppress duplicate plain-text stderr in main when --json is active - Tests cover corrupt archive, missing manifest, unsafe restore target, and strict-mode verify failures in JSON mode Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
envelope backup export/verify/restore --jsonflows emit a machine-readablefatal_errorevent on fatal command errors.origin/main.Fixes #21
User-facing surface
envelope.envelope backup export,envelope backup verify, andenvelope backup restoreJSON paths.Internal verification
These are Cargo package/test selectors, not user-facing commands:
CARGO_TARGET_DIR=/tmp/envelope-issue-21-target cargo fmt --checkCARGO_TARGET_DIR=/tmp/envelope-issue-21-target cargo test -p envelope-email-transport backup -- --nocaptureCARGO_TARGET_DIR=/tmp/envelope-issue-21-target cargo test -p envelope-email backup -- --nocaptureenvelope-email-transportis the internal Rust crate containing email/backup/IMAP logic. The only installed command is stillenvelope.Safety