oficina / slides Public

Slides: resync keeps a waiting paste, the projector ignores stale answers, saves are counted

Astra's re-review of #27 at c1d2f4d.

A resync no longer discards a change that waited for its font. The
resync waits for it, keeps every local update made while diverged, and
applies them once to the rebuilt document and saves them through its
queue. From divergence the tab writes under a fresh Yjs client id: Yjs
integrates one client's updates only in clock order, so a paste written
after the refused batch under the old id was held as pending forever.

The projector cannot be rolled back by a late answer. Streamed slides,
link/form/popstate pages and whole-state events share one counter in
present.js; a request takes its number when it starts and is applied
only while it is still the newest, before and after its fonts. A
streamed slide swaps the stage and the bar together from the surface's
own ?slide=n page, so the counter moves with it.

The save queue has one save on the wire at a time, numbers every update
and counts the batch on the wire until it is answered, so pendingBytes()
is exact. flush() resolves only when every earlier update is answered:
true if saved, false if refused, waiting through retries. A new slide
goes up only after a true flush.

After an in-place change focus stays on the control used, or goes to
the slide when that control is gone; "Slide N of M: title" is said
through a polite status region present from the first render.

races_browser_test.go and six save-queue unit tests, each failing on
c1d2f4d.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 203d71828ee1799075956cb9fd58cdef186feb3e parent c1d2f4d
18 files changed, +734 −141
  • AGENTS.md +27 −5
  • fixtures/commands.mjs +6 −2
  • fixtures/editor-entry.js +65 −5
  • fixtures/save-queue.mjs +104 −61
  • fixtures/save-queue.test.mjs +128 −0
  • fixtures/viewer-nav.mjs +33 −7
  • internal/slides/credits/assets.json +3 −3
  • internal/slides/locales/en.toml +3 −0
  • internal/slides/presentation.go +5 −0
  • internal/slides/static/{editor.32cedc10927dae66.js => editor.6f20169670d59132.js} +15 −15
  • internal/slides/static/fontsgate.358bdc2e9398e6da.js +0 −1
  • internal/slides/static/fontsgate.3753849cb5b94339.js +1 −0
  • internal/slides/static/present.js +85 −39
  • internal/slides/templates/present.html +4 −0
  • internal/slides/templates/viewer.html +8 −2
  • internal/slides/viewer.go +7 −1
  • internal/slidestest/fonts_browser_test.go +8 −0
  • internal/slidestest/races_browser_test.go +232 −0

CI passed — run details

AGENTS.md

Loading diff…

fixtures/commands.mjs

Loading diff…

fixtures/editor-entry.js

Loading diff…

fixtures/save-queue.mjs

Loading diff…

fixtures/save-queue.test.mjs

Loading diff…

fixtures/viewer-nav.mjs

Loading diff…

internal/slides/credits/assets.json

Loading diff…

internal/slides/locales/en.toml

Loading diff…

internal/slides/presentation.go

Loading diff…

internal/slides/static/{editor.32cedc10927dae66.js => editor.6f20169670d59132.js}

Loading diff…

internal/slides/static/fontsgate.358bdc2e9398e6da.js

Loading diff…

internal/slides/static/fontsgate.3753849cb5b94339.js

Loading diff…

internal/slides/static/present.js

Loading diff…

internal/slides/templates/present.html

Loading diff…

internal/slides/templates/viewer.html

Loading diff…

internal/slides/viewer.go

Loading diff…

internal/slidestest/fonts_browser_test.go

Loading diff…

internal/slidestest/races_browser_test.go

Loading diff…