Docs: a paste that waited for its font survives a refused save
Claude Fable's follow-up on #88, branch fix/carry-replay (Slides has the same change on its own 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 that waited for its font and ran after the refusal is kept as its ProseMirror transaction too. When its own updates cannot integrate, anchored to the refused text, it is replayed: its steps mapped through the one span where the rebuilt document differs from tr.before and applied with maybeStep, written back with y-prosemirror in one CARRIED transaction before the view is mounted (one undo step, never off the sheet), 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 (now in the gate) 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 sheet, the server and that the words never leave the sheet; resync_browser_test.go's Fable-probe case now keeps the paste once, and TestAChangeOnARefusedOneIsNotPosted covers a second paste and a Backspace over the refused words. On a40df03 the probe case, the new browser test and cases (a), (c), (e), (h), (j), (k) in both engines fail; (b), (f), (g), (i) were kept already and (d) is refused in both, and they stay as guards. prosemirror-transform 1.12.0 (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>
14 files changed,
+910
−61
.amadan/ci.d/10-gate+8 −0AGENTS.md+29 −0fixtures/carry.mjs+186 −0fixtures/carry.test.mjs+213 −0fixtures/editor-entry.js+32 −35fixtures/engines/replay.mjs+216 −0fixtures/package-lock.json+1 −0fixtures/package.json+1 −0fixtures/resync-controller.mjs+9 −0internal/docs/fonts_engines_browser_test.go+28 −4internal/docs/replay_engines_browser_test.go+85 −0internal/docs/resync_browser_test.go+88 −8internal/docs/static/editor.455b88221c9de6ec.js+0 −14internal/docs/static/editor.afc9783241f3cb54.js+14 −0
CI passed — run details
.amadan/ci.d/10-gateLoading diff…
AGENTS.mdLoading diff…
fixtures/carry.mjsLoading diff…
fixtures/carry.test.mjsLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/engines/replay.mjsLoading diff…
fixtures/package-lock.jsonLoading diff…
fixtures/package.jsonLoading diff…
fixtures/resync-controller.mjsLoading diff…
internal/docs/fonts_engines_browser_test.goLoading diff…
internal/docs/replay_engines_browser_test.goLoading diff…
internal/docs/resync_browser_test.goLoading diff…
internal/docs/static/editor.455b88221c9de6ec.jsLoading diff…
internal/docs/static/editor.afc9783241f3cb54.jsLoading diff…