Reviewer: Claude Fable 5.1 (claude-fable-5-1) — whole-code review @ 1388016
Branch team-page, 5 commits on main 82d9388, hub CI green at the tip. Read: this discussion and its 13 deviations; implementation/team-members.md in full (Part A, which I approved in #92 round 3, plus the new §11); #92's rounds 2–4; #93's binding Team-page requirements; #94's round-4 rulings; AGENTS.md in full. Reviewed the whole diff (36 files): directorydata/members.go and the three team_migrations, team_page.go, resolve.go, member_receipt.go, resolve_keys.go, the wiring in app.go, directory.go, directory_runtime.go, runtime.go, chrome.go, calma.go, signin_return.go, operator_http.go, operator/directory.go, operator/http_verbs.go, legacy_schema_diagnostic.go, sealtest, the four templates, calma.css, the spec and fresh-assertion.md edits, and every new or changed test. Checked the mechanisms the slice leans on: csrf.Protect (origin evidence, no token), securityPolicy (form-action always carries the directory, so the receipt handoff is not blocked), sessions.From, handoff.SafePath, signin.Flow's "ip:" bucket and 20 default, the memberships_epoch_* triggers, operatorPublic, rosterRuntime.valid, findLeak (file, WAL, SHM). make test run locally: green except the -race step's darwin-only internal/provisioner setup failure, which CI covers. 20 mutations run by hand through make test-go, list at the end.
Verdict: APPROVED
The code is the approved design. On the one rule: the address is typed only on id.oficina.works, normalised with signin.SplitAddress and blind-indexed by findOrMintPersonOn exactly as sign-in does, and the only thing that leaves that origin is a signed receipt carrying a person ref; the directory never receives the address, holds the intent id hashed, the chosen name and the resolved ref sealed under intent-bound purposes, and the member name sealed under directory.member-name/v1/<team>/<ref> so a moved row does not open (TestMemberNamesSealedAndRefusingAt). Gate 1 runs over both databases at the end of the full add with the new address and name canaries. Origin separation holds: /resolve's form, refusal and handoff pages render fixed copy, the receipt and the directory's own origin, and the gate-5 test seeds a canary team name, label, sqid and member name and looks for all four. Freshness is checked where it counts — ownerWrite and ConfirmAdd run fresh() after the owner re-read inside the transaction, and the HTTP layer does not pre-check it, so (unlike the operator confirm pages noted on #94) dropping it is killed by five tests. 404 parity is byte-identical against an unknown route for the five read cases and the four writes refuse a member, a stranger, another team's owner and an unknown team the same way. The last-owner rule is enforced in both SetRole and Remove with the count read inside the transaction. Epoch moves come only from the roster triggers: once per role change, add and removal, never for a name, and never for a refusal. The receipt is a dedicated P-256 key under its own context, exact iss/aud, exp - iat ≤ 120, iat allowed 5 s of lead, exp strict, jti hashed into its own ledger inside the resolving transaction and refused across intents; the key is pinned on the directory, refused if it equals an assertion key or the roster key, and refused by both roles' operator distinct-key sets. The intent cookie binds the add to the browser on top of the three-way subject check, and the confirm POST cannot name a team. Rate limits are the design's. The migrations are their own set per #94, seed-team writes added_at only over HTTP, and the scriptless sweep reaches every Team path, /resolve and /auth/fresh/start with the served CSP. #93's binding requirements are all met: r.Get(fresh.StartPath(), fresh.Start), TestDirectoryOrdinaryAndFreshStartPaths checks max_age, and TestOrdinarySessionPostGoesToFreshStart proves an /auth/start session can read, is refused on POST, is sent to /auth/fresh/start, is refused by the issuer there, and writes after a real sign-in. Paul's three rulings are honoured: owner-chosen sealed names refusing @ (and the two Unicode ats), every member reads and only owners write with everyone else at 404, and no mail.
No blockers.
Deviations — rulings
- Own migration set, legacy diagnostic replays the whole serving schema. Accepted; it is the shape #94 ruled, and the diagnostic change is correct: an object is additive only when the serving replay has it and the frozen replay has it differently or not at all, exact matches are the only skips, and the
delete(objects, key)makes the alteredmembershipsstand in for the frozen one without hiding a foreign column (the three new Linux cases cover changed, altered and wrong-checksum). The native command's refusal is already the standing rule. seed-teamadded_atover HTTP only. Accepted; the native path's schema has no column, and the mutation flipping the HTTP flag is killed.- Resolve key inequality via the operator distinct-key set, not a
NewDirectoryparameter. Accepted.validResolveKeysis whatNewDirectory's own set amounts to (assertion keys plus the roster signer, the same pairrosterRuntime.validchecks), and the owner-seed, provisioning and Alta keys live in the serving process only whenHOME_OPERATOR_HTTPis on, which is exactly whenloadOperatorHTTPadds the resolve key to that set.loadResolveKeysruns first, so the set sees it. - Both keys optional. Accepted; fails closed on every add route and the page says so by drawing no Add person.
- Account menu: one Team link per directory team. Accepted; the springboard's team is a dashboard grouping, not a sqid. One indexed read (
memberships_person) per page is fine. - One live add per owner. Accepted.
- Intent cookie required at
/team/resolved. Accepted; a strengthening. - Stale confirm redirects, intent kept. Accepted; nothing was in the form, the POST still re-checks freshness inside the write, and both GET and POST are tested.
- Receipt wire format, 5 s lead, strict exp. Accepted;
iatlead widened to 60 s is killed. - Budget counts every owner POST. Accepted — but see note 3: the confirm POST's charge has no test.
- Four-character ref, sole owner drawn no demote/remove, Unicode ats, plain page. Accepted; "the team header" is reasonably the team home's, which AGENTS.md names.
- No README; §3.2 carries the sentence. Accepted.
- Call 2 as a source scan. Accepted as a tripwire — see note 1 for its regex.
Non-blocking (apply with the squash, no re-review)
team_page_test.go:437: the write regex is(INSERT\s+INTO|UPDATE|DELETE\s+FROM)\s+(memberships|membership_names)\b, whichINSERT OR IGNORE INTO membershipsandREPLACE INTO membershipspass. Widen to(INSERT(\s+OR\s+\w+)?\s+INTO|REPLACE\s+INTO|UPDATE(\s+OR\s+\w+)?|DELETE\s+FROM).resolve_keys.go:92: the directory's roster-signer inequality survives mutation (the fixtures run the roster disabled). Add a case toTestResolveKeysAreRoleBoundAndDistinctwithroster: {mode: "serve", signer: k}andHOME_RESOLVE_PUBLIC_KEY = k.pub.team_page.go:505: dropping the confirm POST's budget check survives. One assertion inTestTeamWriteBudget: spend the 30 on names, then a resolved confirm answers 429 and writes nothing.resolve.go:78: the server-sidein.Expires <= nowon the sealed resolve-intent cookie survives (the cookie's MaxAge and the directory's own 10-minute expiry bound it anyway). A test with a cookie sealed atnow-11mshould get the Expired page.team_page.go:198: refusing a query string on a write survives; harmless, note only.team_page.go:337: the intent cookie'sSecure/HttpOnlyflags are untested; a one-line assertion on theSet-Cookiefrom/team/add.handleTeamRemove: an owner who removes themself (two-owner case) is redirected to/team?team=and lands on the 404. Redirect to/whenperson == s.Subject./resolvecan be entered by anyone who holds a link (GET /resolve?consumer=directory&intent=…writes the cookie before any session check), so a signed-in non-owner lured there can mint person stubs at 20 an hour. The receipt is useless to them (requester must match the intent's owner and the browser's cookie), and minting on an unproven address is what §4 step 3 chose; recording it so the cost is weighed, not changed.TeamMembersanswers 503 for a team over 500 rows; only direct DB writes can get there. Fine, note only.team-members.md§2, §3 rule 5 and §5 still carry the pre-build text (springboard "selected team",directorydata/migrations/0002/0003); §11 records every difference in the same branch, which is the #94 shape. No further change.
Tests, as checked
Gate 21: TestTeamWritesAreOwnerOnlyAndFresh (four writes × member, stranger, other-team owner, unknown team, 301 s, future, fresh), TestOwnerWritesCheckOwnerAndFreshnessInside, TestOnlyTheTeamStoreAndSeedWriteMemberships, member view without controls. #93: TestOrdinarySessionPostGoesToFreshStart, TestDirectoryOrdinaryAndFreshStartPaths, TestFreshStartRefusesA301SecondAssertion. Gate 4: five byte-identical 404s. Cross-origin: 15 refusals in TestResolvedRefusals plus replay, other owner's confirm, confirm naming a team, stale confirm, expired intent; TestResolveNeedsACredentialSession. Store: last owner, 500, cross-intent jti, demoted owner, name bound to row. Gates 1/2: AssertNoPlaintext on both databases after the full add; static read of the three migrations with the sealed-BLOB assertion. Gate 5, 9, 10 and the scriptless sweep as described, each with a "would pass by not looking" guard.
Mutations I ran (each restored, tree clean): drop session-subject == receipt requester; drop the exact Origin check; exp inclusive; iat skew 60 s; keep the intent after confirm; confirm accepts any form body; ignore the intent's requester at resolve; never record the jti; no freshness inside ownerWrite; teamFresh accepts the future; no freshness redirect on confirm GET; intent cookie not cleared on confirm; control characters in names; owners ordered last; seed-team without added_at — all killed by a named test. Survived: the five in notes 1–6 (regex gap is not a mutation but the same class).
What this approves: the Team page, add-by-email through /resolve, the receipt, the keys and the Team migration set as code at 1388016 — subject to CI green on the merge tip and the verified canary on deployed previews before anything is promoted, with HOME_RESOLVE_KEY/HOME_RESOLVE_PUBLIC_KEY generated for production as the description says. Still gated elsewhere, unchanged: Part B's roster ports, rastrillo's absent auth_time, CARLOS 449, Alta, Paul's §12 pre-flight.