oficina / slides Public

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

Claude Fable's review of #28 at c49ed4e: three P1s.

- 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 (one range, one client, contiguous clocks) deleted on the
  page and posted nothing. It now counts the applied part (state past
  the start: some took; short of the end: some did not).
- replaySteps clamped the two ends of an overlapping diff to its start
  (a refused letter repeating the one beside it), 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 integrates a
  client's structs in 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 c49ed4e: carry.test.mjs gains Fable's three cases
(a Backspace across one client's saved and refused text; a paste after
a refused repeated letter; a clean change after one held back, in both
orders through the keeper); carry_browser_test.go holds his two
real-editor probes and finding 3 in both orders. Of these the repeated
letter typed into "hell|o" and the held-back-then-clean order fail on
c49ed4e in the browser; the Backspace probe and the deleted-letter
shape pass there (the editor's update for the Backspace also carries a
struct, so c49ed4e posted it whole) and stay as guards.

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 10fcbf74ac0de62155aa7e02289a05afdcabd259 parent c49ed4e
7 files changed, +389 −56
  • AGENTS.md +10 −4
  • fixtures/carry.mjs +65 −12
  • fixtures/carry.test.mjs +91 −1
  • fixtures/editor-entry.js +11 −23
  • internal/slides/credits/assets.json +1 −1
  • internal/slides/static/{editor.07a0c82a854673ff.js => editor.596eb5f31695119e.js} +15 −15
  • internal/slidestest/carry_browser_test.go +196 −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…

internal/slides/credits/assets.json

Loading diff…

internal/slides/static/{editor.07a0c82a854673ff.js => editor.596eb5f31695119e.js}

Loading diff…

internal/slidestest/carry_browser_test.go

Loading diff…