Slides: an undo or a redo while diverged ends as the person saw it
Claude Fable's review of #29 at c0990c8 (merged as 4c23861). - P1: an undo or a redo that put text back was lost when that text belonged to a change the resync replays. Item matching (watchUndo) covered what an undo deletes, not what it re-inserts: Yjs anchors the re-inserted text to the original item, which the rebuilt document never holds, and ySync's mirror carried no replay. Now the mirror of an undo or a redo leaves a replay derived from its before and after (carry.mjs's derivedStep), taken by the next keep in the same Yjs transaction, and watchUndo goes (with the derived replay it doubled a type-over's undo). When more than one view mirrors one undo, it goes as its updates. As Fable flagged for Paul: an undo or a redo that put the refused text back on screen now brings it back on the page too. - P2: carry.test.mjs's timing bound is on growth in CPU time (four times the changes in at most eight times the CPU, best of several runs, with a generous ceiling), so a loaded runner does not fail it and a quadratic carry still would. It passed 3 of 3 at a load average of 134. - Nit: an entry that only deletes what the rebuilt document never held (an undo of the refused x alone) is not counted as lost. Tests: Fable's seventeen cases in carry.test.mjs and, through the real editor in Chromium and WebKit, in fixtures/engines/undo.mjs (TestEnginesUndoAndRedoWhileARefusalIsPendingEndAsSeen), page and server held to the tab's own text. On 4c23861 seven fail in both engines (A, C, D, I, J, K, M: an undo of a Backspace, of a deletion over the x, a redo of an undo step that held it); the other ten were right there and stay as guards. AGENTS.md names what is still not kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 files changed,
+532
−273
AGENTS.md+22 −8fixtures/carry.mjs+49 −110fixtures/carry.test.mjs+152 −118fixtures/editor-entry.js+41 −20fixtures/engines/undo.mjs+199 −0internal/slides/credits/assets.json+1 −1internal/slides/static/editor.943af95c5a6f2abc.js+16 −0internal/slides/static/editor.edeb171c568b6ea8.js+0 −16internal/slidestest/fonts_engines_browser_test.go+7 −0internal/slidestest/undo_engines_browser_test.go+45 −0
CI passed — run details
AGENTS.mdLoading diff…
fixtures/carry.mjsLoading diff…
fixtures/carry.test.mjsLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/engines/undo.mjsLoading diff…
internal/slides/credits/assets.jsonLoading diff…
internal/slides/static/editor.943af95c5a6f2abc.jsLoading diff…
internal/slides/static/editor.edeb171c568b6ea8.jsLoading diff…
internal/slidestest/fonts_engines_browser_test.goLoading diff…
internal/slidestest/undo_engines_browser_test.goLoading diff…