carlos / platform Public

review brief: signin-first-run-mobile round 2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 440f6d18994817bf2c7f86bccdfcc1a85b3517eb parent 9cd16b2
1 file changed, +92 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-signin-first-run-mobile-R2.md +92 −0

CI cancelled — superseded by a newer push — run details

Intent

Attributed to this commit: 9.70 g CO₂e (1,172,950 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on signin-first-run-mobile, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-signin-first-run-mobile-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-signin-first-run-mobile-R2.md
new file mode 100644
index 000000000..c6880d3f3
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-signin-first-run-mobile-R2.md
@@ -0,0 +1,92 @@
+# Review brief: branch signin-first-run-mobile, round 2 of 3
+
+Repo carlos/platform, branch `signin-first-run-mobile`, commit 9cd16b23e6c217901eb3d0d8ec99a7d9f1bbd2e2.
+Under review: the diff `origin/main...HEAD`.
+Authorities: `docs/superpowers/specs/2026-10-21-console-email-signin-design.md`
+(email sign-in), AGENTS.md (stopping rules, census).
+
+You are an independent reviewer. Read the diff, then the code it reaches,
+and check every claim in the commit message against that code.
+
+## Background
+
+Flagship 2026-11-07: a brand-new person's POST /auth/email/link spent the
+link, opened a session, then minted their personal account inside the same
+request (NextAccountID read ~100 manifests serially, ~3 s). The browser
+dropped the request (a re-tap), the mint's S3 read failed with context
+canceled, the 500 went nowhere, and the retry saw a spent link. Twice.
+
+## What to check
+
+1. `finishSignin` (internal/console/emailsignin.go) now redirects to `/` or
+ `/?next=<safe>` instead of resolving the account. Every caller: email link,
+ email code, Keymail callback (server.go ~4021), demo claim
+ (demo_claim_auth.go, demo_claim_page.go). Does any door depend on the
+ account existing before its next page loads, or on the old Location?
+ Is `next` still only ever a `safeNext` local path at both hops (no open
+ redirect via `/?next=`)? Is the 303 -> 302 chain right for a POST?
+2. `handleHome` (server.go) with a session now honours `next`. Any page that
+ sends a signed-in person to `/?next=...` today and expects the account
+ landing instead? Any loop (a next that itself redirects to `/?next=`)?
+3. `currentAccount`: per-person striped lock, membership re-check under the
+ lock, mint under `context.WithoutCancel` with a 30 s timeout. Deadlocks
+ (callers that already hold a landing or flow lock?), holding a lock across
+ S3 calls, the address key (normalised the same way everywhere?), and
+ whether a detached mint can now outlive a request in a way that matters
+ (shutdown, tests).
+4. `NextAccountID` (internal/domains/mint.go): 16 concurrent Gets. Same
+ answer as before for every bucket state, including disagreeing manifests,
+ unparseable ones, and an unreadable one (must still fail). Goroutine
+ leaks on early error? Any caller running it with a store that is not safe
+ for concurrent use?
+5. Templates: `data-busy` on the sign-in, code, "send a new link" and link
+ confirm buttons (layout.html's script delays submit 650 ms and blocks a
+ second submit). Does any of these forms need the submitter's name/value,
+ or break with JS off? CSS: `@media (pointer: coarse)` 16px fields and the
+ `max-width: 40rem` full-width sign-in form; anything else using
+ `form.signin` that this breaks?
+6. Census: `docs/superpowers/notes/census-proposal-signin-first-run-mobile.md`
+ re-pins the `internal/domains` envelope. Read every changed function in
+ that package and what it reaches, and give the census verdict the card
+ asks for (approve or reject, with reasons).
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the problem, the evidence
+(file:line, verified), the failure scenario, a concrete fix and the
+invariant or trust boundary it breaks. Then the census verdict for the
+`internal/domains` envelope. End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites; targeted `go test -run` on the
+touched packages is fine (leave GOCACHE at its default).
+
+## Round 2
+
+Earlier rounds: `docs/superpowers/reviews/CODEX-FINDINGS-signin-first-run-mobile.md`
+(round 1: one P1, the callback invariant probe; census APPROVED).
+
+First give one line for that P1: resolved, partly, or not. The fix is
+commit 9cd16b23 (claim_invariant_probes_nonapp_test.go,
+claim_invariant_probes_test.go): the callback and email-code probes want
+303 -> "/", prove the session and follow the landing GET into an account;
+both are in claimSessionEnd. `TestClaimConsoleMutationInvariant` passed
+locally on this tip. Then check whether any other test or probe still
+expects the old sign-in Location, and carry anything unresolved forward.
+The census item needs no new verdict unless internal/domains changed.