Repository navigation
fix(output): prevent accidental overwrites in capture and replay - #708
Merged
Merged
Conversation
Capture checks both the payload and manifest before creating either, then creates them exclusively and removes only what it created on failure. Replay refuses an existing --output and any output aliasing the recording or its manifest, and removes a partial report it created if the run fails. Closes #700
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.
Closes #700.
Changes
capture: refuses an existing payload or manifest (both checked before either is created), creates them with exclusive creation, and removes only the payload it created if the manifest cannot be created.replay --output: refuses an existing file, and an output that aliases the recording or manifest (canonical path, symlink, or hard link). A partial report created by a failed run is removed.create_new_output_filehelper;open_output_filesemantics are unchanged for config, logging and the final manifest rewrite.cli.md,output.md,replay.md) state the behavior. No overwrite option added (refusal-only, per the issue).Tests
Unit tests for payload-only and manifest-only collisions (bytes unchanged, no half pair), exclusive creation, and aliasing; integration tests for replay refusal, aliasing via symlink, and the happy path.
cargo test --lib, replay/capture/generated_docs tests and clippy pass on macOS.