Skip to content

fix(cli): refuse undo when a target or backup is missing - #5365

Open
user-github-me wants to merge 1 commit into
heygen-com:mainfrom
user-github-me:fix/timeline-undo-missing-files
Open

user-github-me wants to merge 1 commit into
heygen-com:mainfrom
user-github-me:fix/timeline-undo-missing-files

Conversation

@user-github-me

@user-github-me user-github-me commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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.html also 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 requiring index.html so 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant