oficina / docs Public

Docs: one save on the wire at a time, and every byte owed is counted

The save queue kept one inFlight slot. When the debounce fired while a
save was still on the wire (a slow connection, a big paste), a second
save went out beside the first and overwrote the slot; the first one's
answer then cleared it, so pendingBytes() reported nothing owed while
the second save was still out, and a close in that moment beaconed
nothing for it. A first save that failed after the second had gone was
retried behind it, out of order. Astra found this on Slides #27, whose
queue is a copy of this one.

Now one save is on the wire at a time; edits made meanwhile wait and go,
merged, as soon as it is answered. Every update is numbered and stays
counted in pendingBytes() until it is acknowledged or refused. A retry
goes back in front of everything after it. flush() resolves only once
every edit made before it was answered for good: true if saved, false
if refused. A refusal is still final and still never merged into later
edits.

save-queue.test.mjs: four new tests, each failing on dadf9c1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 80738477f87a80bf2a323a1f411a3897cf8a3c45 parent dadf9c1
4 files changed, +234 −56
  • fixtures/save-queue.mjs +104 −42
  • fixtures/save-queue.test.mjs +116 −0
  • internal/docs/static/editor.196c375f7a6a7ab9.js +0 −14
  • internal/docs/static/editor.cd50554350b8c6aa.js +14 −0

CI passed — run details

fixtures/save-queue.mjs

Loading diff…

fixtures/save-queue.test.mjs

Loading diff…

internal/docs/static/editor.196c375f7a6a7ab9.js

Loading diff…

internal/docs/static/editor.cd50554350b8c6aa.js

Loading diff…