carlos / platform Public

plans 6b: whole-branch review brief, round 2 of 3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 0dfc812f1d00949fce3871d75a4bb7c0912cfd9f parent 273aaa7
1 file changed, +62 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-plans-6b-branch-R2.md +62 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-plans-6b-branch-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-plans-6b-branch-R2.md
new file mode 100644
index 000000000..69f43119a
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-plans-6b-branch-R2.md
@@ -0,0 +1,62 @@
+# Review brief: branch plans-6b-checkout-flow (Plan 6b: checkout, team plans and the billing page), round 2 of 3
+
+Repo carlos/platform, branch `plans-6b-checkout-flow`, the commit that adds this brief (named in your prompt).
+Under review: the diff `origin/main...HEAD` (merge base 0a32ce38, main merged in as c0e7d1dc).
+Authorities: the spec `docs/superpowers/specs/2026-10-20-plans-caps-packs-design.md` (merged on main), Plan 6a as merged (7f79385e), and the plan this branch builds, `docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md`, which rides on this branch (Astra accepted it after nine rounds; Paul ruled Calls 1 to 18). Review the code against that plan.
+
+You are an independent reviewer. Read the plan's Invariants, Risks, Calls, Global Constraints and Review Focus, then the code, and check every claim against that code. Every task already had its own review (records in `docs/superpowers/notes/plans-6b-ledger.md`).
+
+## Fixed: do not re-argue
+
+- Paul's Calls 1 to 18 and accepted risks R1 and R2 (the plan, "Calls for Paul" and "Risks"). Report only mechanisms that fail to honour them.
+- The plan's design: Stripe idempotency keys as the finality primitive; provider time (a response Date at most 60 s old plus monotonic elapsed, one clock probe where a path has no read) for every billing safety decision.
+- Every line marked `Ruling:` in `docs/superpowers/notes/plans-6b-ledger.md`. Raise one only with new evidence that it breaks an invariant.
+- `docs/superpowers/notes/plans-6b-followups.md` lists P3s and deferred minors already known; don't re-report them.
+- Billing is dormant: nothing runs unless the console's billing variables are set (6c, Paul's live Stripe setup). Don't report the dormancy itself.
+
+## What to check
+
+1. **Never charge twice, never charge without consent** (Invariants 1, 2, 7, 8, 9): every provider write is a persisted `billing.Prepared` sent verbatim; resends only through `recoveryEligible`; an indeterminate request (cached 5xx) is never resent; a seat charge needs a stored, single-use, verifiable authorisation; revocation and resends share `opOutstanding`. Trace `sendOpLocked`, `finishOpLocked`, the Checkout create/expiry and customer create paths (`billingcheckout.go`) and seat admission (`billingseats.go`).
+2. **Provider time only** in first-send stamps, resend windows, the restore margin, `expires_at`, proration dates and the restore stall. Look for any console wall-clock value reaching one of these.
+3. **Late restore after renewal** (Risk R1, `billinglate.go`): obligations survive read failures and restarts, an unknown start quantity never explains a raise, the stall opens one problem.
+4. **Locks**: billing hold vs the member lock (member lock first, never under a billing hold), `*Locked` helpers never lock, no forged `billingHold{}`; the retirement gate's order (finish ops, resolve intents, then judge subscriptions, no provider write after step 3) and the step-up replay (`billingretire.go`, `stepup.go`, `emailsignin.go`): a failed step-up setup clears retirement; a replay needs its retirement mark.
+5. **Passes only read** (`billingpass.go`): no `Send`, no `PortalURL`, local writes only under the hold.
+6. **Request budgets**: the call-count tests assert what the plan's budget rows say, reads included.
+7. **The step-up change is a security gate**: `requireFreshAuth` now wraps `stepUpGate`; check every other caller keeps its behaviour.
+8. **Merge with main** (c0e7d1dc): conflicts were resolved in `internal/console/server.go` (struct fields) and `svcroutes_test.go` (closed-door count 68). Check nothing from main was lost there.
+9. **The census** (you judge it; Paul no longer rules on census classes, #280): the root-read card `docs/superpowers/notes/census-proposal-plans-6b-checkout-flow.md` reports no changed units and two re-pinned envelopes, `.` (the root `carlos` package) and `internal/plans`. Read every changed function in those two packages and what it reaches, and answer the card's question: does any root read now open, run, query or follow a path or input a tenant, an app or a box agent can create, write or name, or is a check weakened? Also the record-write layer `internal/provision/plans6b_census_test.go`: it re-pins `Server.registerCLIRoutes` and `NewServer` with unchanged kinds; confirm the bodies add no record write. Give an approve or escalate verdict per envelope and for the record-write layer.
+
+## Round 2
+
+Earlier rounds: whole-branch round 1, `docs/superpowers/reviews/CODEX-FINDINGS-plans-6b-branch.md` (at 5af3d04e: 2 P1, 2 P2; census approved). The fix wave since then is `498881aa..HEAD` (commits 387f139a, 08992fcb, 273aaa7e), with the ledger's "Branch review Ruling": each P1 was fixed by stating its invariant, enforcing it in one place (`seatJoinTarget` in billingseats.go; `sendPreparedLocked` in billinghold.go, the only provider Send, which checks readiness) and pinning it with a guard test. A billing-free account still deletes while billing isn't ready (`hasBillingState`, billingretire.go).
+
+First give one line per P1 and P2 from round 1: resolved, partly, or not. Carry every unresolved or partly resolved finding forward at its current severity, then add new findings, with the fix wave first in your attention (it is newly changed billing and termination behaviour). The verdict covers everything outstanding, round 1 included. The census verdicts from round 1 stand unless the fix wave changed a root package (it didn't: only internal/console and internal/billingstripe); say so in one line.
+
+## 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. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **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 section or task, the problem,
+the evidence (file:line, verified), the failure scenario, a concrete
+fix and the invariant or trust boundary it breaks (that is its fault
+family). Then the census verdicts (item 9). 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 (a targeted `go test -run` is fine if a doubt needs it; the Go build cache may be read-only in your sandbox).