carlos / platform Public

usage-attribution-390: Astra round 1 findings and round 2 brief

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev f039c92cfeb0fbc25c51b14ae4c690c325cb7965 parent b84f7d4
1 file changed, +103 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-usage-attribution-390-R2.md +103 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-usage-attribution-390-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-usage-attribution-390-R2.md
new file mode 100644
index 000000000..1c0b8cbad
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-usage-attribution-390-R2.md
@@ -0,0 +1,103 @@
+# Review brief: branch usage-attribution-390 (#390), round 2 of 3
+
+Repo carlos/platform, branch `usage-attribution-390`, commit b84f7d476e876b4ebcb777db7a11bd88ee7134f6 (the code;
+this brief is committed on top).
+Under review: the diff `origin/main...usage-attribution-390` (main merged in at
+d3c5601b).
+Authorities, all on main: discussion #390, and
+`docs/superpowers/notes/remote-instance-metrics.md`. Do not review against
+unmerged branches.
+
+You are an independent reviewer. Read the diff, then the code it names, and
+check every claim against that code. This is billing code.
+
+## Fixed: do not re-argue
+
+- Paul, #390, 2026-10-26: "Build the fix; October self-corrects". No backfill.
+- A reading whose account cannot be established is counted against no
+ account and logged, never charged to ops.
+- Day rollups carry no tag; rolling tags into hours is a box change, out of
+ scope here (a follow-up).
+- Cap check done: plans are off on flagship (no CARLOS_PLAN_CATALOG, no
+ control/plans.json), so no cap can trip.
+- The consequence of the round 2 rule below is accepted: an instance on a
+ custom domain (5 of 202 instance records on flagship) is counted against no
+ account in statements until boxes roll tags into hours.
+
+## The change since round 1
+
+`internal/console/usageattrib.go` was rewritten. A reading is an account's
+only on evidence that holds for the whole time it covers: the box's tag on a
+live reading, or a host that names its account by construction
+(`<...>.<sqid>.<apps domain>` with at least one label before the sqid, or a
+sidecar's `<name>.<app>.<sqid>.sidecar.internal`), for a live console account.
+Billing reads no records, box reports or console-box routes for ownership any
+more. A unit stamped on a tenant's console-box route is counted nowhere on
+any box; one stamped on the platform's own route is platform overhead. The
+census (`censusPass`, `censusRecords` in `economicspass.go`) keeps records
+and adds sidecar records.
+
+## What to check
+
+1. **The namespace as identity (fault family: tenant identity of usage).**
+ Can any account other than <sqid> ever hold a host under
+ `<sqid>.<apps domain>`, through any door a tenant can reach (instance
+ create, domain attach, apex mints, sidecars, seeds, imports, moves,
+ adoption)? Operator store-mode writes are trusted. Is the sqid parse in
+ `namespaceOwner` right (case, trailing dot, the bare-domain exclusion,
+ an apps domain that is itself a suffix of another)?
+2. **Live tag** in `attribute`: used only on the live view.
+3. **Stamped units**: `tenantStamped` from the console box's registry.
+4. **Census**: unreadable records refuse; Trash and fleet hosts are covered
+ before console-box routes count; sidecars of live and trashed apps.
+5. **Request budget**: billing reads nothing new; the census adds one sidecar
+ listing per app per day through the record view when armed; the status
+ door reads records tolerantly for the APP column.
+6. **Tests** (`usageattrib_test.go` and the updated fixtures) and mutations
+ (12 run, 12 killed: live account not required, wrong sqid label, sidecar
+ not recognised, unknown charged to ops, tag ignored, tenant-stamped as
+ platform, unknown as platform, census ignores records, excluded host not
+ covered, undecodable accepted, sidecars skipped, bare domain accepted).
+7. **Census**: `docs/superpowers/notes/census-proposal-usage-attribution-390.md`,
+ root envelope `.` re-pinned (only `status_instances.go`, the CLI printer,
+ changed). Record-write census:
+ `internal/provision/usage_attribution_390_census_test.go` re-pins
+ `Server.handleAPIStatusInstances` (no write added). Verdict on both.
+
+## Round 2
+
+Earlier rounds: `docs/superpowers/reviews/CODEX-FINDINGS-usage-attribution-390-r1.md`.
+
+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. The verdict covers everything outstanding,
+earlier rounds included.
+
+## 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. 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.