Spec draft 4: Astra round 3 answered (unreviewed)
Idempotent takeovers, preparation leases and a full grace window, revision-bound thumbnails and fragments, steps as numbers so a group can go between two, protocol versions per session, browser storage of the control key, and an empty mode. Third and last review round found 5 P1; these answers have not been reviewed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+117
−27
docs/superpowers/specs/2026-11-11-presenter-and-rehearsal-design.md+117 −27
diff --git a/docs/superpowers/specs/2026-11-11-presenter-and-rehearsal-design.md b/docs/superpowers/specs/2026-11-11-presenter-and-rehearsal-design.md| index 0a9616f..d2104ad 100644 |
| --- a/docs/superpowers/specs/2026-11-11-presenter-and-rehearsal-design.md |
| +++ b/docs/superpowers/specs/2026-11-11-presenter-and-rehearsal-design.md |
| @@ -1,7 +1,8 @@ |
| # ๐ค Slides: presenter, steps, layouts, rehearsal, check โ design |
| -Design, 2026-11-11. **Draft for Paul's approval; nothing here is |
| -approved yet.** Written by Claude Opus 5.5 on branch |
| +Design, 2026-11-11, **draft 4. For Paul's approval; nothing here is |
| +approved yet.** Reviewed three rounds by GPT-6 Astra (11, then 6, then |
| +5 P1); draft 4 answers round 3 and is itself unreviewed (ยง12). Written by Claude Opus 5.5 on branch |
| `design/presenter-and-rehearsal` for |
| [#34](https://amadan.net/oficina/slides/-/discussion/34), which records |
| the presentation layer Paul built for his HalfStack Vienna talk and his |
| @@ -132,7 +133,7 @@ commit per key (the fixtures rule). |
| | Key | On | Type | Meaning | |
| |---|---|---|---| |
| | `optional` | slide map | bool | Shown in full mode only (ยง3.3). | |
| -| `step` | block map | integer โฅ 1 | The press that reveals this block (ยง4). | |
| +| `step` | block map | finite number > 0 | Which group of presses reveals this block (ยง4). A number, like `order`, so a group can be put between two others without renumbering. | |
| | `build` | block map | Y.Map `{effect, items}` | How it arrives: `effect` โ `appear` (default), `fade`, `rise`; `items` โ `together` (default), `each` for `list` blocks (ยง4.2). | |
| | `slot` | block map | string | The library slot this block was made for (ยง5). | |
| | `from` | slide map | Y.Map `{layout, v}` | The library layout and its version the slide was made from (ยง5). | |
| @@ -337,14 +338,23 @@ position on the projector at reconnect, which ยง0.3 forbids. So: |
| not applied. One window per group sends the takeover: the projector |
| screen, or, with several, the one whose random id is lowest among |
| those that answered `hello`. It posts its current state as `{takeover: |
| - true, g: <the generation it last saw>}`; the server, in the |
| - transaction, checks it is a controller and that `g` is still the |
| - row's generation, and commits the state under `g + 1`, answering |
| - `200` with the accepted state. If the generation moved meanwhile |
| - (another group took over), it answers `409` with the current state: |
| - the sender adopts it and the group leaves recovering (another |
| + true, takeover_id: <random, fixed for this attempt>, g: <the |
| + generation it last saw>}`; the server, in the transaction, checks it |
| + is a controller and that `g` is still the row's generation, commits |
| + the state under `g + 1`, **records `takeover_id` on the row**, and |
| + answers `200` with the accepted state. A retry carrying the **same |
| + `takeover_id`** (its first answer was lost) gets that same accepted |
| + result again, never a `409`. Only a takeover with a different id |
| + against a moved generation gets `409` with the current state, and |
| + only then does the sender adopt it and leave recovering (another |
| projector is the room's now). Network failure retries the same |
| - takeover with backoff, staying in recovering. **`ended` and an |
| + takeover, same id, with backoff, staying in recovering. |
| + Local presses made while a takeover is outstanding keep stamping |
| + locally; when the takeover is accepted, the sender at once posts the |
| + group's **current** local state under the new generation as an |
| + ordinary stamped command if it differs from the takeover snapshot, so |
| + the projector never repaints an older position and the server catches |
| + up to what the room sees. **`ended` and an |
| authorisation refusal are applied at once even while recovering.** |
| Leaving recovering applies the buffered server state only if it is |
| newer than the accepted takeover. Presses the phone made during the |
| @@ -372,10 +382,23 @@ slide"), `step` 0, `mode` `full` (shows what it showed before), |
| starts at the next move), `rehearsal` false, stamp `(0, 0, "")`, |
| `control_epoch` 0. |
| -`Slide` (the index) stays, kept equal to the position's index in the |
| -current order, so old pages keep working, and `present.Event` becomes |
| -that schema, keeping `slide`, `blackout` and `ended` with their |
| -meanings. A later migration drops `Slide` |
| +**Protocol versions, per session.** The row gains `protocol`. Every |
| +session **live at deploy keeps protocol 1** until it ends (at most |
| +twelve hours): today's behaviour exactly โ relative commands, no |
| +stamps, no local channel, and slides rendered **fully built** (no |
| +presses), because the pages already open on it run the pre-deploy |
| +`present.js`, which compares only the slide index and blackout and |
| +would never show a press. Every session created after the deploy is |
| +**protocol 2**, with everything in this section; its pages are always |
| +served with the new script, since no page can have been opened for it |
| +before the deploy. There is no upgrade of a live session; a presenter |
| +who wants presses starts a new one. The compatibility test runs the |
| +**actual pre-deploy `present.js`** (from the commit before) against a |
| +protocol-1 session after the migration, including a deck that has |
| +steps (shown fully built). `Slide` (the index) stays on the row for |
| +protocol 1 and is dropped once no protocol-1 session can be live. |
| +`present.Event` becomes the schema above, keeping `slide`, `blackout` |
| +and `ended` with their meanings. A later migration drops `Slide` |
| once no page older than this deploy can be open (twelve hours, the |
| session limit). Tests drive an old page and an unstamped form across |
| the change. |
| @@ -391,7 +414,21 @@ it shows the slide at the presenter's step, so a follower sees each |
| reveal when the room does. `present.Event` carries the step and the |
| share-link fragment route takes `step=` like the projector's. The session's `mode` decides, `core` by default; `o` toggles |
| it and syncs like a move. When a mode change hides the current slide, |
| -the position moves to the next shown slide (the deck's `setMode`). |
| +the position moves to the next shown slide in the order, else the |
| +previous one. |
| + |
| +**A mode with no slides.** A deck can be all optional, and deleting the |
| +last core slide empties core mode. Then the position is `slide_id ""` |
| +("nothing to show"), the same state an empty deck has: the projector |
| +shows the theme's background and nothing else, the presenter view and |
| +remote say "No slides in core mode" (catalog key) and offer `o` / a |
| +button to switch to full, next and previous do nothing, previews are |
| +empty, and the announce region says it once. Switching back to full |
| +lands on the first slide that comes at or after where the talk was in |
| +the full order (the remembered slide id), else the first slide. The |
| +reference deck's `setMode` indexes the empty list here and is not |
| +copied. Tests: an all-optional deck, and deleting the last core slide |
| +mid-talk. |
| The viewer, the editor strip, the PDF and the API show every slide. |
| The strip and the viewer mark an optional slide with a text badge |
| @@ -437,8 +474,9 @@ in one task. |
| The layout engine gains `LayoutAt(d, index, press)`: blocks past the |
| press are measured (they keep their space, P3) but not painted. |
| -Thumbnails take `?step=k` on all four surfaces, so the presenter view |
| -and the remote show "next press" as a picture without a font. PDF |
| +Thumbnails take `?step=k` on all four surfaces (and, on presenting |
| +surfaces, `rev=`, ยง3.6), so the presenter view and the remote show |
| +"next press" as a picture without a font. PDF |
| stays one page per slide, fully built (ยง3.7). |
| ### 3.5 Edits during a presentation |
| @@ -497,15 +535,21 @@ never mixes revisions or duplicates a slide moved mid-fetch. |
| **Which revisions may be asked for.** Never an arbitrary one: |
| -- A **controller** (token or presenter session) may ask for the deck's |
| - **current** seq, which it is about to publish, or for the session's |
| - published `rev`. |
| +- A **controller** prepares a revision by `POST /p/{session}/prepare` |
| + (token or presenter session, CSRF for the cookie case), which answers |
| + `{rev: <the deck's current seq>, lease}`. The lease authorises that |
| + controller, for ten minutes, to fetch every chunk, thumbnail and |
| + asset of **that** revision and to publish it, however many edits land |
| + meanwhile. A controller may also read the session's published |
| + revisions (below). Leases are held in memory per session, at most |
| + four live at once. |
| - A **watcher** (sqid) and a **follower** (`/s/{token}/pack?rev=N`, on |
| - the share-link route, codex 5) may ask only for the session's |
| - published `rev`, or the one published immediately before it for 60 |
| - seconds after a change (so a fetch in flight is not refused). Anything |
| - else is `404`. A follower therefore sees exactly what the room sees |
| - and never the deck's history. |
| + the share-link route, codex 5) may ask only for a **published** |
| + revision: the session's current `rev`, or any revision it published |
| + in the last 60 seconds (each kept for its full 60 seconds; at most |
| + eight kept per session). Anything else is `404`. A follower therefore |
| + sees exactly what the room has been shown and never the deck's |
| + history. |
| **Assets at a revision.** Pack HTML names images on revision-bound |
| routes, `/p/{session}/assets/{ref}?rev=N` and |
| @@ -522,7 +566,13 @@ most 8 MiB encoded; the whole prepared set is capped at 256 MiB of |
| Cache Storage, and slide thumbnails are **two per slide** (step 0 and |
| fully built), not one per press, so an `each` list of N items costs two |
| pictures, not N. Online, the presenter view still fetches the exact |
| -next-press thumbnail (`?step=k`) lazily; offline it shows the fully |
| +next-press thumbnail lazily, **at the revision it presents**: |
| +`โฆ/slides/{id}.svg?rev=N&step=k`, authorised as packs are (a lease or a |
| +published revision), rendered from `openDeckAt(N)`, its ETag keyed by |
| +`(rev, slide, step, width)`. A slide deleted since stays drawable at |
| +the revision that still has it. The scriptless projector pages and the |
| +fragment reads (`?slide=N&step=k&fragment=1`) likewise render at the |
| +session's published `rev`, never the current deck; offline it shows the fully |
| built picture labelled "Next: press k of n". Over any cap, preparation |
| stops and the presenter view says "Not ready offline: this deck is |
| too large to keep offline" with the size, and "Ready offline" never |
| @@ -549,6 +599,17 @@ in the session state. |
| has been asked (its answer is shown: "kept until the session ends" or |
| "the browser may clear this"). Otherwise "Not ready offline: N items |
| missing". |
| +- **The control key in the browser.** The server never stores the key |
| + (it derives it); the browser may, and this is part of the exception. |
| + A controller fetches it from `/p/{session}/control` and keeps it in |
| + IndexedDB keyed by `(session, control_epoch)`, in the controller's |
| + own origin storage; cached page shells never embed it (they fetch it |
| + from IndexedDB at start). On an offline reload a controller recovers |
| + local sync from there. Revalidation for a controller asks |
| + `/p/{session}/control` (controller authority), not just `/state`: any |
| + refusal deletes the stored key with the caches; a new |
| + `control_epoch` deletes the old key; expiry deletes it with the rest. |
| + A watcher's cache never holds a key. |
| - **State is kept apart from content**: the position, stamp and clock |
| live in `sessionStorage`/IndexedDB keyed by session, never in the |
| cached HTML, so a reload offline resumes the position, not the page |
| @@ -649,7 +710,17 @@ stay laid out while hidden. Accumulating lists. Fades. |
| group after a named one), which are exactly the representable |
| choices, and shows the resulting press range ("presses 1โ3" for an |
| `each` list). It writes stored steps; the API and MCP say `step` for |
| - what is stored and `press` for what is shown. Appearing between two |
| + what is stored and `press` for what is shown. **"After โฆ" is one |
| + `set_block`**: steps are numbers (like `order`, ruling 18), so a new |
| + group after the group at step 1 and before the one at 2 is written as |
| + 1.5 โ the midpoint โ and nothing else is renumbered, so a concurrent |
| + edit on any other block is untouched. "After the last group" writes |
| + `max + 1`. When a midpoint would fall below 2โปยฒโฐ of its neighbours, |
| + the inspector instead writes a dense renumbering of that slide's |
| + steps (`1..n`) in one batch, one undo step; concurrent renumberings |
| + merge per block as any placement edit does (visible, fixable, never |
| + content). Fixtures cover the midpoint, the renumbering and two |
| + concurrent "after" inserts. Appearing between two |
| items of an `each` list is not representable and not offered (ยง4.4). |
| - **Conformance vectors**: `internal/slides/deck/testdata/presses.json`, |
| hand-written, read by the Go tests of `deck.Presses`, `render` and |
| @@ -1279,6 +1350,12 @@ Ranked by how much the answer changes what gets built. |
| alternative is freezing the whole deck at "start talk". Which do you |
| want in a real talk? |
| +7. **A fourth review before planning?** The brief allowed three Astra |
| + rounds and round 3 still found five P1s, all in the presenting |
| + protocol and offline preparation (ยง3.2, ยง3.6) or step placement |
| + (ยง4.2). Draft 4 answers them, unreviewed. Recommendation: one more |
| + Astra round on ยง3.2, ยง3.6 and ยง4.2 only, before a plan is written. |
| + |
| --- |
| ## 12. Review record |
| @@ -1319,3 +1396,16 @@ Ranked by how much the answer changes what gets built. |
| instead of "on press N" (ยง4.2); byte-budgeted request pages (ยง8.2); |
| chunked, capped preparation with two thumbnails per slide (ยง3.6); the |
| rehearsal start as a POST (ยง6.2). |
| +- **GPT-6 Astra round 3** (on draft 3): 5 P1, 2 P2. Astra confirmed the |
| + round-2 answers on guarded commands, terminal ending, the shared |
| + tree, the fully-built default, revision-bound assets and #25's |
| + receipt semantics. Draft 4 answers the rest: idempotent takeovers by |
| + `takeover_id` and carrying local presses into the new generation |
| + (ยง3.2); preparation leases and a full 60-second grace per published |
| + revision (ยง3.6); revision-bound thumbnails, fragments and scriptless |
| + pages (ยง3.6); steps as numbers so "after โฆ" is one midpoint write |
| + (ยง2, ยง4.2); protocol versions per session, with live sessions left on |
| + today's behaviour (ยง3.2); browser storage of the control key (ยง3.6); |
| + an empty mode (ยง3.3). **Three rounds was the cap, so draft 4's |
| + changes have not been reviewed.** A fourth Astra round, or a review |
| + of the plan, should look at them first. |