Docs: an undo while diverged stays undone; multi-step changes rebase; carrying is linear
Claude Fable's review of #90 at 89d4b5c (rebased onto 29b6dea). The same module change as Slides' (oficina/slides feat/replay-while-diverged, c0990c8; details there): - P1: an undo made while diverged, after a change the resync replays, brought the undone text back and posted it. The keeper follows yUndoPlugin's undo manager (watchUndo): an undo marks the entries it took back, and its own delete of them, undone; a redo brings them back and leaves its own re-insert out. - P2: multi-step transactions (the autoformat rules delete their marker and then wrap or retype the block) rebase prosemirror-collab's way instead of mapping every step through the one span map. - P2: cost. Ids come from the doc's beforeTransaction: one per 500 ms window for ProseMirror changes, one each for anything else; carry is linear (clocks from the struct store, one running probe copy) and never applies an entry of which nothing would take; freshClientID never returns an id the doc holds. Tests, failing first on 98037c7 unless said: carry.test.mjs (in the gate) gains the multi-step cases, undo/redo while diverged, the id windows, the collision guard and 4000 changes carried in under a second (the 2000-replays bound and the undo of a carried or saved change pass there and stay as guards); TestAnUndoWhileARefusalIsPendingStaysUndone (Fable's probe, with redo) and an undo in the middle of diverged.mjs, in Chromium and WebKit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 files changed,
+542
−76
AGENTS.md+20 −4fixtures/carry.mjs+186 −50fixtures/carry.test.mjs+235 −2fixtures/editor-entry.js+18 −4fixtures/engines/diverged.mjs+18 −0internal/docs/carry_browser_test.go+48 −0internal/docs/diverged_engines_browser_test.go+3 −2internal/docs/fonts_engines_browser_test.go+1 −1internal/docs/static/{editor.279133e860986229.js => editor.284edd3ba52d6852.js}+13 −13
CI passed — run details
AGENTS.mdLoading diff…
fixtures/carry.mjsLoading diff…
fixtures/carry.test.mjsLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/engines/diverged.mjsLoading diff…
internal/docs/carry_browser_test.goLoading diff…
internal/docs/diverged_engines_browser_test.goLoading diff…
internal/docs/fonts_engines_browser_test.goLoading diff…
internal/docs/static/{editor.279133e860986229.js => editor.284edd3ba52d6852.js}Loading diff…