Slides: a paste that waited for its font survives a refused save
Claude Fable's follow-up on #27/#88, branch fix/carry-replay. carry() moves to fixtures/carry.mjs and decides from each update itself (Y.decodeUpdate): a struct took when the doc's state for its client reaches its end, a deleted range likewise. encodeStateVectorFromUpdate named a client only when its structs start at clock 0, and a delete-only update has none, so every update after a client's first, and every Backspace, read as taken and was posted. An update of which nothing took is held back; of one that partly took, only the part that integrated is posted, so nothing sits pending in the server's log (a paste into marked text rewrites the formatting around it as well). A paste that waited for its font and ran after the refusal is kept as its ProseMirror transaction too (editor-fonts.mjs's aroundRun). When its own updates cannot integrate, anchored to the refused text, it is replayed: its steps mapped through the one span where the rebuilt text differs from tr.before and applied with maybeStep, written back with y-prosemirror in one CARRIED transaction before any view is mounted (one undo step, never off the slide), and that update posted. Where ProseMirror refuses a step (a paste into a paragraph the refused Enter made) the paste is left out as before: nothing posted, the save line failed, the clipboard untouched. Tests: carry.test.mjs holds Fable's eleven replay cases and his classification probes with the real Yjs and y-prosemirror; TestFontEnginesAWaitingPasteSurvivesARefusedSave runs the eleven through the real editor in Chromium and WebKit (fixtures/engines/replay.mjs), checking the page, the server and that the words never leave the page; TestAChangeOnARefusedOneIsNotPosted adds a second paste and a Backspace over the refused words. On 52983f8: cases (a) (Fable's probe), (c), (e), (h), (j), (k) fail in both engines, as do the classification tests and the browser test; (b), (f), (g), (i) were kept already and (d) is refused in both, and they stay as guards. prosemirror-transform 1.12.1 (already in the lockfile) is now a direct dependency. AGENTS.md and resync-controller.mjs's header describe the carry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 files changed,
+851
−67
AGENTS.md+16 −3fixtures/carry.mjs+186 −0fixtures/carry.test.mjs+213 −0fixtures/editor-entry.js+48 −33fixtures/editor-fonts.mjs+5 −2fixtures/engines/replay.mjs+212 −0fixtures/package-lock.json+1 −0fixtures/package.json+1 −0fixtures/resync-controller.mjs+9 −0internal/slides/credits/assets.json+3 −3internal/slides/static/editor.07a0c82a854673ff.js+16 −0internal/slides/static/editor.ba2ef94a3f5c9b80.js+0 −16internal/slidestest/fonts_engines_browser_test.go+16 −1internal/slidestest/races_browser_test.go+31 −9internal/slidestest/replay_engines_browser_test.go+94 −0
CI passed — run details
AGENTS.mdLoading diff…
fixtures/carry.mjsLoading diff…
fixtures/carry.test.mjsLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/editor-fonts.mjsLoading diff…
fixtures/engines/replay.mjsLoading diff…
fixtures/package-lock.jsonLoading diff…
fixtures/package.jsonLoading diff…
fixtures/resync-controller.mjsLoading diff…
internal/slides/credits/assets.jsonLoading diff…
internal/slides/static/editor.07a0c82a854673ff.jsLoading diff…
internal/slides/static/editor.ba2ef94a3f5c9b80.jsLoading diff…
internal/slidestest/fonts_engines_browser_test.goLoading diff…
internal/slidestest/races_browser_test.goLoading diff…
internal/slidestest/replay_engines_browser_test.goLoading diff…