Repository navigation
Add apply with inverse capture and per-session undo - #486
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
alex-rawlings-yyc
force-pushed
the
441-apply-and-undo
branch
from
October 22, 2026 18:25
94999fc to
33f69f9
Compare
imnasnainaec
left a comment
Contributor
There was a problem hiding this comment.
Deviations from #441 and the plan are inline. Future issues that need a comment about this PR:
- #450 (3k): retry ids on change sets are deferred here with no home.
- #451 (3l): focus locations on undo steps are deferred here with no home.
- #453 (4a): it asks to hear what 3b decides for unreadable books.
applyrefuses, while the flag-off path keeps the edit on screen and leaves it out of the write, so the flag-on and flag-off e2e tests must cover or exclude such a book. If New and Open stay out of the history clearing, 4a must clear it. - #448 (3i): a host wipe reaching an unreadable book will be refused by
applyunless 3i decides otherwise. - #455 (4c): it expects #475's
discardUnreadablehandling in 3a/3b's whole-scope change (opening a session, New, Open); neither has it yet. - #449 (3j): its risk mitigation relies on a whole-scope change clearing the history, which holds only for opening a session.
Drafted by Claude Opus 5.5; slightly reviewed by me.
alex-rawlings-yyc
force-pushed
the
441-apply-and-undo
branch
2 times, most recently
from
October 23, 2026 15:48
a64ac26 to
1eb0b80
Compare
alex-rawlings-yyc
force-pushed
the
441-apply-and-undo
branch
from
October 23, 2026 16:07
1eb0b80 to
6c59416
Compare
This was referenced Oct 23, 2026
alex-rawlings-yyc
force-pushed
the
441-apply-and-undo
branch
from
October 23, 2026 18:19
6c59416 to
a0a32cf
Compare
alex-rawlings-yyc
marked this pull request as ready for review
October 23, 2026 18:27
imnasnainaec
approved these changes
Oct 23, 2026
imnasnainaec
left a comment
Contributor
There was a problem hiding this comment.
@imnasnainaec reviewed 18 files and all commit messages, and resolved 6 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).
This was referenced Oct 28, 2026
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.
Part of #426; closes #441. Stacked on #485.
Summary
The repository's
apply, with inverse capture, and a linear undo history per session.ChangeSetfollows myieye's proposal on [1b] Route getDraft and saveDraft through an async repository #431: one typed list of whole-record puts and deletes per record kind, and the scope's whole record, which carries the boundary delta.DraftRepository.applybuilds on the draft its last apply left and rewrites only the books whose content changes, so a payload edit rewrites every book linking it. Every apply marks the draft unsaved.EditHistorykeeps each session's undo and redo stacks, capped at main'sMAX_UNDO_STEPS. A new edit drops what was undone.Evidence
tscclean. Eight mutations of inverse capture and history each fail a test.Decisions with a strong alternative
dirtystays out of the scope's record, and every apply sets it, so an undo after a Save leaves the draft unsaved, even when it returns to the saved content. Alternative: track clean steps inEditHistory, as main does. Why not: Save doesn't reach the session until 4a ([4a] Wire the WebView to the host behind a feature flag #453).replaceAlldoes. Why not: that is a partial write, whichapply's all-or-nothing rule bars.replaceAllcan.undoEditandredoEdit, sinceundoandredoare the WebView's menu commands.Deferred
Re-anchoring what undo restores (3j), pool buckets in replies (3k), retry ids on change sets (3k, #450), and each undo step's focus location and summary (3l, #451). Only opening a session clears the history so far; host New and Open, once built, must clear it or arrive as
openSession.Merge Danger
Door: two-way
Nothing calls
applyor the undo commands yet.Blast Radius:
DraftRepository's save path, now shared byreplaceAllandapply🤖 Generated with Claude Code
This change is