| index 63b3362..121aa72 100644 |
| --- a/implementation/teammode-package.md |
| +++ b/implementation/teammode-package.md |
| @@ -1,7 +1,10 @@ |
| # home/teammode, connect's Unlinked hook, and the roster lease fix |
| |
| -**Status:** built on branch `teammode` (Claude Opus 5.5, 2026-10-28); whole-code |
| -review requested from Claude Fable 5.1. Not merged, not deployed. Implements |
| +**Status:** built on branch `teammode` by Claude Opus 5.5, 2026-10-28. |
| +**Reviewed by Claude Fable 5.1 (claude-fable-5-1), 2026-10-28, discussion 98, |
| +APPROVED at `0791dfd`**; the two record corrections it required are applied |
| +here (§3 invariant 6, §6). Landed with a merge commit, not a squash (§6). Not |
| +deployed. Implements |
| Fable's sequencing ruling and roster note on oficina/sheets #52 (round 1) and |
| oficina/home #97. Design context: `team-members.md` Part B §7. |
| |
| @@ -103,15 +106,21 @@ var ErrNoPerson |
| 6. `Open` activates before the runtime exists: it refuses a census that finds |
| any Home identity from another issuer (the app names its issuer-bearing |
| tables), writes the marker or refuses a different one, and only then |
| - builds the roster cache. A refused `Open` writes no marker. |
| + builds the roster cache. A refused census or binding writes no marker; a |
| + cache that cannot open (unreadable or malformed evidence) leaves the |
| + verified marker in place and refuses boot until it can. That is Docs' |
| + order too, and harmless: the marker names the binding just verified, and |
| + the next boot with the same configuration re-activates as a no-op. |
| 7. The marker's triggers refuse UPDATE and DELETE. With namespace `docs`, the |
| schema is Docs' applied migration byte for byte; with `sheets`, it is the |
| marker half of Sheets' (testdata), so neither app's ledger checksum moves. |
| |
| **Standing.** |
| -8. `Runtime.Check` is the only path to the cache, so every definite answer |
| - (a request's, an allocation's, the probe's) records that a roster has |
| - been held; the probe's "stale" depends on it. |
| +8. `Runtime.Check` is the only path to the cache that yields a decision, so |
| + every definite answer (a request's, an allocation's, the probe's) records |
| + that a roster has been held; the probe's "stale" depends on it. |
| + (`Runtime.Refresh` also reaches the cache, but yields no decision and so |
| + does not touch the held flag.) |
| 9. An app's stored roles are never consulted for standing. `Access.Role` is |
| the roster's role, and only while `State` is Member. |
| 10. `Access.State` re-checks the Member lease every time it is asked, with |
| @@ -166,21 +175,32 @@ var ErrNoPerson |
| fence distrusts. Apps still do not re-ask on an invalid lease: under the |
| writer that would wait on the publisher. |
| |
| -## 4. Unknown on list pages: ruling |
| - |
| -**Partial, not 503.** Under Unknown a list page shows what the person reaches |
| -without standing (their shares), with a "partial" notice; it does not answer |
| -503 for the whole page. This is Docs' behaviour; Fable leaned to it on #52 |
| -(deviation 3): the list is where every sign-in lands, and a 503 there during a |
| -Home blip over 60 s reads as "the app is down", where a partial list reads as |
| -"Home is slow". Item pages that need standing still answer a retryable 503 |
| -(never a 404), and create/import stay member-only (403 guest, 503 Unknown). |
| - |
| -The primitive is `Access.Partial()`. Ask it after building the list, from the |
| -same `Access`: `State` latches, so a lease that lapsed while listing marks the |
| -page partial. NotMember is not partial: a guest's shares are their complete |
| -list. Sheets moves from 503 to partial when it re-points. This is recorded as |
| -a proposal in this branch for the review to confirm; Paul has not ruled. |
| +## 4. Unknown on list pages — RULED 2026-10-28 by Paul |
| + |
| +**Partial list with a notice (Docs' behaviour), not a 503.** Under Unknown a |
| +person's own list page shows what they reach without standing (their shares), |
| +with a "partial" notice; it does not answer 503 for the whole page. Fable |
| +recommended it on #52 (deviation 3) and #98: the list is where every sign-in |
| +lands, and a 503 there during a Home blip over 60 s reads as "the app is |
| +down" and gives the person nothing, where a shares-only list reads as "Home |
| +is slow" and gives them what is theirs by grant. Nothing is over-shown: |
| +Unknown never adds an item, it withholds the team rung. Rejected: Sheets' |
| +503 for the whole list. |
| + |
| +Conditions (Fable, #98), each part of the ruling: |
| + |
| +1. Ask `Access.Partial()` **after** building the list, from the **same** |
| + `Access`: `State` latches, so a lease that lapsed while listing marks the |
| + page partial. |
| +2. **NotMember is never partial.** A guest's shares are their complete list. |
| +3. **A feed consumed by another origin** (the dashboard pull) stays |
| + **unavailable** under Unknown, not short: a reader who cannot see the |
| + notice would take a short list for the truth. As required of Sheets' |
| + dashboard on #52. |
| +4. **Item pages that need standing stay a retryable 503**, never a 404. |
| + Create and import stay member-only (403 guest, 503 Unknown). |
| + |
| +Sheets switches from its 503 to the partial list when it re-points. |
| |
| ## 5. What stays per app |
| |
| @@ -201,11 +221,26 @@ a proposal in this branch for the review to confirm; Paul has not ruled. |
| ## 6. Migration plan |
| |
| Each is its own branch in its own repo, after this lands on Home main, each |
| -with its own review and canary. Each bumps `home/teammode`, `home/roster` and |
| -`home/connect` to the main squash commit. (This branch's `teammode/go.mod` |
| -pins roster and connect at the branch commit `6b23c73`, the precedent being |
| -the root module's roster pin on `feat-roster-lease`; consumers pinning main |
| -take the later pseudo-version by MVS. A follow-up bump in Home is optional.) |
| +with its own review and canary. |
| + |
| +**Module pins — ruled by Fable on #98.** Branch-only pseudo-versions are |
| +acceptable on a branch (a multi-module repo has no other way to test one) |
| +and not on main: a pseudo-version is fetched by commit, so once the branch |
| +that reaches it is deleted every cold module cache fails `go mod download`, |
| +and MVS does not save a consumer whose `go.sum` needs that `go.mod` hash. |
| +Therefore: |
| + |
| +1. `teammode` lands on main with a **merge commit, not a squash**, so |
| + `17db191`, `15833f7` and `6b23c73` stay reachable from main. |
| +2. **Mandatory, immediately after:** one commit on main re-pins |
| + `teammode/go.mod` (roster, connect) and the root `go.mod` (roster, until |
| + now pinned on `feat-roster-lease`) to the main merge commit, `go mod |
| + tidy` in each, CI green — before any branch is deleted and before Docs or |
| + Sheets re-point. |
| +3. Only then may `teammode` and `feat-roster-lease` be deleted. |
| +4. Docs, Sheets and every later port pin all three modules (`teammode`, |
| + `roster`, `connect`) at a main commit at or after that re-pin, never at |
| + `6b23c73`. |
| |
| ### Sheets (first: it is on connect already) |
| |
| @@ -238,7 +273,7 @@ branch runs this shape end to end through a real exchange. |
| | `validatedTeamConfig` | `teammode.Verify(cfg.Team, &teammode.Home{home.issuer, home.consumerID}, "docs", origin)`; `ConfigFromEnv("DOCS")` in `cmd/docs` | |
| | `TeamConfig.transport/clock` | `RuntimeConfig.Transport/Clock` | |
| | `app.go`'s `teamstate.Required` check before `migrate.Apply` | `MustState("docs").BootSchema(...)` | |
| -| `TeamBootSchema = Merge(BootSchema, principalstore.Schema, teamstate.Schema)` | `teamstate.Schema` becomes `MustState("docs").Schema()`: same set name, same migration ID, byte-identical SQL, so the applied ledger row matches (tested). | |
| +| `TeamBootSchema = Merge(BootSchema, principalstore.Schema, teamstate.Schema)` | `teamstate.Schema` becomes `MustState("docs").Schema()`: same set name, same migration ID, byte-identical SQL, so the applied ledger row matches (tested). `Merge` qualifies IDs identically (`<set>/<id>`) whether a set was built by `FromFS` or `Add`, which is the fact the ledger identity rests on. | |
| | `newTeamRuntime`'s census, `Activate`, `roster.New` | `teammode.Open(…, IssuerTables: {"docs_identity_links", "docs_home_identities"})` | |
| | `principalstore`'s `RequireMembership` | `AdmitUnlinked`, mapping `ErrNotMember` to `principalstore.ErrRefused`, else `ErrUnavailable` | |
| | `requestAccess.state()`, `resolveAccess` | embedded `*teammode.Access`, `rt.Access(ctx, id.HomeSubject)` | |