oficina / docs Public

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>
Paul Campbell pushed by paul@keymail.dev e2d2b576c98edbaa14343f700a1776a37178598d parent 317e09b
9 files changed, +566 −270
  • AGENTS.md +21 −10
  • fixtures/carry.mjs +49 −110
  • fixtures/carry.test.mjs +152 −118
  • fixtures/editor-entry.js +31 −13
  • fixtures/engines/replay.mjs +49 −7
  • fixtures/engines/undo.mjs +201 −0
  • internal/docs/fonts_engines_browser_test.go +6 −1
  • internal/docs/static/{editor.284edd3ba52d6852.js => editor.19091003f4b6baf4.js} +11 −11
  • internal/docs/undo_engines_browser_test.go +46 −0

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/replay.mjs

Loading diff…

fixtures/engines/undo.mjs

Loading diff…

internal/docs/fonts_engines_browser_test.go

Loading diff…

internal/docs/static/{editor.284edd3ba52d6852.js => editor.19091003f4b6baf4.js}

Loading diff…

internal/docs/undo_engines_browser_test.go

Loading diff…