Repository navigation
fix(cli): prevent destructive overwrites - #131
Merged
vinceblock99 merged 3 commits intoJul 28, 2026
Merged
Conversation
vinceblock99
force-pushed
the
chore/delete-noop-cli-surface
branch
from
July 24, 2026 17:50
ad01a55 to
6ac6b50
Compare
vinceblock99
force-pushed
the
chore/remove-data-loss-surface
branch
from
July 24, 2026 17:50
6a3fc44 to
1bd5099
Compare
This was referenced Jul 24, 2026
Stop-the-bleeding for verified data-loss paths (deeper behavior fixes for revise rollback and stash deletion capture are tracked separately): - move --force removed: disk rename ran before the tracking update, which always fails on a tracked destination — the destination file was deleted from disk, unrecoverable for add-only/untracked targets. - move now refuses ANY existing file at the resolved destination, tracked or untracked — fs::rename replaced it silently with exit 0. Moving into an existing directory still works (the check runs on the resolved <dir>/<filename> path). Run-level regression tests cover the untracked-destination, tracked-destination, and move-into-directory cases. - stash --include-untracked/-u removed: copied untracked files into the stash sidecar but never cleaned them from the working copy, while printing 'restored to clean state'. Untracked files are now simply left alone (suite 06 pins the behavior and rejects the removed flag). - memory new --id errors when the id already exists instead of silently replacing a possibly-attested memory; regression test asserts the original content survives. Follow-up: fold the existence check into the vault_store transaction to close the check-then-write window. Verified kept: view switch --stash works end-to-end for modified files; it inherits stash's missing deletion capture (behavior-fix PR).
The guard added alongside the --force removal used Path::exists(), which is wrong in two directions. Case-only rename regressed. On case-insensitive filesystems (APFS, NTFS) 'file.txt' exists whenever 'File.txt' does, so 'atomic move File.txt file.txt' returned exit 2. It worked before this stack -- is_tracked is case-sensitive and rename(2) handles case-only renames -- and --force was removed in the same commit, leaving no way through. Canonicalize both sides and allow the move when they resolve to the same entry. Dangling symlinks were still clobbered. exists() follows the link and reports false for a broken one, so rename destroyed it -- contradicting the guard's own 'refuse ANY existing file' comment. Use symlink_metadata. Both reproduced against the built binary before and after. Regression tests added for each; the untracked- and tracked-destination guards are unchanged and still refuse (exit 2, contents intact).
vinceblock99
force-pushed
the
chore/delete-noop-cli-surface
branch
from
July 24, 2026 19:23
6ac6b50 to
c43fd8a
Compare
vinceblock99
force-pushed
the
chore/remove-data-loss-surface
branch
from
July 24, 2026 19:23
1bd5099 to
c256372
Compare
vinceblock99
added a commit
that referenced
this pull request
Jul 28, 2026
* chore(cli): delete no-op and unimplemented command surface Per the project rule: if a command surface doesn't work, delete it rather than implement it. Every removal below was verified against the real binary — the flag either had no effect, always errored, or printed a not-implemented notice. Removed: - log --path: parsed, printed 'not yet fully implemented', never filtered - stash show --patch: printed 'Full diff output not yet implemented' - unrecord [CHANGE]: positional always errored 'not yet supported' - diff --cached (hidden) and diff --view: parsed but never read - change --show-hunks: parsed but never read (hunks always print) - insert/from-view/tag/pick --deps: SetTrue with default_value=true is an inert toggle; dependency-following stays always on - insert pick --allow-conflicts: run_pick never read it (kept for the other insert modes, where it works) - tag create --author/--view: parsed but never read; tag always used the current view and identity author (parse_author was test-only) - identity default --clear --usage: warned 'not yet supported'; the combination is now a clap conflict error instead of a silent no-op - vault summaries --json: output is always JSON; flag did nothing Deliberately NOT removed: the deprecated 'vault intent' family — it works, the embedded vault skills/prompts installed into every new project still teach it, and the canonical 'atomic intent' commands are not output-compatible. Removing it needs a migration PR that also updates the embedded skill content (vault_defaults.rs). Harness suites 14/16 were still migrated to the canonical commands, which coexist. Surface test: 198 public command paths / 169 leaves, unchanged. * docs(cli): stop advertising surface this PR deleted Three module-doc usage blocks still listed flags removed in this commit: change --show-hunks, log --path, vault summaries --json. Leaving them documented is the same advertise-what-does-not-work problem the deletions exist to fix. Also correct intent/mod.rs and intent/show.rs, which described the `atomic vault intent` tree as removed. Review reversed that removal -- the tree still ships, marked DEPRECATED, and cannot go until a migration updates the vault skills embedded in vault_defaults.rs. * test(cli): preserve supported compatibility surface * fix(cli): prevent destructive overwrites (#131) * chore(cli): remove data-loss surface and refuse destructive moves Stop-the-bleeding for verified data-loss paths (deeper behavior fixes for revise rollback and stash deletion capture are tracked separately): - move --force removed: disk rename ran before the tracking update, which always fails on a tracked destination — the destination file was deleted from disk, unrecoverable for add-only/untracked targets. - move now refuses ANY existing file at the resolved destination, tracked or untracked — fs::rename replaced it silently with exit 0. Moving into an existing directory still works (the check runs on the resolved <dir>/<filename> path). Run-level regression tests cover the untracked-destination, tracked-destination, and move-into-directory cases. - stash --include-untracked/-u removed: copied untracked files into the stash sidecar but never cleaned them from the working copy, while printing 'restored to clean state'. Untracked files are now simply left alone (suite 06 pins the behavior and rejects the removed flag). - memory new --id errors when the id already exists instead of silently replacing a possibly-attested memory; regression test asserts the original content survives. Follow-up: fold the existence check into the vault_store transaction to close the check-then-write window. Verified kept: view switch --stash works end-to-end for modified files; it inherits stash's missing deletion capture (behavior-fix PR). * fix(cli): close two holes in the move destination guard The guard added alongside the --force removal used Path::exists(), which is wrong in two directions. Case-only rename regressed. On case-insensitive filesystems (APFS, NTFS) 'file.txt' exists whenever 'File.txt' does, so 'atomic move File.txt file.txt' returned exit 2. It worked before this stack -- is_tracked is case-sensitive and rename(2) handles case-only renames -- and --force was removed in the same commit, leaving no way through. Canonicalize both sides and allow the move when they resolve to the same entry. Dangling symlinks were still clobbered. exists() follows the link and reports false for a broken one, so rename destroyed it -- contradicting the guard's own 'refuse ANY existing file' comment. Use symlink_metadata. Both reproduced against the built binary before and after. Regression tests added for each; the untracked- and tracked-destination guards are unchanged and still refuse (exit 2, contents intact). * docs(cli): simplify safety comments
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.
What
move --forceand madeatomic movereject moves when the final target already exists.stash --include-untrackedbecause it did not remove untracked files from the working tree.memory new --idreject an ID that already exists.Why
These commands could overwrite data or claim work was done when it was not. They now fail safely instead.
Test
cargo fmt --all -- --checkcargo clippy --workspace -- -D warningscargo test --workspaceDepends on #130.