carlos / platform Public

rollup-tenant-tags: review brief

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 5fe6b58b1fe4ad992b60cc9eae97852f2be0d872 parent 0eda5b2
1 file changed, +82 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rollup-tenant-tags.md +82 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rollup-tenant-tags.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rollup-tenant-tags.md
new file mode 100644
index 000000000..3a782cede
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rollup-tenant-tags.md
@@ -0,0 +1,82 @@
+# Review brief: branch rollup-tenant-tags (billing), round 1 of 3
+
+Repo carlos/platform, branch `rollup-tenant-tags`, commit named in the
+reviewer's prompt. Under review: the diff `origin/main..<commit>`.
+Authorities on main: `docs/superpowers/notes/remote-instance-metrics.md`
+(the box's per-sample tag rule, reviewed and merged in 4dc5902d and
+d7ae1d76) and `internal/console/usageattrib.go` (#390, 70930b64, its
+reviews in that branch's report). This branch adds the note's section
+"Follow-up: tags in the hourly rollups". Do not review against unmerged
+branches; if this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer. Read the new note section, then the
+diff, and check every claim against the code.
+
+## Fixed: do not re-argue
+
+- Paul's rulings: a reading counts for an account only on evidence that
+ holds for the whole time it covers (#390); the box's per-sample tag is
+ such evidence (the merged tag rule); untagged usage of a custom-domain
+ instance counts against no account; local and namespace attribution
+ keep #390's behaviour.
+- The per-sample tag rule itself (merged). Raise it only with new
+ evidence that a rolled-up hour can carry a tag its samples did not.
+
+## What to check
+
+Fault family: **tenant identity of usage** (an hour, or part of one,
+charged to an account that did not run it, or a tenant's usage charged to
+the platform). Name it beside every finding in that family.
+
+1. `metrics.RollupHour`/`rollupOwned`: does each owner's aggregate cover
+ exactly the samples tagged with it, on every path the box rolls an
+ hour (metricsFlush's old-hour rollup over a merged chunk,
+ backfillPrevHourRollup)? Can a restart, a merged chunk or duplicate
+ timestamps make an owner's N or average include another tenant's or an
+ untagged sample?
+2. `sweepUsage` (`internal/console/economicspass.go`): namespace-owned and
+ platform units as before; an unknown unit charged to each owner only
+ for its owned aggregate, through `attribute`; the remainder counted for
+ no one. Double counting? Over-counting when an hour's rollup is
+ rewritten? Statements' re-runs over the month?
+3. Interaction with #390's other paths: status --instances (live), the
+ census, economics views. Anything still reading rollups as untagged?
+4. Wire shape: additive `owned`; every reader of day rollups (fleet
+ presence hours included).
+5. Tests: production-wired as described; a custom-domain instance on a
+ non-console box counted for its owner; a reused hostname not counted
+ for the wrong account; untagged hours counted nowhere. Mutations: 6,
+ all killed.
+6. Request budget: no new request.
+7. **Census (the reviewer decides every class).** Card
+ `docs/superpowers/notes/census-proposal-rollup-tenant-tags.md`: the
+ `internal/metrics` envelope re-pin. Approve or reject, citing lines.
+
+## 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 verdict. 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.