oficina / slides Public

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>
Paul Campbell pushed by paul@keymail.dev 59b47700c94287d257e7938c189f1535c85f8561 parent 4c23861
10 files changed, +532 −273
  • AGENTS.md +22 −8
  • fixtures/carry.mjs +49 −110
  • fixtures/carry.test.mjs +152 −118
  • fixtures/editor-entry.js +41 −20
  • fixtures/engines/undo.mjs +199 −0
  • internal/slides/credits/assets.json +1 −1
  • internal/slides/static/editor.943af95c5a6f2abc.js +16 −0
  • internal/slides/static/editor.edeb171c568b6ea8.js +0 −16
  • internal/slidestest/fonts_engines_browser_test.go +7 −0
  • internal/slidestest/undo_engines_browser_test.go +45 −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/undo.mjs

Loading diff…

internal/slides/credits/assets.json

Loading diff…

internal/slides/static/editor.943af95c5a6f2abc.js

Loading diff…

internal/slides/static/editor.edeb171c568b6ea8.js

Loading diff…

internal/slidestest/fonts_engines_browser_test.go

Loading diff…

internal/slidestest/undo_engines_browser_test.go

Loading diff…