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
internal/slides/team_owner.go:41-47(ownsDeck), used bydecks.go:1070confirmDeleteDeckanddecks.go:1111deleteDeckviaownedDeckFor— 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 ownerSheetOwner, and in Sheets at 8e28205SheetOwnergates 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 onlydeleted_atwrite isimportlifecycle.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 writesmeta.title/meta.themethrough 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: splitownsDeck— keep it for settings and share; delete requiresd.OwnerID == u.ID(while Member). Concretely, inownedDeckFortake astrict bool(or addownedDeckForDelete) that skipsorphanedForRosterOwner, use it atdecks.go:1075and:1111, and flip theTestTeamRosterOwnerOwnsOrphanedDecksdelete 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-62asks 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)
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) andPOST /d/{sqid}/assets(assets.go:567) go througha.guarded(deckGuard)exactly assignUploaddoes, and the author killedguardedignoringgandguardedwithout 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 priorsignUploadunder a renewed lease; the register needs the verified bytes in theblobs.Dir) and aDeckAssetcount toteamSnapshot. Same shape as #53 required test 2.
Rulings on the six deviations
- 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 (visibleDecksis untouched by the rule) are all right and tested.
- 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 andoffboardalready 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 throughpresentationFor(presentation.go:191-218),presentCommand's write sits behind it,streamPresentationre-decides before every write and at the lease (:1178-1199,:1265),liveSessionForrefuses 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.
- Every grant is a share — accepted. Slides mints no self-grants and has no grant screen, so
EXISTS deck_grantsis exactly the share rung;grantedToreads it before any transaction (team_guard.go:67-75), and a read failure is "needs standing", the stricter side.
- 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) — andTestTeamTheAllowlistDecidesNothingButLocalSignInplusTestTeamEnvIsAllOrNoneAndTheAllowlistBecomesOptionalpin 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 dropowner("SLIDES_ALLOWED_ADDRESSES"), as the author says, or the owner's address is the only local door.
- Agent tokens and the agents page unguarded — accepted. A token is a credential for its operator's standing, and
bearerActorre-decides that standing on every request (agents.go:233-235,withStanding; storage failure reads Unknown → 503, tested asTestTeamAgentStandsOnItsOperator). 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".
- 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, renewasGuest 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 aUserforvisibleDeckswithout it in team mode; aUserwithout one reads Unknown (teamAccess.state()nil-safe), the conservative side. - Role only from the roster.
rosterOwner()isAccess.Role() == "owner"; nothing stored says owner or member;usershas no role column to misread. - Revocation within the lease. Sessions:
visibleDeckswithholds the team rung the momentmember()is false (M4 killed). Streams:deckStreamre-decides before every byte including pings, and atRemaining()(M10 killed;TestTeamDeckStreamClosesAtLeaseExpiry,…EndsOnRemoval). Talks:presentationFor, both stream paths,liveSessionFor. Agents:withStandingper request. - Marker before migrations.
teamSettingsthenteamBootSchemabeforemigrate.Apply(app.go:312-322), thesqlite_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.Unlinkedset only withteamOn(home.go:76-80);Unlinked=AdmitUnlinkedthenEnsureHomeUserwithemail NULL, the eight triggers keep it addressless, undeletable and disjoint from links;Opaquerefuses@. 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,deleteDeckTxrun underg.runinside the transaction;a.guardedopens one only when guarded and hands the writetx; share mint/revoke, present start/re-pair (web and API), upload sign/put, register asset, API ops/create.deckGuard's share rule andmemberGuardare right for each route. Not guarded, correctly:presentCommand(a capability write standing onpresentationFor'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()asksteamPartial(u)after listing, of the same Access (decks.go:706-712); NotMember never partial (Partial()is Unknown-only;TestTeamRemovalRevokesAHomeOnlyMembersExistingSession); dashboardErrUnavailableafter listing (M5 killed); API list 503 when Partial; items 503 viadeckFor/ownedDeckFor(M12 killed); create 403/503 web and API. The empty case (#53 ask 3):{{else if not .Partial}},TestTeamEmptyPartialListSaysPartialNotEmpty. - The probe.
teammode.Probeat/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()'swhois Email whenever an address exists;resolveAllowlistonly differs withcfg.Team != nil;exportPrincipal's new branch isa.team != nil; the template emits nothing whenPartialis false. The author's 50-request diff matches what I read. - Pins.
teammode,roster,connectall atv0.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.sumhas no6b23c73. Meets §6.4. - The three #53 asks. (1) The issuer clause: Slides has no separate
ConfigureTeamcomparison becauseteamSettingsverifies the record against the decoded Home credentials (team_config.go:63), andTestTeamConfigPinsTheProvisioningRecord'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)
static/present.js:330-346— the projector does not survive a 503 reconnect. Under presenterUnknown the stream closes (stands()false), EventSource reconnects,presentationForanswers 503, and per the current EventSource processing model a non-200 answer fails the connection — no retry.present.jshas noerrorhandler, 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}/streamconnection open under presenterUnknown delivering nothing and re-asking atroster.RetryAfter(adds no reach — nothing is delivered — and strands no client; the 410 path is unchanged), or havepresent.jsreopen onerrorwith backoff. The deck editor's stream has the same shape under Unknown; check the editor bundle's handling before relying on it.presentation.go:1340-1362presentCommand's UPDATE is unguarded. It stands onpresentationFora 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) withRequireMemberunlessgrantedTo.home.go:214-224homeLocalCompletelogs an ERROR on every first local sign-in in team mode. It seeds the sample deck for a fresh admitted local session;seedSampleDecknow takesmemberGuard(u)withu.team == nil, which the Guard refuses as Unknown, andseedSampleDeckForlogsslides: 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 whena.team != nil, and say so whereteamIdentifyalready says it.- 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.
teamStreamAccessandpresenterStandingcallRuntime.Accessper 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.- Alta recipe changes are Alta's, as flagged;
teammode.EnvNames("SLIDES")matchesteamKeys.
Scratch worktree /tmp/fable-slides removed.