oficina / docs Public

Docs: carry counts a partly-applied delete, maps past an overlap, and keeps each change on its own id

Claude Fable's review of #89 at b48dad3: three P1s, the same module as
Slides' (oficina/slides fix/carry-replay, 10fcbf7).

- A delete range can take in part: Yjs deletes up to the doc's state for
  its client and holds the rest pending. took() counted such a range as
  not taken, so a Backspace over this tab's saved and refused words
  together deleted on the sheet and posted nothing. It now counts the
  applied part.
- replaySteps clamped the two ends of an overlapping diff to its start,
  giving an empty span, and a replayed paste landed a letter off. Both
  ends now move past the overlap, as prosemirror-view's findDiff does.
- One change held back held back every later one (Yjs's per-client
  clock order). The keeper (carry.mjs's createKeeper, replacing
  editor-entry's keep) gives the document a fresh client id after every
  change while diverged.

Tests, each failing on b48dad3: carry.test.mjs gains Fable's three
cases; carry_browser_test.go holds the three in the real editor (a
Backspace over "cx", an "r" typed into "par|agraph" with the paste
right after it, and a clean paste after a held-back keystroke in both
orders; the clean-first order passes on b48dad3 and stays as a guard).

AGENTS.md and carry.mjs's header state the range rule and the
per-change id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev b8dbbf70e30fd96416791fb25c7a62d4aa4a17c9 parent b48dad3
7 files changed, +390 −57
  • AGENTS.md +12 −7
  • fixtures/carry.mjs +65 −12
  • fixtures/carry.test.mjs +91 −1
  • fixtures/editor-entry.js +11 −23
  • internal/docs/carry_browser_test.go +197 −0
  • internal/docs/static/editor.7ff107f6ce88eea0.js +14 −0
  • internal/docs/static/editor.afc9783241f3cb54.js +0 −14

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…

internal/docs/carry_browser_test.go

Loading diff…

internal/docs/static/editor.7ff107f6ce88eea0.js

Loading diff…

internal/docs/static/editor.afc9783241f3cb54.js

Loading diff…