Reviewer: Claude Fable 5.1 (claude-fable-5-1) β whole-code review @ e8e509d
APPROVED. No blockers. Seven notes; N1βN3 are worth one small follow-up commit on the branch before merge, none needs a re-review. Rulings on all thirteen deviations and the three questions below, and a recommendation on reminders for Paul.
Reviewed in a scratch worktree at origin/team-mode (e8e509d, one commit on main 00d8e3d). make ci green locally with the pinned toolchain (vet incl. browser tag, gofmt, every package incl. the credits inventory, migration check); go mod tidy -diff empty. I read every team_*.go, teamstate/ and its migration, the diffs of app/auth/config/home/person/routes/signin/render/handlers (views, events, misc, settings, booking public/manage/settings, jobs), dashboard, native, every touched store file and template, the spec Β§7, AGENTS.md's Team mode section and row T1, Home's teammode-package.md (Β§3 invariants, Β§4 ruling, Β§7) and team-members.md Part B's Calendar row, and the pinned teammode access.go/runtime.go and handoff Finish. I ran 16 hand mutations and one throwaway probe (below).
Blockers
None.
Guarantees, checked against the code
- Standing on every request.
requirePersonhands team mode toteamRequirePerson(person.go β team_access.go): session β person (Home: connectResolveincl. theHomeOnlyhook; local: allowlist then link) βrt.Access(subject)once, carried on the context. Views arestanding(needListing), everything else in the session group isstanding(needMember)viamemberRoutes; a route reachingstandingwithout a person is refused closed./signinasks the same (teamSignin) before connect's shortcut.GET /api/teamand the public routes are outside it by design and stand on somebody else's standing (below). - Role from the roster only. Calendar consults no role for standing;
grants.roleis the calendar's editor/owner bit forWritable, not team standing, and every grant is itself the rung. - Revocation within the lease. NotMember is offboarded on the first request and on
/signin(M5, M15 killed); a removed minter's feed is 404 and a removed host's page/hold/confirm/reschedule are 404 within the lease; a removed recipient's reminder and host mail are settled unsent (M9, M12, M14 killed). - Marker before migrations.
New:teamSettings(no DB) βteamBootSchemaon the writer β only thenmigrate.Apply. Nil settings with an activated DB refuse. - Census.
teamIssuerTables = {home_identity_links, calendar_team_home_people}(M11 killed). - Home-only via connect hooks, no address at rest.
teamUnlinked=AdmitUnlinkedthenEnsureHomePerson;teamHomeOnlyreads only. The row'saddressishome-only:+ 16 random bytes hex; triggers: addressless on insert, never updated, never deleted (keys off too), disjoint from links both ways. My probe (below) found the placeholder on none of 24 pages/JSON/ICS/feed bodies or headers; the chrome shows "Oficina account β¦xxxx".Addresslessis also!Contains("@"), so no non-address can ever be mailed. - Guard in every write transaction.
TestTeamEveryWriteRouteRefusesALapseBeforeCommitdrives 22 routes through a lapsing seam and reads back 12 tables row by row, then the success half as a member. Store-level: no Access refused, a lapse inside the write's own body rolls back (the seam-independent test I asked for on Memoria #32 is here from the start), attendees and default reminder guarded,systemWriteand team-off unguarded. The public booking writes carry the host's Access and go through the sameguard. - The partial list. Seven view routes are
needListing;requestUnknownis asked as the page is drawn, after building, of the same latched Access; the notice is rendered and the day sentence and every empty state are withheld ({{if not .Partial}}). NotMember never reaches a view. Item pages, forms, writes and the native API are retryable no-store 503s, and a 404/500 caused by a lapse is mapped centrally (errorPage,fail,nativeNotFound; M7, M8 killed). JSON lists 503 when Partial after building. DashboardErrUnavailableunder Unknown (M10 killed). Export whole or 503. - The probe.
GET /api/team=teammode.Probe, outside the session group. - Team-mode-off byte identity. Every branch keys on
a.team/a.teamOn/store.team/h.team, all nil/false unlessVerifyreturned settings;grantJoin(on, true)is the previous SQL string exactly;guardedoff team mode is the old statement on the outer handle. Consistent with the author's 64-response dump, which I did not redo. - Pins.
teammode,roster,connectat Home main 67c12e3;handoff,dashboardunchanged; nothing at 6b23c73; credits exclusions and inventory test updated together; tidy clean. - Read standing before reach.
rung := s.reaches(ctx)once beforerangeRowsandoverridesFor(both passes), infeedEventRowstoo; feeds, booking pages and the dashboard put the other person's Access on the context before any read;reminderDeliveryreads standing beforeEventand again after (M1, M2, M16 killed; the lease-edge sweep sees both outcomes).
The three questions
Scheduled work. Can a removed member ever be emailed team event details? Only inside the lease contract: a removal lands within 60 s, and a reminder or host mail decided as Member in that window goes. After that, no: reminderDelivery NotMember β settled unsent; hostMail NotMember β retired; the only other Send calls in the app are sign-in mail and the booker's own mail, which carries the booker's booking, not the team's calendar (there is no attendee invitation mail). The drain reads the recipient's standing, never the viewer's, and the page-view drain is pinned to that (M14 killed). Can Unknown starve or duplicate sends? No duplicate: a deferral is conditional on claim_id, releases the claim and sets retry_at five minutes out, so no second drainer can claim it before then and the sendβCompleteReminder path is the existing one. No starvation: a deferral touches neither fired_at nor attempts, so the cap never retires it; it is sent when Home answers, late and labelled, which is the app's existing contract for an instance that slept. Cost, not a flaw: during a Home outage each due reminder wakes the instance every five minutes rather than every thirty seconds.
Booking pages stand on the host. Right. A published page is a free/busy oracle over every calendar the host reaches, so the host's standing is the only honest basis. Removed β 404 (the page is gone, and a hold cannot be confirmed), Unknown β 503, the picker re-asks after it is built so busy time is never offered as free (M6 killed), every hold/confirm/reschedule write is guarded on the host's Access, and the booker's manage page, .ics and cancel stay theirs by token as systemWrite; the host's owed mail is retired, not left owed. One consequence to record: a booker whose host was removed can cancel but not reschedule (404), and is not told why. Fine.
ICS feeds stand on the maker; 503 for Unknown. 503 is the right call, and I would not build "last good" server-side. Rendering under Unknown decides reach without standing; storing a plaintext copy to replay is forbidden by the one rule; and the subscribing clients already keep their last fetched copy on a failed poll, so 503 is last-good at the right layer. The 503 carries no ETag and is no-store, so no client caches it. A lapse mid-build is a 503 not a short calendar (M13 killed). The feed-on-minter reading of Β§7.3 is right: the departed member's URLs die by themselves within the lease in every client they were pasted into, which is what the owner revoke was for. Not building a revoke of a current member's feeds is the correct restraint; that is a new power for Paul to grant or not.
Deviations β rulings
- NotMember signed out, not a guest β ACCEPT (as Memoria). No shares, so a guest reaches nothing, and an empty calendar reads as a free week, which is worse than a closed door. The unlinked-local exception is right.
- No shares, partial list always empty β ACCEPT. The notice is what keeps it from reading as a free day; the sentence and empty states are withheld. Stricter in effect than Docs', identical to Paul's ruling.
- Local sessions re-checked against the allowlist per request β ACCEPT the inconsistency with Slides. The allowlist is the local door's creature, and a local session is the door's; Calendar has always ended that identity (404) when the address leaves the list, and Memoria does the same. Slides chose otherwise for its own reasons. Standing is unaffected either way: a linked person stands on the roster whether or not they are on the list. Record it (it is) and move on.
- Feeds stand on their minter; owner revoke not built β ACCEPT (above).
- Booking stands on the host β ACCEPT (above).
- Deliveries decided on the recipient at send time; Unknown defers five minutes β ACCEPT. The 5 min over 30 s is the right trade for a hibernating instance; the lateness is stated in the mail.
- No orphan rule β ACCEPT. The team calendar has no owner role and a departed member's personal calendar is private. Paul's share/retitle rule has nothing to act on.
- Home-only address column holds a placeholder, not NULL β ACCEPT. It does not smell like an address at rest. The column holds a random token with no
@that nothing can turn into an address (BEFORE UPDATE OF addressrefuses for Home-only rows), nothing shows or mails (probe below;Addresslesson every send and publish), and no lookup can collide with it. It is the same device Memoria'shome-only:lookup uses. The alternative, a nullable column, is a destructive schema change on an additive-only ledger for no privacy gain. - Unknown arrival over a live Home session answers 400 β ACCEPT. That is
handoff.Store.Finishrefusing a second subject onCurrentSubjectbeforeCompleteruns; the handoff pin is unchanged and Calendar cannot answer 403 without a Home change. Nothing is allocated and the session survives, which is what matters. A note for Home, not Calendar. - Any 404/500 under latched Unknown is the retryable 503 β ACCEPT. Central and correct; a read emptied by a lapse must say "try again", not "gone".
- Multi-write requests keep what committed before the lapse β ACCEPT, with N1: a re-import after the 503 duplicates what landed, because import does not dedupe on
uid_hashtoday. - Native sign-in unchanged β ACCEPT (as Memoria): every
/api/native/*route is behindrequirePersonandstanding(needMember). - Roster role not consulted β ACCEPT. Calendar has no owner-only power.
Reminders for Home-only members β recommendation for Paul
(a) in-app reminders, and not (b) or (c) now.
- (a) keeps the one rule intact (no address anywhere), fits the drain as built (mark the occurrence due instead of mailing it, a flag on
reminder_queues, no new table of anybody's), and gives a path to native push later. Its honest limit is that a reminder is seen only when the app is open. The cheap bridge is the feed alarm: let a Home-only member make reminder rules on a non-email channel so?alarms=1carries them to their own calendar app β today adding a rule is refused outright, so the alarm bridge the spec mentions cannot be used. - (b) is permitted in principle by Home's ruling 5, but it is exactly the new address column my #98 note was about: it needs its own privacy review (sealed with a keyed fingerprint as a booker's, who can read it, how it is purged when the member leaves within the lease, what the drain does with an owed mail to a purged address) before a line is written. Defer until (a) proves insufficient.
- (c) is a dead end today (Alta writes no allowlist for team instances) and re-couples a team member's reminders to the local door, which this whole port exists to remove.
Hand mutations (mine, 16)
Killed (14): M1 grantJoin ignores rung β lease, partial-list and dashboard tests. M2 reminderDelivery without the after-check β lease-edge sweep. M5 NotMember not offboarded β removal + linked-account tests. M6 picker without the after-check β picker sweep. M7 Unknown passes the member gate β retryable-items test. M8 errorPage 404 not mapped β lapse sweep. M9 host mail ungated β booking-host test. M10 dashboard short under Unknown β dashboard test. M11 census table dropped β census test. M12 hostMail NotMember β now β booking-host test. M13 feed's final lapse check dropped β feed test. M14 page-view drain ungated β reminders test. M15 /signin without offboard β removal test. M16 eventsInRange ignores reach β lease + dashboard tests.
Survived, equivalent (2): M3 feedStanding Unknown served as Member and M4 hostStanding Unknown served as Member. Both still answer 503: the Unknown Access on the context makes the grant join match nothing, and feedNotFound/the picker after-check/the guard turn that into the retry. Defence in depth doing its job; keep the first-line checks, they give the clean 503 before any read.
Probe. A throwaway test signed a Home-only member in, made an event with an attendee and a feed, and fetched 24 responses (every view, settings, booking settings and new page, /account/home, import, new event, both share pages, event show/edit/delete, both calendar exports, native session and events JSON, the feed with alarms, a 404) checking bodies and headers for the placeholder: none carried it; the chrome showed the label; quick add worked; POST /account/home bounced. Deleted afterwards.
Notes
- N1 (code, small) β import does not dedupe on
uid_hash.store_event.go:180says "the lookup key a re-import dedupes on" butCreateEventnever checks it, so a re-import after deviation 11's 503 (or after any mid-import failure, today) duplicates what landed. Either skip a VEVENT whoseuid_hashalready exists on that calendar, or have the 503 page say "N events were imported; importing again will repeat them". Pre-existing, surfaced by the new 503. - N2 (code or spec) β a removed member's recurring reminders re-queue forever.
deliverNeverβCompleteReminderqueues the next occurrence, which is settled the same way on its day: no leak, but an instance wake per occurrence per removed member. Acceptable as is; if you want it quiet, on NotMember (not addressless/out-of-reach) settle without queueing the next and let re-adding reschedule the rule. Say which in the spec. - N3 (test) β
store_split_overrides.go:48splitWritableEventsreadsgrantsthroughModel(&Grant{}), whichTestTeamEveryGrantJoinIsTheRungsdoes not see (it greps forJOIN GRANTS). It is safe today because it runs insidesplitOninsides.guard, whose first authorize refuses Unknown before the read. Make the test refuseModel(&Grant{})outsideteam_reach.goandensureGrant, or route it throughgrantJoin, so a refactor cannot move it in front of the guard unnoticed. - N4 (spec) β unlinked local accounts in team mode get no reminders and a 404 booking page, because
standingOfβ subject "" β NotMember. Consistent with "no standing until linked", and Alta provisions fresh instances so nothing is affected today, but an activated instance with existing local people would go quiet; one sentence in Β§7. - N5 (Home) β deviation 9's 400 is handoff's. If Home wants 403 there,
Store.Finish's second-subject refusal is the place; nothing for this branch. - N6 (latency) β
standingOfcallsRuntime.AccessβCheck, which may wait on a refresh flight. None of its callers (feedStanding,hostStanding,reminderDelivery,hostMail,dashboardEvents) runs under the writer, so this is correct; the page-view drain's 5 s context bounds it. - N7 β the Alta recipe list in the description (
Roster: true,teamKeys, dropowner("CALENDAR_ALLOWED_ADDRESSES"), step-11 probe) is the right set and belongs to Alta's branch; this branch is correct without it.
The spec Β§7, AGENTS.md's Team mode section and row T1 match the code I read.