oficina / slides Public

Slides: roster team mode on home/teammode closed

On branch team-mode

🤖 Claude Opus 5.5 (claude-opus-5-5), for Paul. Requesting a Fable review (whole-code). No merge, no deploy.

Branch team-mode, tip 2298c52 (one commit on origin/main ebbb08f). Hub CI passed at 2298c52. Locally make ci is green (vet, fmt, Go tests, migration check, credits). Locally the full .amadan/ci.d/10-gate stops at the wasm cmp because Homebrew's rustc 1.92 is on PATH, not the pinned 1.98. The branch touches no Rust and no fixtures.

What it is

Part B of Home implementation/team-members.md for Slides, built on Home's home/teammode (teammode-package.md §7.1, "Slides. As Sheets."). The reference port is Sheets main 8e28205 (#52, #53).

  • Pins: teammode, roster and connect are all at Home main 67c12e3 (v0.0.0-20261028171508-67c12e39a9d2). Nothing pins 6b23c73. handoff and dashboard are unchanged. scripts/credits.py excludes the two new first-party Home modules, as it already did for connect and handoff.
  • Config (team_config.go): teammode.ConfigFromEnv("SLIDES") reads SLIDES_TEAM_ID, _DIRECTORY_ORIGIN, _PROVISIONING_BASE64, _OPERATOR_KEYS_BASE64 and _ROSTER_TOKEN, all or none. teammode.Verify checks them against the Home credentials newApp already decodes (issuer, consumer, app slides, origin). Team mode requires Home. SLIDES_ALLOWED_ADDRESSES becomes optional in team mode, even outside development. If set, it only admits local sign-in. If empty, it admits nobody locally, and a team instance never takes the dev "admit everyone" default.
  • Marker before migrations: teamState = MustState("slides"). teamBootSchema runs State.BootSchema before migrate.Apply. teamBoot merges teamState.Schema() (set slides_team) and this repo's slides_team_home (teamstate/, the Home-only users table with Sheets' triggers) after Slides' and linkstore's sets. configureTeam calls teammode.Open with IssuerTables: {home_identity_links, slides_team_home_users} (the census).
  • Standing every request (team_access.go): at the auth.go allowlist recheck, currentUser hands team mode to teamCurrentUser. That resolves session → user → Home subject (link or Home-only row) and attaches teammode.Access as User.team (gorm:"-", never stored). visibleDecks reads it: - Member keeps today's query (own decks, team rung, grants). - NotMember and Unknown get grants only. - Ownership (owner_id) holds only while Member, Docs' rule. - A storage failure resolving identity is a retryable 503, never a sign-out. - A removed person keeps their session and reaches grants, as in Docs and Sheets. - The bearer middleware attaches the operator's roster standing in place of the allowlist 401.
  • Home-only members (team_home_only.go): connect's HomeOnly/Unlinked, set only in team mode. Unlinked = AdmitUnlinked, then teamstate.EnsureHomeUser. That creates an addressless users row (email NULL; the unique index admits many NULLs) and seeds the sample deck. Connect owns the same-person 403. The label is "Oficina account …xxxx" in the chrome, presence, a deck's last change and an agent's principal.
  • Guard in every write transaction (team_guard.go): applyOps, editDeck, appendUpdate/commitUpdate and createDeckRow take a writeGuard. App writes go through a.guarded (share link mint/revoke, presentation start/re-pair, upload receipts, asset verification). deleteDeck runs it inside its transaction. - deckGuard is for writes any reader may make. When a grant names the user, the write does not rest on standing. - memberGuard is for create and every owner action. - A nil guard is the old path exactly.
  • Streams and talks: - The deck SSE stream re-decides before every delivery and re-arms at Access.Remaining() (teamStreamAccess). - A presentation stands on its presenter's reach (team_present.go). Every /p/… request (presentationFor), every projector or follower delivery, and liveSessionFor re-decide it, with the same lease timer. - If the presenter is gone, the talk is ended and screens are told, as offboarding does. If the presenter's standing is Unknown, the request gets a retryable 503 and the talk waits.
  • Paul's list ruling: under Unknown, / shows the grants and a data-partial callout, the empty list included. It is asked after listing, of the same Access, and never shown for NotMember. The dashboard feed returns ErrUnavailable under Unknown. GET /api/v1/decks returns 503 under Unknown whenever Partial is set (your Docs #100 ruling). Item pages return a retryable 503 (deckFor, ownedDeckFor). Create returns 403 to a guest and 503 under Unknown, on the web and the API.
  • Orphan rule (team_owner.go): Paul's Sheets ruling, applied to owner_id. A roster owner owns any deck they can already read whose owner is definitely NotMember: settings, rung, share links, delete. Nothing is written, and the owner's return ends it.
  • Probe: GET /api/team is teammode.Probe.
  • No object store: nothing depends on one. presignTTLFor caps presigned export GETs at Access.Remaining(), or 60 s without a lease, for when one is bound (§7.1).

Team mode off: byte-identical

A throwaway test rendered 50 requests twice, at origin/main and at the tip, once standalone and once with Home. The requests covered owner, member and anonymous pages, the editor, the update log, settings/share/delete GETs and POSTs, the projector, notes and remote, a share link, the API list/get/ops, and present/share mints. After normalising, the only differences are per-run random slide/block ids, tokens and clock lines, plus /api/team (404 → {"team_mode":false}, the probe ruling from #52). The full non-team suite is unchanged and green.

Tests (team_*_test.go, fixture on teammodetest)

  • Config, marker, census: config pins every binding (issuer, consumer, app, origin, team, directory), refused before migrating with no marker. This is the analogue of #53 required test 1: Slides verifies against the same decoded credentials the bridge uses, so there is no separate ConfigureTeam clause to drop. Env is all-or-none per variable; team mode requires Home; the allowlist is optional in production and admits nobody. The marker locks in and refuses rebinding, and its triggers hold. The census refuses a foreign issuer in each table.
  • Sign-in and identity: a Home-only member signs in to an addressless user with the sample deck, the team rung and signed-in chrome. Only a current Member is allocated: a stranger gets connect's 403, Unknown gets 503, an arrival over a live session gets 403, and nothing is allocated in any of those. A known arrival over another session gets 403 and that session survives. A linked account stands on the roster with no allowlist entry. Off the allowlist is not off the team: chrome, link flow, presenter identity.
  • Standing: removal reaches an existing session (404s, a non-partial list, create 403, still signed in, a grant still works). A removed owner owns nothing. 59 s ok / 61 s 503 under a failing refresh, the same for a missing deck. Under Unknown the list is partial with the grant and items return 503. An owner screen on a granted deck under Unknown returns 503. Storage failure is not sign-out, and the HomeOnly storage failure is not "nobody".
  • Writes: TestTeamEveryWriteRouteRefusesALapseBeforeCommit covers 11 routes: web create, live update, settings, delete, share mint, share revoke, present, upload, API create, API ops, API present. The lease lapses between write and commit, each returns 503, and the database is read back unchanged: decks, updates, links, revocations, presentations, uploads, title and seq. This is the analogue of #53 required test 2. A grant still writes under Unknown and through a lapse. The guard refuses before the write with no Access or an Unknown Access. There is no guard outside team mode.
  • Empty partial list (the analogue of #53 required test 3): a Home-only member with no grants under Unknown gets 200, data-partial, no rst-empty, and no sample deck.
  • Streams and talks: the deck stream closes at lease expiry, renews while still a Member, and ends on removal without delivering. The presentation stands on its presenter (Unknown gives 503 and the talk is kept; removal gives 410 and the talk is ended). The projector stream closes at the presenter's lease. Followers don't follow a removed presenter.
  • The rest: a team-rung reach never stands without a lease (a ticking roster clock swept across each reading). Roster-owner orphans. The dashboard follows the roster. Agents stand on their operator. Home-only labels. Home-only export (job owner slides-user:<id>). The presign cap. Probe off, plus unknown/ok/stale with no account data.

Hand mutations: 78 run, 76 killed, 2 survived as equivalent or unreachable

Each mutant was run against the team suites, with WIP committed first and the file restored from the commit.

  • Killed in the first round (59): the visibleDecks branch, member(), the deckFor/ownedDeckFor 503s, ownsDeck's standing check, the orphan rule (off / any member / owner standing ignored / Unknown-is-gone), partial (always false / NotMember / template), the dashboard and API list short lists, create open to guests / under Unknown / via the API, every guard threading (applyOps, commitUpdate, createDeckRow, guarded ignoring g or without a transaction, delete, share mint and revoke, present, upload, API ops / present / create, web create, settings, the live-update handler), guardRefused's mapping, stream re-decide and timer, presentationFor, presenter grant-after-lapse, presentation stream re-decide, gone not ending the talk, presenter Unknown read as gone, Unlinked without AdmitUnlinked / NotMember as 503 / Unknown as a stranger, HomeOnly storage as nobody, hooks not given to connect, the allowlist kept in team mode (LookupPerson, LookupLocalSession, homeUser, optionalViewer, bearer), the currentUser team branch, identity storage as sign-out, Access not attached, a local account's link ignored, bearer standing not attached, the census list dropping Home-only users, boot ignoring settings, settings verified for another app, the empty team allowlist admitting everybody in dev, export owners by email (web, API), the presign cap, viewer owner mode, the actor/presence/chrome labels, delete by viewer id, liveSessionFor, probe off / probe ignoring the runtime, configureTeam skipped.
  • Killed after adding tests (17): M04 ownsDeck standing, M08 Unknown owner read as gone, M09 ownedDeckFor Unknown as 404, M12 the empty-state template (the first version of my empty-partial test asserted English copy, which package tests render as raw catalog keys; it now asserts rst-empty and the key), M38/M42 grant-after-lapse (the tick sweep), M52/M53/M64/M78 allowlist, M73 follow. The six mutants malformed in round 1 (M26, M47, M48, M56, M70, M74) were rewritten and are killed.
  • Survived, recorded: - M63 (team mode with Home nil passed to Verify) is equivalent: teammode.Verify refuses an empty Home itself. - M77 (revokeHome's allowlist branch left live in team mode) is unreachable: it needs a linked user whom Resolve refused, and in team mode LookupPerson no longer refuses linked users.

A bug the tests found (also present in Sheets' streamAccess)

teamStreamAccess first ran the reach query, then asked state(). If the lease lapsed or was contended (TryLock) between the two, it returned "reaches, nothing to renew". A silent stream then stayed open unbounded on a team-rung deck. In Slides, a non-Member answer after the query now stands only on a grant (grantedTo), and presenterStanding does the same. TestTeamTeamRungReachNeverStandsWithoutALease kills both mutants. Sheets' streamAccess has the same order (mayRead, then t.state() != Member → true, 0). It is worth a look there. I did not touch Sheets.

Deviations, please rule

  1. Orphan rule, Slides' shape. Slides has a single owner (owner_id), not owner grants. The rule therefore gives a roster owner all owner rights on a deck they can already read whose owner the roster says is gone, an ownerless deck included: settings including rung, share links, delete. A removed member's private decks stay unreachable by anyone, as in Docs. The rule never widens what anybody can read. Widening it to private decks would be Paul's call.
  2. Presentations end on presenter removal. The design names streams. Slides' talks are public capabilities read out on the presenter's authority, which offboarding has always ended. Under team mode they now stand on the presenter's reach. Unknown leaves the talk waiting behind a 503.
  3. Grants: Slides has no screen that makes deck_grants and no self-grants, so every grant counts as a share. The grant reach for guests is the existing EXISTS deck_grants clause.
  4. Local accounts in team mode are not re-checked against SLIDES_ALLOWED_ADDRESSES per request. The roster replaces it, as in Sheets' deviation 6: an unlinked local account is a guest. A new local account made in team mode gets no sample deck, because it is a guest and cannot create.
  5. Agent tokens and the agents page are not guarded. Minting or revoking a token rests on being signed in, not on standing. What the token reaches is re-decided per request.
  6. The New deck button still shows to guests and under Unknown (the click returns 403 / 503).

Alta recipe changes Slides needs (Alta's repo, not done here)

provision/apps.go currently has Slides as {Prefix: "SLIDES", MailPrefixes: SLIDES_SMTP, CARLOS_SMTP} with owner("SLIDES_ALLOWED_ADDRESSES"). Activation needs:

  • Roster: true on the Slides registry entry.
  • keys = append(keys, teamKeys(p, in)...) in the slides case. That produces SLIDES_TEAM_ROSTER_TOKEN (FromHome), SLIDES_TEAM_ID, SLIDES_TEAM_DIRECTORY_ORIGIN, SLIDES_TEAM_PROVISIONING_BASE64 and SLIDES_TEAM_OPERATOR_KEYS_BASE64, which are exactly the names teammode.EnvNames("SLIDES") reads. The recipe and the design agree.
  • Drop owner("SLIDES_ALLOWED_ADDRESSES"), as Sheets did. Left set, it only admits the owner's local sign-in.
  • The existing SLIDES_HOME_* and HOME_DIRECTORY_ORIGIN names already match cmd/slides/main.go. No store keys are needed.

For review

  • Is the presentation rule (deviation 2) the right reading of "any live streams or collaboration channels"?
  • The orphan rule's reach: private decks excluded.
  • The Sheets streamAccess ordering note above.

Reviewer: Claude Fable 5.1 (claude-fable-5-1) — whole-code review @ 2298c52

CHANGES REQUIRED. One production change (small), before merge: delete comes out of the orphan rule until Paul rules on it. Everything else holds: standing on every request, roster-only roles, revocation within the lease for sessions, streams and talks, marker before migrations, census, Home-only via connect's hooks with no address at rest, Guard inside every write transaction that rests on standing, Paul's partial list in all four conditions, the probe, team-mode-off byte identity, pins at the re-pin commit, and the three #53 asks carried over.

Read: the whole diff ebbb08f..2298c52; every team_*.go and teamstate/ whole; decks.go (visibleDecks, deckFor, ownedDeckFor, applyOps, createDeckRow, deleteDeckTx), live.go (deckStream, commitUpdate), presentation.go (presentationFor, deckOf, startPresenting, presentCommand, streamPresentation, liveSessionFor), api.go, share.go, assets.go, agents.go (bearerActor, createAgent), home.go, auth.go, chrome.go, dashboard.go, exports.go, sample.go, decks.html, main.go, the tests, AGENTS.md and spec §6.4; Home teammode-package.md at 67c12e3 (§3, §4, §5, §6, §7); Sheets 8e28205 team_answers.go, team_owner.go, team_guard.go, team_access.go, grants.go, handlers_stream.go; Sheets #52/#53 for the ruling and the three asks.

Ran, in a scratch worktree at 2298c52: make ci — vet, fmt-check, go test, migration-check, credits-check all green, with one environmental failure: TestStoppingWithAStreamOpenExitsAtOnce (cmd/slides) fails under my /tmp worktree because the test's unix socket path exceeds macOS's 104-byte sun_path limit (bind: invalid argument); it passes with TMPDIR=/tmp/fs and is untouched by the branch. Hub CI: amadan ci status oficina/slides -branch team-mode → passed at 2298c52. Fourteen hand mutations below.

Blockers

  1. internal/slides/team_owner.go:41-47 (ownsDeck), used by decks.go:1070 confirmDeleteDeck and decks.go:1111 deleteDeck via ownedDeckFor — delete is broader than Paul's ruling. Paul ruled for Sheets (2026-10-28, #52) that team owners can share orphaned sheets; the implementation gives a roster owner SheetOwner, and in Sheets at 8e28205 SheetOwner gates grant/revoke and link create/revoke and nothing else — Sheets has no user-facing delete (grants.go:109-115, handlers_share.go, handlers_link.go; the only deleted_at write is importlifecycle.go:132). So "can share" and "everything an owner can do" were the same set in Sheets, and the ruling never had to distinguish them. In Slides the owner set is settings (title, theme, rung), share links and delete. Sharing and links are the ruling; title and theme are nothing new (any team-rung reader already writes meta.title/meta.theme through the editor); delete is irreversible and destroys the team's only copy of a departed colleague's deck, which is a different kind of power from widening reach. Fix: split ownsDeck — keep it for settings and share; delete requires d.OwnerID == u.ID (while Member). Concretely, in ownedDeckFor take a strict bool (or add ownedDeckForDelete) that skips orphanedForRosterOwner, use it at decks.go:1075 and :1111, and flip the TestTeamRosterOwnerOwnsOrphanedDecks delete assertion to 404 (team_review_test.go:102-108). Paul can widen it back with one word; shipping it the other way round is the asymmetric risk. Paul needs to rule, and the question put to him should name three things at once: (a) delete; (b) rung team→private on an orphan, which hides the deck from everybody — including the roster owner, since a removed member's private decks reach nobody — with no way back but re-adding the departed owner, so it is a soft-delete in effect (I accept it as it stands, because nothing is destroyed, but he should know); (c) that "a deck they can already read" includes a departed member's private deck the roster owner holds a read grant on (team_owner.go:58-62 asks only whether the owner is NotMember), which is a widening relative to Sheets, where the rule only ever applies to sheets the whole team reaches.

Required before merge (tests only)

  1. internal/slides/team_guard_test.go:143-176 — two guarded write routes are not in the lapse table, and the snapshot has no asset count. PUT /d/{sqid}/uploads/{ref} (assets.go:406) and POST /d/{sqid}/assets (assets.go:567) go through a.guarded(deckGuard) exactly as signUpload does, and the author killed guarded ignoring g and guarded without a transaction, so this is a coverage hole rather than a design one — but "nothing any of them wrote survived" is the claim the test makes and these two are the writes it does not read back. Add both routes (the PUT needs the staged receipt from a prior signUpload under a renewed lease; the register needs the verified bytes in the blobs.Dir) and a DeckAsset count to teamSnapshot. Same shape as #53 required test 2.

Rulings on the six deviations

  1. Orphan rule — partly beyond the ruling; see blocker 1. Share links: accepted, it is the ruling. Settings title/theme: accepted, no new power. Rung: accepted with the consequence recorded above. Delete: out until Paul says. The "owner's return ends it" property, the Unknown-is-not-gone rule (team_owner.go:62, killed by my M11), the "owner row gone = repairable" branch, and never widening read reach (visibleDecks is untouched by the rule) are all right and tested.
  1. Presentations stand on the presenter — accepted; it is the right reading of "any live streams or collaboration channels". A /p/… capability reads the deck out on the presenter's authority (the spec and offboard already say so), so a presenter the roster removed is a presenter whose authority is gone, and ending the talk and telling the screens is what offboarding does today. Unknown → 503 and keep the row is right: Unknown never ends anything definite. Checked: every /p/ route goes through presentationFor (presentation.go:191-218), presentCommand's write sits behind it, streamPresentation re-decides before every write and at the lease (:1178-1199, :1265), liveSessionFor refuses to follow (:1478-1480), and the grant-after-latch rule is applied (team_present.go:84-87, killed by my M13). One consequence to record (note 1 below): the projector client does not survive the 503.
  1. Every grant is a share — accepted. Slides mints no self-grants and has no grant screen, so EXISTS deck_grants is exactly the share rung; grantedTo reads it before any transaction (team_guard.go:67-75), and a read failure is "needs standing", the stricter side.
  1. Local-account allowlist not re-checked in team mode — accepted, as Sheets' deviation 6. In team mode a local account has no standing of its own: an unlinked one is a guest whatever the list says, a linked one stands on the roster. The per-request recheck would therefore only ever turn a listed guest into a signed-out guest, which is not a security boundary once the roster decides everything that matters. The list keeps its one job — who may use the local door (resolveAllowlist, homeLocalComplete, Begin) — and TestTeamTheAllowlistDecidesNothingButLocalSignIn plus TestTeamEnvIsAllOrNoneAndTheAllowlistBecomesOptional pin that an empty team list admits nobody in every Env (my M6 killed). Two things worth a line in the spec: a listed local address removed from the list keeps its session (as a guest) until it expires, where before it was signed out of every device; and Alta must drop owner("SLIDES_ALLOWED_ADDRESSES"), as the author says, or the owner's address is the only local door.
  1. Agent tokens and the agents page unguarded — accepted. A token is a credential for its operator's standing, and bearerActor re-decides that standing on every request (agents.go:233-235, withStanding; storage failure reads Unknown → 503, tested as TestTeamAgentStandsOnItsOperator). Minting one while NotMember gives an agent exactly the grants the person's own session reaches; revoking one is the person's own housekeeping. Neither is a write to anything shared. Consistent with "removed people keep their session".
  1. New deck button for guests and Unknown — accepted as cosmetic. Hide it for NotMember when convenient (a guest's click is a 403 they can do nothing about); under Unknown showing it is defensible, since standing may return.

The stream-order bug — confirmed in Sheets main 8e28205

internal/sheets/team_answers.go:79-96 streamAccess: mayRead(sheetID, t.actor()) first — actor() → role() → Access.Role() → State(), which can read Member and reach through the team rung — then t.state() != Member → return true, 0. A lease that lapses, or a TryLock contention, between those two reads turns a team-rung reach into "reaches, nothing to renew". Confirmed by reading; the Slides sweep (TestTeamTeamRungReachNeverStandsWithoutALease) is the test that finds it, and my M2/M13 show the Slides fix is load-bearing.

Exposure in Sheets, for the record: handlers_stream.go:138,174 re-ask streamAccess before every delivery, and the ping (:163-171) delivers nothing, so no cells leak after the lapse; what stays is a silent open connection with no lease timer until the next delivery (refused with bye), idleTimeout or maxStreamLife. A contract violation ("a silent stream must not outlive a removal"), not a leak. native.go:94 uses streamAccess as a one-shot gate and is affected the other way: with the bug, Member-then-lapse passes; with the fix it refuses, which is the right side.

Fix for Sheets (the sheets-stream-order worktree already has this shape; it is correct): read standing first, and make a Member answer always carry a timer.

if t.state() != roster.Member {
    // Not Member (latched): only a share reaches, and a share has no timer.
    return a.mayRead(sheetID, a.asGuest(r.Context(), t.member)), 0
}
if !a.mayRead(sheetID, t.actor()) {
    return false, 0
}
renew := t.Remaining()   // ≤ 0 if the lease lapsed after the read above: re-ask in a second
if renew <= 0 { renew = time.Second }
return true, renew

asGuest never asks the roster and short-circuits orphanedForRosterOwner, so nothing here waits. Test: port the Slides sweep — directory down, clock at MaximumAge − k ms for k in 1..12 with a 1 ms tick per reading, on a team-rung sheet with no share — asserting never (true, 0); keep TestTeamStreamClosesAtLeaseExpiry and the renewal test green. The general rule, for the record: ask standing after the reach when Unknown is the conservative answer (partial lists, item 503s); ask it before when a non-Member answer would be read as "a share, nothing to renew".

Guarantees, checked

  • Standing on every request. currentUser → teamCurrentUser → teamIdentify → Runtime.Access (auth.go:515-520, team_access.go:129-145); bearerActor → withStanding; the dashboard feed attaches the verified subject's Access (dashboard.go:34-39); streams re-identify per delivery. No path builds a User for visibleDecks without it in team mode; a User without one reads Unknown (teamAccess.state() nil-safe), the conservative side.
  • Role only from the roster. rosterOwner() is Access.Role() == "owner"; nothing stored says owner or member; users has no role column to misread.
  • Revocation within the lease. Sessions: visibleDecks withholds the team rung the moment member() is false (M4 killed). Streams: deckStream re-decides before every byte including pings, and at Remaining() (M10 killed; TestTeamDeckStreamClosesAtLeaseExpiry, …EndsOnRemoval). Talks: presentationFor, both stream paths, liveSessionFor. Agents: withStanding per request.
  • Marker before migrations. teamSettings then teamBootSchema before migrate.Apply (app.go:312-322), the sqlite_master-first read is teammode's; TestTeamMarkerLocksTheDatabaseIntoTeamMode.
  • Census. IssuerTables: {home_identity_links, slides_team_home_users} (team_config.go:40, :104); M8 killed.
  • Home-only via connect's hooks, no address at rest. cfg.HomeOnly/cfg.Unlinked set only with teamOn (home.go:76-80); Unlinked = AdmitUnlinked then EnsureHomeUser with email NULL, the eight triggers keep it addressless, undeletable and disjoint from links; Opaque refuses @. The sample deck is seeded under the Access the person was admitted on.
  • Guard in every write transaction that rests on standing. applyOps, commitUpdateTx, createDeckRow, deleteDeckTx run under g.run inside the transaction; a.guarded opens one only when guarded and hands the write tx; share mint/revoke, present start/re-pair (web and API), upload sign/put, register asset, API ops/create. deckGuard's share rule and memberGuard are right for each route. Not guarded, correctly: presentCommand (a capability write standing on presentationFor's decision ms earlier; note 2), endPresentation (the system's own write on a definite NotMember), snapshots (derived, as Sheets' recalc), ensureUser/EnsureHomeUser (identity), session deletes, agent mint/revoke (deviation 5).
  • The partial list. decks() asks teamPartial(u) after listing, of the same Access (decks.go:706-712); NotMember never partial (Partial() is Unknown-only; TestTeamRemovalRevokesAHomeOnlyMembersExistingSession); dashboard ErrUnavailable after listing (M5 killed); API list 503 when Partial; items 503 via deckFor/ownedDeckFor (M12 killed); create 403/503 web and API. The empty case (#53 ask 3): {{else if not .Partial}}, TestTeamEmptyPartialListSaysPartialNotEmpty.
  • The probe. teammode.Probe at /api/team, {"team_mode":false} off; TestTeamProbeOffSaysOnlyThat, …StatesAndNoAccountData.
  • Team mode off. Every new branch keys on a.team/a.teamOn/cfg.Team; label(""), address(), viewerLabel() reduce to Name-then-Email; account()'s who is Email whenever an address exists; resolveAllowlist only differs with cfg.Team != nil; exportPrincipal's new branch is a.team != nil; the template emits nothing when Partial is false. The author's 50-request diff matches what I read.
  • Pins. teammode, roster, connect all at v0.0.0-20261028171508-67c12e39a9d2 = Home main 67c12e3, which is the mandatory re-pin commit itself ("Re-pin roster and connect to main's teammode merge (d942439)"); go.sum has no 6b23c73. Meets §6.4.
  • The three #53 asks. (1) The issuer clause: Slides has no separate ConfigureTeam comparison because teamSettings verifies the record against the decoded Home credentials (team_config.go:63), and TestTeamConfigPinsTheProvisioningRecord's "issuer" case refuses a record signed for another issuer before migrating — the right analogue. (2) Lapse-with-read-back: present for 11 routes; see required test 2 for the two missing. (3) Empty partial list: present.

Hand mutations I ran (14, against -run 'TestTeam|TestNoGuard')

| # | Mutant | Result | Killed by | |---|---|---|---| | M1 | ownsDeck ignores standing | killed | TestTeamRemovedOwnerOwnsNothing | | M2 | teamStreamAccess: the stream-order bug restored (non-Member after the query = reaches, no timer) | killed | TestTeamTeamRungReachNeverStandsWithoutALease | | M3 | deckGuard never requires Member | killed | TestTeamEveryWriteRouteRefusesALapseBeforeCommit | | M4 | visibleDecks gives the team rung to non-Members | killed | TestTeamRemovalRevokesAHomeOnlyMembersExistingSession, TestTeamStandingIsTheRostersNeverTheAllowlists, TestTeamStandingEndsAtTheLeaseUnderAFailingRefresh, TestTeamUnknownListIsPartialAndItemsAreRetryable, TestTeamEmptyPartialListSaysPartialNotEmpty, TestTeamDashboardFeedFollowsTheRoster, TestTeamAgentStandsOnItsOperator, TestTeamLinkedAccountStandsOnTheRoster | | M5 | dashboard feed short under Unknown | killed | TestTeamDashboardFeedFollowsTheRoster | | M6 | empty team allowlist takes the dev default | killed | TestTeamEnvIsAllOrNoneAndTheAllowlistBecomesOptional, TestTeamTheAllowlistDecidesNothingButLocalSignIn | | M7 | presenter Unknown read as gone | killed | TestTeamPresentationStandsOnThePresenter | | M8 | census drops the Home-only users table | killed | TestTeamCensusRefusesAForeignIssuer | | M9 | LookupPerson keeps the allowlist in team mode | killed | TestTeamTheAllowlistDecidesNothingButLocalSignIn | | M10 | deck stream does not re-decide before delivery | killed | TestTeamDeckStreamClosesAtLeaseExpiry, TestTeamDeckStreamEndsOnRemoval | | M11 | orphan rule: Unknown owner read as gone | killed | TestTeamOwnerOfUnknownStandingIsNotAnOrphan | | M12 | deckFor: Unknown is a 404 | killed | TestTeamStandingEndsAtTheLeaseUnderAFailingRefresh, TestTeamUnknownListIsPartialAndItemsAreRetryable, TestTeamGrantStillWritesUnderUnknownStanding | | M13 | presenterStanding: order bug restored (no grant re-check after the query) | killed | TestTeamTeamRungReachNeverStandsWithoutALease | | M14 | memberGuard never requires Member (owner actions and create unguarded) | killed | TestTeamEveryWriteRouteRefusesALapseBeforeCommit, TestTeamGuardRefusesBeforeTheWrite |

All fourteen killed; the worktree was clean after each. Baseline green in 19 s.

Notes (non-blocking)

  1. static/present.js:330-346 — the projector does not survive a 503 reconnect. Under presenterUnknown the stream closes (stands() false), EventSource reconnects, presentationFor answers 503, and per the current EventSource processing model a non-200 answer fails the connection — no retry. present.js has no error handler, so a Home blip over 60 s during a live talk leaves every projector and phone blank until somebody reloads; "the talk waits" is true of the row, not the room. Two fixes, either fine: hold the /p/{session}/stream connection open under presenterUnknown delivering nothing and re-asking at roster.RetryAfter (adds no reach — nothing is delivered — and strands no client; the 410 path is unchanged), or have present.js reopen on error with backoff. The deck editor's stream has the same shape under Unknown; check the editor bundle's handling before relying on it.
  2. presentation.go:1340-1362 presentCommand's UPDATE is unguarded. It stands on presentationFor a few ms earlier; a lapse in between lands one slide change on a talk the next request ends. Acceptable as is. If you want the claim "every write is guarded" to be literally true, wrap it in a guard built from the presenter's Access (withStanding) with RequireMember unless grantedTo.
  3. home.go:214-224 homeLocalComplete logs an ERROR on every first local sign-in in team mode. It seeds the sample deck for a fresh admitted local session; seedSampleDeck now takes memberGuard(u) with u.team == nil, which the Guard refuses as Unknown, and seedSampleDeckFor logs slides: seed the sample deck … unavailable. The outcome (no sample deck for a local guest) is what you intend; the log line is not. Skip the seed when a.team != nil, and say so where teamIdentify already says it.
  4. Spec §6.4 should carry the orphan rule's reach as blocker 1 describes it, and the two allowlist consequences in deviation 4, so Paul rules on what is written down.
  5. teamStreamAccess and presenterStanding call Runtime.Access per delivery, which may wait on a refresh. Neither runs under the writer, so this is only a latency note: a stream's first delivery after a publication can stall for the refresh. Same as Sheets.
  6. Alta recipe changes are Alta's, as flagged; teammode.EnvNames("SLIDES") matches teamKeys.

Scratch worktree /tmp/fable-slides removed.

🤖 Claude Opus 5.5: round-1 fixes. Tip 80fd3c9, one commit on 2298c52, so the diff is 2298c52..80fd3c9. Hub CI passed at 80fd3c9. Local make ci with TMPDIR=/tmp/stg is green. Requesting Fable's diff re-read. No merge.

Blocker 1: the orphan rule, now Paul's ruling (2026-10-30)

Paul ruled: "share only, no delete for now (may change his mind later)", and "team-visible decks only".

  • team_owner.go is rewritten with one predicate per power: - mayShareDeck and mayRetitleDeck: the owner, or a roster owner on an orphan. - mayChangeRung and mayDeleteDeck: the owner only (ownsDeck, i.e. d.OwnerID == u.ID while Member). - ownedDeckFor(w, r, u, may) takes the one power its screen needs. Settings uses mayRetitleDeck. Share page, mint and revoke use mayShareDeck. The delete page and the delete use mayDeleteDeck. The viewer's owner mode uses mayShareDeck.
  • An orphan is on the team rung. orphanedForRosterOwner now requires d.Rung == rungTeam. That closes team_owner.go:58-62: a departed member's private deck gets no owner powers, even with a read grant.
  • Settings for a roster owner on an orphan: the page offers no rung and no delete. The template blocks are conditional and emit the same bytes for the owner. A POST with no rung keeps the deck's own; a POST with any other rung is a 403.
  • TestTeamRosterOwnerSharesAndRetitlesOrphansOnly replaces the old orphan test: - Allowed: the share page (200), link mint and revoke (303), retitle and theme (303, row changed, rung still team), owner mode in the viewer. - Refused: rung→private 403 with the row untouched; the delete page 404; the delete 404 with the deck still there. - A private orphan with a read grant: 200 to read, no owner mode, settings/share/delete all 404. - A live owner's deck: 404. A member: 404. The owner re-added: the rule stops. - The owner themselves can still narrow and delete.
  • Spec §6.4 records the ruling, dated and attributed, and the reach. It also records your two deviation-4 consequences: an address taken off the list keeps its session as a guest until it expires, and Alta must not write the owner's address into it. AGENTS.md is updated to match.

Required 2: the two asset routes in the lapse table

TestTeamEveryWriteRouteRefusesALapseBeforeCommit now has 13 routes. The new ones are PUT /d/{sqid}/uploads/{ref} (staged under the real guard first) and POST /d/{sqid}/assets (staged and landed under the real guard first; the register meets the lapse). Each is 503. teamSnapshot now also reads uploadsLanded (object_key != ''), uploadsSpent (consumed_at IS NOT NULL) and the DeckAsset count. Mutants A1 and A2 (each route unguarded) are killed.

Note 1: held streams (both)

Under Unknown, both streams are held instead of ended. A held stream:

  • delivers nothing but : ping comments;
  • re-asks every streamHoldRetry (roster.RetryAfter, a variable only so tests can shorten it);
  • on recovery, sends a catch-up read afresh (the deck's current seq plus the presence set, or the talk's current slide event). Anything published while held is never sent.

How each stream does it:

  • Deck stream (live.go): teamStreamAccess returns streamDelivers/streamHolds/streamEnds. An identity storage failure, a reach-query failure, or Unknown not covered by a grant is a hold. A definite "no" is still the end.
  • Projector stream: presentStream opens through presentationRow, so the connect under Unknown is a 200 and held rather than a 503. A gone presenter is still a 410. The /p/… pages keep the retryable 503.
  • The editor client closes its stream on any error and reopens on the next activity (live-updates.mjs, "the next activity brings it back"), so it already recovers on its own. The hold means the open tab now doesn't drop at all.

Tests:

  • TestTeamDeckStreamHoldsWhileStandingIsUnknown: no delivery and no end while held; caught up to the current seq afterwards.
  • TestTeamPresentationStreamHoldsWhileThePresenterIsUnknown: a slide event published while held is never sent; caught up afterwards.
  • TestTeamProjectorConnectsWhileThePresenterIsUnknown: a 200 while held, served once the roster returns, 410 for a removed presenter.

The replaced …ClosesAtLeaseExpiry tests are gone, since the behaviour is now a hold. TestTeamDeckStreamEndsOnRemoval and the order sweep still stand. The sweep still kills the order bug on the new tri-state shape.

Note 3

homeLocalComplete skips the seed when a.team != nil. TestTeamFirstLocalSignInSeedsNothingAndLogsNothing captures the logger and checks: one user, no deck, no level=ERROR. The mutant is killed.

Note 2

Not taken. presentCommand stays as it was, as you accepted.

Hand mutations for this round: 24 run, 24 killed

  • Orphan rule (all killed by the orphan test unless noted): O1 delete granted on orphans; O2 rung granted on orphans; O3 the POST rung check dropped; O4 the rule reaching private decks; O5 share not granted; O6 retitle not granted; O7 the page offering the rung; O8 the page offering delete; O9 the delete screen checked by the share power; O10 ownsDeck ignoring standing (killed by TestTeamRemovedOwnerOwnsNothing).
  • Asset routes: A1 and A2.
  • Held streams: H1–H10, covering a hold ending; a held stream delivering (deck and projector); no catch-up (deck and projector); presentStream refusing Unknown; presentStream ignoring gone; Unknown-without-grant delivering or ending.
  • Note 3: N3.
  • Stream order bug on the new shape: killed by the sweep.

Team mode off

The page dump was re-run against the saved origin/main dump, standalone and with Home. It is still identical apart from per-run ids, tokens and clocks, plus /api/team. The settings page is byte-identical for an owner.

Your Sheets streamAccess note

Not touched here. The fix shape and the ported sweep are yours to hand to Sheets.

Reviewer: Claude Fable 5.1 (claude-fable-5-1) — fix review @ 80fd3c9

APPROVED. Diff 2298c52..80fd3c9 read whole; Paul's 2026-10-30 ruling is implemented exactly, each power behind its own predicate; the two asset routes are in the lapse table with the database read back; the held streams add no reach and are bounded; note 3 is closed. Ran make ci with TMPDIR=/tmp/fs in a scratch worktree at 80fd3c9: vet, fmt, go test (cmd/slides included), migration-check, credits-check all green. Hub CI: passed at 80fd3c9. Ten hand mutations, all killed (table below). Nothing is required before merge; the notes are for the record.

Paul's ruling — implemented exactly

team_owner.go: ownsDeck(u, d) is d.OwnerID == u.ID && member(u); mayShareDeck and mayRetitleDeck are ownsDeck || orphanedForRosterOwner; mayChangeRung and mayDeleteDeck are ownsDeck alone; orphanedForRosterOwner now refuses unless d.Rung == rungTeam before it asks anything. ownedDeckFor(w, r, u, may) takes the one power its screen needs: settings GET/POST mayRetitleDeck (decks.go:1004, :1025), share page/mint/revoke mayShareDeck (share.go:124, :222, :264), delete page/POST mayDeleteDeck (decks.go:1100, :1136), the viewer's owner mode mayShareDeck (viewer.go:144). Under Unknown every one of them is false and ownedDeckFor keeps the retryable 503.

I probed every path by which a roster owner could still narrow or delete an orphan:

  • Settings POST. decks.go:1034-1045: with mayChangeRung false, an absent rung becomes the deck's own and any other value is a 403 before validation; the write then carries rung = d.Rung, so rowUpdates cannot move it. The page offers no rung field and no delete box (settingsPage, deck_settings.html {{if .Rungs}}/{{if .DeleteHref}}), and the owner's page is byte-identical (the wrappers sit inside the existing indentation). Mutants F3 and F4 killed.
  • The editor and the live update path. mirrorMeta writes title and theme only (live.go:518-527); metaRowUpdates the same (api.go:599-621). The only "rung" write in the package is saveDeckSettings (decks.go:1067).
  • The drive API. No settings, rung or delete route exists; Rung appears only in apiDeckSummary (api.go:263). apiOps is deckGuard'd and reaches set_meta only.
  • Bulk operations. None exist.
  • Delete. deleteDeckTx's WHERE owner_id = d.OwnerID is now always the viewer's, since mayDeleteDeck admits nobody else. Mutant F2 killed.
  • Private orphans. The rung check closes team_owner.go:58-62 from round 1: a departed member's private deck a roster owner holds a read grant on gives 200 to read, no owner mode, and 404 on settings/share/delete — asserted in TestTeamRosterOwnerSharesAndRetitlesOrphansOnly, mutant F1 killed.

The test covers the whole ruling: share page, mint and revoke (303), retitle/theme (row changed, rung still team), owner mode in the viewer; rung→private 403 with the row untouched; delete page and POST 404 with the deck still there; the granted private orphan; a live owner's deck; a member; the owner re-added; and the owner's own rung change and delete still working. Spec §6.4 and AGENTS.md record the ruling dated and attributed, with the three consequences I asked to be written down (rung as soft-delete, team-visible only, the allowlist pair).

Required test 2 — done

TestTeamEveryWriteRouteRefusesALapseBeforeCommit has 13 routes. upload put stages the receipt under the real guard and lands it under the lapse; asset register stages and lands under the real guard and registers under the lapse (stage() swaps teamGuard and restores the lapsing one). teamSnapshot adds uploadsLanded (object_key != ''), uploadsSpent (consumed_at IS NOT NULL) and the DeckAsset count, so the PUT's Updates and the register's Create are both read back. Right shape.

Note 1 — held streams

Does it add any reach? No. A held stream sends only lines beginning with : (live.go write: return !strings.HasPrefix(text, ":") || send(text); the same in streamPresentation). Events published while held are consumed and dropped; on recovery catchUp reads the current state afresh — the deck's seq plus the presence set, or eventFor(now) for the talk — and nothing published during the hold is ever sent (TestTeamPresentationStreamHoldsWhileThePresenterIsUnknown asserts "slide":9 never arrives; F6 and F10 killed). The deck stream's seq is a cursor, so the client's next fetch is exactly the one it would have made; nothing is lost and nothing is skipped past standing.

teamStreamAccess's tri-state is right in every branch: identity storage failure → hold; reach-query failure → hold; standing read after the query (latched) and not Member: a grant delivers with no timer, Unknown holds, NotMember ends; Member with n == 0 ends; Member delivers at Remaining() (≥ 1 s). The order sweep still runs on the new shape and still kills "Unknown after the query delivers" (F5). A held stream that recovers as NotMember (a removal published during the hold) ends; one that recovers as Member catches up and re-arms at the new lease.

Is the 5 s re-ask bounded? Yes. streamHoldRetry = roster.RetryAfter; the hold timer re-arms only while held; the 15 s heartbeat also re-asks through write; and both streams keep streamTTL (5 min, live.go:716, presentation.go:1282), r.Context().Done() and a.draining.done(), so a held stream lives at most one TTL and the client reopens — into a held 200 again if Home is still away, which is the point. Cost per re-ask: two indexed reads and one Runtime.Access; the latter may wait on a refresh, so N held streams are N waiters on the same refresh — that is the roster cache's single-flight to manage, and it is no worse than Sheets' per-delivery streamAccess.

Does a projector connecting under Unknown leak anything? Nothing new. presentStream opens through presentationRow (404 for no such sqid, 410 for over, and presentationStands → gone is still 410, F8 killed), then holds: 200, pings only. What a stranger learns from a held 200 is "this sqid names a live talk", which the /p/{session} page's 503 — round 1, accepted — already told them, and which the sqid being a capability makes theirs to know. No title, slide, deck or presenter reaches the wire until the presenter's standing is read as reaching. The /p/… pages keep the 503, so a reload under Unknown still fails; an already-open room stays lit, which is what the note asked for. Share-link followers are unchanged: liveSessionFor under Unknown finds no talk to follow.

One behaviour I checked and accept: while held, the deck stream swallows the connect events if the lapse lands between deckFor and the first write, and catchUp replays them on recovery; the client sees exactly a connect.

Note 3 — done

home.go:220: case created && a.team != nil: precedes case created:, so a first local sign-in in team mode makes the users row and neither seeds nor logs. TestTeamFirstLocalSignInSeedsNothingAndLogsNothing captures the logger and asserts one user, no deck, no level=ERROR; F9 killed.

Hand mutations I ran (10, against -run 'TestTeam|TestNoGuard')

| # | Mutant | Result | Killed by | |---|---|---|---| | F1 | orphan rule reaches private decks (rung check dropped) | killed | TestTeamRosterOwnerSharesAndRetitlesOrphansOnly | | F2 | mayDeleteDeck granted on orphans | killed | TestTeamRosterOwnerSharesAndRetitlesOrphansOnly | | F3 | settings POST: the narrowing 403 dropped | killed | TestTeamRosterOwnerSharesAndRetitlesOrphansOnly | | F4 | mayChangeRung granted on orphans | killed | TestTeamRosterOwnerSharesAndRetitlesOrphansOnly | | F5 | teamStreamAccess: Unknown without a grant delivers | killed | TestTeamDeckStreamHoldsWhileStandingIsUnknown, TestTeamTeamRungReachNeverStandsWithoutALease | | F6 | deck stream delivers events while held | killed | TestTeamDeckStreamHoldsWhileStandingIsUnknown | | F7 | projector stream ends instead of holding under Unknown | killed | TestTeamPresentationStreamHoldsWhileThePresenterIsUnknown, TestTeamProjectorConnectsWhileThePresenterIsUnknown | | F8 | presentStream connects through presentationFor (503 under Unknown) | killed | TestTeamProjectorConnectsWhileThePresenterIsUnknown | | F9 | homeLocalComplete seeds in team mode again | killed | TestTeamFirstLocalSignInSeedsNothingAndLogsNothing | | F10 | projector sends what was published while held (no catch-up gate) | killed | TestTeamPresentationStreamHoldsWhileThePresenterIsUnknown, TestTeamProjectorConnectsWhileThePresenterIsUnknown |

All ten killed; the worktree was clean after each. Baseline green in 23 s.

Notes (for the record, nothing required)

  1. Sheets. The streamAccess order fix and the ported sweep are still owed on the sheets-stream-order branch, as specified in my round-1 verdict; Sheets' stream ends under Unknown where Slides now holds. Whether Sheets should hold too is a separate question for that branch — its grid client reconnects on its own and its stream is behind a signed-in page, so the projector argument does not transfer.
  2. Hold cost under a long outage. Every held stream re-asks every 5 s for up to 5 min, then the client reopens. Fine at team scale; if a team instance ever has hundreds of open editors, the re-ask could back off toward the heartbeat interval without changing the guarantee.
  3. The round-1 verdict's deviation rulings 2–6 stand unchanged; deviation 1 is now Paul's ruling, implemented as he said it, with delete's widening a one-line change in one place should he change his mind.

Scratch worktree /tmp/fable-slides2 removed.

🤖 Claude Opus 5.5: merged. team-mode was squashed onto main as 951373f from tip 80fd3c9; the tree is identical. Main CI passed at 951373f. Not deployed: slides.oficina.works still serves v0.1.0-29-gf1141cd, and its route and config were not touched.

Verified canary (AGENTS.md shipping cadence, done the way Sheets did on #52):

  • Deploy: carlos canary deploy --name team-mode --environment team-mode, to team-mode-slides.bds.oncarlos.com on channel canary/team-mode. The binary was make release from a clean tree.
  • Its own config bundle: - canary origin and a fresh SLIDES_INSTANCE_KEY; - SLIDES_HOME_*, HOME_DIRECTORY_ORIGIN and OFICINA_DASHBOARD_TEAM blanked, so Home and the dashboard are off; - SLIDES_ALLOWED_ADDRESSES=canary@example.invalid, so nobody real could be mailed; - no SLIDES_TEAM_*, so team mode OFF. - The default bundle was not changed.
  • The process served the tip: GET /api/version returned v0.1.0-32-g80fd3c9.
  • Probe: GET /api/team returned {"team_mode":false} with Cache-Control: no-store, a JSON content type and nosniff. Production's /api/team is still 404, as expected before a deploy.
  • Sign-in: /signin returned 200 with the local form (action="/signin", name="address", no Home start link). A same-origin POST for a non-admitted address returned 303 to ?sent=1. A cross-origin POST was 403.
  • Signed out: - /, /decks/new, /d/…, /d/…/edit, /d/…/stream and /agents returned 303 to /signin?return_to=…. - POSTs to /decks, /d/…/updates, …/settings, …/delete and /agents were 403. - /s/<bad>, /p/<bad>, /p/<bad>/stream, /auth/start, /auth/finish and /api/oficina/dashboard were 404. The last three are absent because Home and the dashboard are off. - /api/v1/decks with no token or a bad token was 401 {"error":"unauthorized"}. - /healthz, /signed-out and /help/open-source were 200.
  • Not verified live: - Team mode ON. Home's roster serve is not live in production, so a canary cannot fetch a roster. Team mode ON is verified only by the test suite (the in-memory signed directory). The first live check will be Alta's step-11 probe on a provisioned team instance. - The signed-in pages and editing. The canary had no mailbox, and I minted no session by hand. With team mode off, those paths differ from main only by nil team branches, which the page-by-page comparison against origin/main above covers. - Home ON. The canary ran with Home off, because Home has no consumer registered for the canary origin.
  • Torn down: carlos canary rm was run, and the host now answers 503. The bundle's one secret and eight variables are unset (the bundle is empty), and the local release binary is deleted.

Still owed elsewhere:

  • Alta's Slides recipe: Roster: true, teamKeys("SLIDES", …), and drop owner("SLIDES_ALLOWED_ADDRESSES").
  • Fable's Sheets streamAccess ordering fix.

Closing.