Repository navigation
feat: protect later file changes from undo - #61
Merged
Merged
Conversation
Record the bytes produced by each file mutation alongside its prior state. Before restoring a checkpoint, compare an existing file with that recorded result and keep both the file and checkpoint when they differ. Legacy checkpoints remain readable, and a deleted parent tree can still be restored as before. The manual-edit, replaced-created-file and retained-checkpoint cases fail on main. The full offline suite passes 357 tests with one opt-in skip, and ruff check corecoder tests passes. README line counts and test totals are updated from the current tree.
# Conflicts: # README.md # README_CN.md # article/00-index.md # article/00-index_EN.md
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
/undonow protects work that landed after an agent edit instead of silently replacing it with an older snapshot.Each checkpoint records both the previous bytes and the bytes produced by the edit. Before undoing, CoreCoder compares the current file with that recorded result. If a manual edit or bash changed the file again, it keeps the newer contents and the checkpoint and explains why the restore was skipped. A file removed along with its parent tree still restores as before. Existing checkpoint files without the new field remain readable.
This stays inside the existing checkpoint stack and the two file-writing tools. It adds no new command, dependency or background service.
Validation
The three new conflict regressions fail on current main: undo overwrites a later manual edit, deletes a created file after it was replaced, and loses the retained checkpoint sequence. A legacy-format compatibility case passes before and after.
On this branch:
ruff check corecoder tests: passed.git diff --check: passed.The README badges, prose, per-file counts, test total and package description are updated from the current tree. No live model or external service was used.
Merge update
Merged current main in
96160d9aaf75b60bb30627c13d7ad4c38666dffa, including #64's rolling-summary fix. The conflicts were limited to documentation counts. Both feature sets and both regression suites remain in the combined tree. The README and package counts were recomputed from the merged source: 1,515 engine LoC, 3,343 physical package lines, 2,762 net lines and 360 offline tests.ruff check corecoder testspasses. Full-fileruff formatstill reports the same pre-existing formatting drift seen on both parents; no broad reformatting was added.