oficina / docs Public

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>
Paul Campbell pushed by paul@keymail.dev b48dad305fce630801a7de684ef048f3ffc6e802 parent a40df03
14 files changed, +910 −61
  • .amadan/ci.d/10-gate +8 −0
  • AGENTS.md +29 −0
  • fixtures/carry.mjs +186 −0
  • fixtures/carry.test.mjs +213 −0
  • fixtures/editor-entry.js +32 −35
  • fixtures/engines/replay.mjs +216 −0
  • fixtures/package-lock.json +1 −0
  • fixtures/package.json +1 −0
  • fixtures/resync-controller.mjs +9 −0
  • internal/docs/fonts_engines_browser_test.go +28 −4
  • internal/docs/replay_engines_browser_test.go +85 −0
  • internal/docs/resync_browser_test.go +88 −8
  • internal/docs/static/editor.455b88221c9de6ec.js +0 −14
  • internal/docs/static/editor.afc9783241f3cb54.js +14 −0

CI passed — run details

.amadan/ci.d/10-gate

Loading diff…

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/package-lock.json

Loading diff…

fixtures/package.json

Loading diff…

fixtures/resync-controller.mjs

Loading diff…

internal/docs/fonts_engines_browser_test.go

Loading diff…

internal/docs/replay_engines_browser_test.go

Loading diff…

internal/docs/resync_browser_test.go

Loading diff…

internal/docs/static/editor.455b88221c9de6ec.js

Loading diff…

internal/docs/static/editor.afc9783241f3cb54.js

Loading diff…