Repository navigation
fix(cli): refuse undo when a target or backup is missing - #5365
Open
user-github-me wants to merge 1 commit into
Open
user-github-me wants to merge 1 commit into
user-github-me wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
If a timeline undo receipt refers to a removed target or backup, the command exits 1 with a raw filesystem error instead of its normal refusal payload. A missing
index.htmlalso trips project discovery before the receipt is checked. This follows the nonblocking review feedback in #5279.Catch missing-file errors while preparing the entire undo batch and return exit 2 with
{ok: false, reason, fix}on stderr in JSON mode. Include the missing project-relative path and a recovery hint. Resolve undo projects without requiringindex.htmlso a missing root target receives the same refusal. Preparation still completes before mutations begin.Validation: six new single/batch cases fail on unchanged main, then all 109 timeline tests and seven atomic-write tests pass. Eight controls through the rebuilt CLI on Node 22 verify JSON and text refusals, unchanged source and backup bytes, and successful batch undo/redo. Workspace and CLI builds, CLI typecheck, repository lint, formatting, test reachability, comment checks and normal pre-commit hooks pass. The overlapping test patch in #5315 still applies cleanly.
Related: #5279.