Spec §8.2.2 and §14a: cite suite revision 11 at 91affa1
The cursor reset (409, never 503; a failed read is still 503), revisions unique against the whole log, the per-event stamp, the headers and what sits in front of Handler, RunProducer, and what Rule does today for a person removed from the team (grants kept, ownership dropped in team mode), recorded against gate 5's reading and left unchanged pending Paul's ruling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+96
−20
docs/superpowers/specs/2026-08-30-docs-design.md+96 −20
CI passed — run details
Intent
diff --git a/docs/superpowers/specs/2026-08-30-docs-design.md b/docs/superpowers/specs/2026-08-30-docs-design.md| index 86a68ca..4472337 100644 |
| --- a/docs/superpowers/specs/2026-08-30-docs-design.md |
| +++ b/docs/superpowers/specs/2026-08-30-docs-design.md |
| @@ -654,14 +654,17 @@ ruling. |
| The native apps get `visibility` in the share JSON and the same route; |
| their UI for it is not built yet. |
| -### 8.2.2 Serving the suite contract (suite revision 10) |
| +### 8.2.2 Serving the suite contract (suite revision 11) |
| Docs implements `server.Producer` from `amadan.net/oficina/suite/server` |
| -(suite §6.5, read at commit `c38e3ad`) and mounts `server.Handler`. The |
| -package owns the bearer check, the wire shapes, the S2 decode and cap and |
| -S3's one refusal; what follows is only the part Docs owes. Custody is every |
| -live document, per revision 10's §4.2 and §4.3 notes, which are cited and |
| -not restated. |
| +(suite §6.5 and §6.6, **revision 11, read at commit `91affa1`**, suite |
| +`main` on 2026-11-02; built against revision 10 at `c38e3ad` and moved to |
| +revision 11 on branch `feat/suite-r11`) and mounts `server.Handler`. The |
| +package owns the bearer check, the wire shapes, the strict S2 decode and |
| +cap, `Cache-Control: no-store` and `Vary: Authorization` on every response, |
| +the cursor reset's fixed 409 and S3's one refusal; what follows is only the |
| +part Docs owes. Custody is every live document, per revision 10's §4.2 and |
| +§4.3 notes, which are cited and not restated. |
| **The revision counter.** `documents.revision` moves, in the same writer |
| transaction as the change, on creation and on every applied update |
| @@ -670,10 +673,17 @@ alone misses renames, and a rename changes S3's bytes. A grant, a revoke or |
| a link changes who may read, which S2 asks live, so none of them moves it. |
| Each new value — on every change, on creation, and in migration 0011 for |
| every document that existed before it — is **a fresh random positive |
| -value**, never the current one. In code it is 63 random bits from Go's |
| -`crypto/rand` (a zero, or the current value, is drawn again; a source that |
| -cannot be read is an error and the change does not commit — nothing falls |
| -back to a clock or a counter). In migration 0011 it is SQLite's `random()` |
| +value**, never the current one and never any revision this document's |
| +`suite_feed` rows hold. In code it is 63 random bits from Go's |
| +`crypto/rand` (a zero, the current value, or any value in the document's |
| +log is drawn again — `logRevisionTaken`, one probe of the |
| +`suite_feed_document_revision` index that migration `0012` adds, since every |
| +applied update bumps and the log only grows; a source or a log that cannot |
| +be read is an error and the change does not commit — nothing falls back to |
| +a clock or a counter). Revision 11 (suite §6.6) makes the whole-log rule |
| +normative: a draw equal to a *prior* revision would give an old name to new |
| +bytes, and a consumer still holding that prior copy would be answered |
| +`VISIBLE` over it. Revision 10's code redrew only on the current value. In migration 0011 it is SQLite's `random()` |
| masked to 63 bits and forced odd, so **62 random bits**; SQLite's PRNG is |
| ChaCha20 (verified in modernc.org/sqlite v1.55.0), seeded from the OS |
| (`/dev/urandom`), and falls back to the time and the process id if that |
| @@ -697,10 +707,21 @@ library. *Live* is `deleted_at IS NULL AND owner_id > 0`: the orphans |
| **S1.** Pages the log by `id`, 256 rows (`server.FeedPageLimit`). The cursor |
| is `"<id>.<stamp>"` of the last row served, in canonical decimals; `""` and |
| `"0"` are the beginning. The stamp is checked against the row on every |
| -request, and a cursor whose row is gone or carries another stamp — or any |
| -cursor Docs did not issue — is an error, which the suite package answers |
| -503: never a page, never a guess at a position. At the tip Docs returns the |
| -cursor it was given and no rows. Every |
| +request. A cursor the log does not recognise — one whose row is gone or |
| +carries another stamp, or any cursor Docs did not issue or that does not |
| +parse — is `server.ErrCursorReset`, which the suite package answers with |
| +suite §6.6's one fixed `409 {"code":"CURSOR_RESET"}`: never a page, never a |
| +guess at a position, and (since revision 11) never the 503 revision 10's |
| +Docs gave it. Docs never expires or compacts `suite_feed`, so no cursor it |
| +issued goes stale any other way. **A log that cannot be read is not a |
| +reset**: the read's error is returned as it is and the package answers 503, |
| +because a reset makes the consumer set aside everything it holds from Docs |
| +and a database that is briefly unreadable has lost nothing. `""` and `"0"` |
| +are never reset. The stamp is drawn at random **per event and written with |
| +that event's row**, the first of the two shapes suite §6.6 makes normative, |
| +so a restored log holds only the stamps of the rows it actually has; Docs |
| +keeps no generation id. At the tip Docs returns the cursor it was given and |
| +no rows. Every |
| row is emitted, so a document edited ten times since the last poll appears |
| ten times; the earlier rows name revisions that are no longer current, S3 |
| answers them 404, and the consumer counts them missing until the last row |
| @@ -733,6 +754,29 @@ revision. A Home subject with no Docs principal yet still reads the |
| team rung by standing alone, since its first sign-in would. Nothing is |
| cached: every call reads the roster lease and the database afresh. |
| +*A person removed from the team* is answered by the same read check as |
| +everything else, and revision 11 changes nothing in `Rule`. What that |
| +check does today, observed 2026-11-02 on `feat/suite-r11` (team mode, the |
| +custody fixture's world with the asker off the roster): a document they |
| +were **individually granted** stays `VISIBLE` (the address grant does not |
| +key on standing), and the team rung goes; so does **ownership** — their own |
| +private document answers `NOT_VISIBLE`, because `permissionScope` opens |
| +ownership only to a `Member` (above). In lone shape an address taken off |
| +`$DOCS_ALLOWED_ADDRESSES` and holding no live grant fails the front door |
| +and reaches nothing; one still holding a grant passes it and keeps its own |
| +documents too (read from the code, not run). Suite gate 5's reading, which binds |
| +until Paul rules on suite §14's question, is that losing team standing |
| +does not *by itself* revoke what a person owns or was individually granted |
| +(the module's `server.Producer` doc says the same). Docs therefore keeps |
| +grants as gate 5 reads, and drops ownership, which is closer to revision |
| +11's withdrawn proposal than to gate 5. **This is recorded, not changed**: |
| +the brief for this branch was to leave `Rule` alone until Paul rules, and |
| +the ownership rule is the app's own read check, which S2 must not diverge |
| +from. Revision 11's case `doc-owner-left` was withdrawn at `91affa1`, so no |
| +binding fixture asks; Docs' custody seeding refuses any case whose owner is |
| +not `asker` or `other`, so a reinstated case is seen rather than seeded as |
| +somebody else's. |
| + |
| **S3.** The current revision only; anything else is |
| `suite.ErrNotAvailable`, as is a deleted or unknown id. The body is plain |
| UTF-8: the title, a blank line, then `Store.Text`. An untitled document is |
| @@ -769,11 +813,30 @@ most N·M·2^-62 (a million each side: about 2×10^-7). A cursor fails to be |
| refused only if the row now at its id drew the same nonce, 2^-63 or 2^-62 |
| per cursor. Barring that, a pre-restore copy is `UNKNOWN` (its revision is |
| not in the restored log), withheld loudly, and a pre-restore cursor is a |
| -503. The migration's fallback seed (time and pid, when `/dev/urandom` |
| -cannot be opened) would weaken only migration-issued values, once. Kept as defence in depth: that persistent S1 error is the |
| -signal, not something to retry past — **after a restore memoria must drop |
| -everything it holds from Docs and its Docs cursor, and re-read from |
| -`""`.** |
| +`409 CURSOR_RESET` (revision 10's Docs answered it 503, and left the |
| +reset to a person). The migration's fallback seed (time and pid, when |
| +`/dev/urandom` cannot be opened) would weaken only migration-issued values, |
| +once. The reset is the signal: on it memoria soft-drops everything it holds |
| +from Docs, re-reads from `""` and retires what the re-read does not name |
| +(suite §6.6's consumer half, which is memoria's and is cited, not |
| +restated). |
| + |
| +**Headers, and what sits in front of `Handler`.** `server.Handler` sets |
| +`Cache-Control: no-store` and `Vary: Authorization` on every suite |
| +response, refusals and the 401 included. `mountSuite` puts it on the outer |
| +mux beside the router, outside the session, admission and `homeCSRF` |
| +layers; the only thing in front of it in the binary is rastrillo's |
| +production stack (`rastrillo.Handler(ServeOptions(...))`: locale, security |
| +headers, panic recovery), which adds its own security headers and leaves |
| +those two alone. `TestSuiteS1ResetIsNotAFailure` holds both through that |
| +stack; what a proxy in front of the box does is outside this repo. |
| + |
| +**Conformance.** `conformance.RunProducer` (revision 11), in lone shape |
| +(address askers) and team mode (person refs), drives the producer through |
| +`server.Handler` with a token the harness mints, so what is tested is what |
| +is served. It replaced `conformance.RunAs`/`Run` over `server.Routes`, the |
| +unauthenticated routes the module has deprecated. The seeding reads each |
| +case's `prior_revision` from the fixture rather than computing one. |
| **The delegated agent API (main `5039cf6`) and this section.** Its |
| `docs_create` and `docs_update` write through `CreateDraft` and |
| @@ -1366,6 +1429,19 @@ Docs does **not** restate any of them. Where this spec previously did — the |
| five-call contract in §9.1, the instance boundary in §8.2, the egress reason |
| in §11.2 — the restatement has been replaced by a citation. |
| +**Suite revision 11, commit `91affa1` (2026-11-02), consumed for the producer |
| +half; §8.2.2 cites it.** It makes a restore safe and S2/S3 fail closed: a |
| +revision is unique per item against every revision the log holds (§6.6); a |
| +cursor the log does not recognise is answered `409 {"code":"CURSOR_RESET"}`, |
| +never a 503 (§6, S1 row; §6.6); the cursor stamp is drawn per event (§6.6); |
| +every response carries `Cache-Control: no-store` and `Vary: Authorization` |
| +(§6.5); and producers test through `conformance.RunProducer` (§6.5, gate |
| +3). Its one question for Paul — whether a person removed from the team keeps |
| +what they own or were granted — is unruled, so gate 5's reading binds; Docs' |
| +`Rule` is unchanged, and where it differs from that reading (ownership, in |
| +team mode) §8.2.2 says so. `91affa1` is suite `main` after Fable 5.1's review |
| +(APPROVE on 640d058). |
| + |
| **Suite revision 10, commit `c38e3ad` (2026-11-01), consumed for the producer |
| half.** Paul's ruling that day, **"Hold private too, check per person"**, |
| widens custody to every live item; the revision's notes at §4.2 and §4.3 and |
| @@ -1378,7 +1454,7 @@ rounds); §8.2.2 was built against it, conformance included. |
| **Docs imports the contract module under its old path.** Suite §10 says Docs |
| moves from `github.com/carlosframework/docs` to `amadan.net/oficina/docs` |
| before it imports the contract. Importing works without the move — `go get |
| -amadan.net/oficina/suite@c38e3ad` resolves through the hub — so the move |
| +amadan.net/oficina/suite@91affa1` resolves through the hub — so the move |
| stays a follow-up of its own rather than riding this change. |
| **Not yet consumed**, because they need work this spec has not specified: |