oficina / docs Public

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>
Paul Campbell pushed by paul@keymail.dev 71178d3e8b5a08f4c8e43dc28fce1cdf9e06a956 parent 98037c7
9 files changed, +542 −76
  • AGENTS.md +20 −4
  • fixtures/carry.mjs +186 −50
  • fixtures/carry.test.mjs +235 −2
  • fixtures/editor-entry.js +18 −4
  • fixtures/engines/diverged.mjs +18 −0
  • internal/docs/carry_browser_test.go +48 −0
  • internal/docs/diverged_engines_browser_test.go +3 −2
  • internal/docs/fonts_engines_browser_test.go +1 −1
  • internal/docs/static/{editor.279133e860986229.js => editor.284edd3ba52d6852.js} +13 −13

CI passed — run details

AGENTS.md

Loading diff…

fixtures/carry.mjs

Loading diff…

fixtures/carry.test.mjs

Loading diff…

fixtures/editor-entry.js

Loading diff…

fixtures/engines/diverged.mjs

Loading diff…

internal/docs/carry_browser_test.go

Loading diff…

internal/docs/diverged_engines_browser_test.go

Loading diff…

internal/docs/fonts_engines_browser_test.go

Loading diff…

internal/docs/static/{editor.279133e860986229.js => editor.284edd3ba52d6852.js}

Loading diff…