Docs: an undo or a redo while diverged ends as the person saw it
Claude Fable's review of #90 at 71178d3 (merged as 25cd32a). The same module change as Slides' (oficina/slides fix/undo-redo-while-diverged). - P1: an undo or a redo that put text back was lost when that text belonged to a change the resync replays (Yjs anchors the re-inserted text to the original, which the rebuilt document never holds, and ySync's mirror carried no replay). The mirror of an undo or a redo now leaves a replay derived from its before and after (carry.mjs's derivedStep), taken by the next keep in the same Yjs transaction; watchUndo goes. As Fable flagged for Paul: an undo or a redo that put the refused text back on screen now brings it back on the sheet too. - P2: TestFontEnginesAWaitingPasteSurvivesARefusedSave was flaky under load, on main too. replay.mjs held the code face a fixed 1.5 s, which raced the refusal: a face that came first put the paste into the refused batch, one that came late ran past the paste's deadline. It now holds the face until the case's refusal has landed, waits for the colleague's save to be answered, and for the sheet and its saves to settle, instead of fixed sleeps. - P2: carry.test.mjs's timing bound is on growth in CPU time. - Nit: an entry that only deletes what the rebuilt document never held is not counted as lost. Tests: Fable's seventeen cases in carry.test.mjs and, through the real editor in Chromium and WebKit, fixtures/engines/undo.mjs (TestEnginesUndoAndRedoWhileARefusalIsPendingEndAsSeen); on 25cd32a the same seven fail in both engines (A, C, D, I, J, K, M), the other ten stay as guards. AGENTS.md names what is still not kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 files changed,
+566
−270
AGENTS.md+21 −10fixtures/carry.mjs+49 −110fixtures/carry.test.mjs+152 −118fixtures/editor-entry.js+31 −13fixtures/engines/replay.mjs+49 −7fixtures/engines/undo.mjs+201 −0internal/docs/fonts_engines_browser_test.go+6 −1internal/docs/static/{editor.284edd3ba52d6852.js => editor.19091003f4b6baf4.js}+11 −11internal/docs/undo_engines_browser_test.go+46 −0
CI passed — run details
AGENTS.mdLoading diff…
fixtures/carry.mjsLoading diff…
fixtures/carry.test.mjsLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/engines/replay.mjsLoading diff…
fixtures/engines/undo.mjsLoading diff…
internal/docs/fonts_engines_browser_test.goLoading diff…
internal/docs/static/{editor.284edd3ba52d6852.js => editor.19091003f4b6baf4.js}Loading diff…
internal/docs/undo_engines_browser_test.goLoading diff…