usage-attribution-390
Fixes #390: console usage and billing undercount tenants whose instances run on boxes other than the console's. Paul approved 2026-10-26 ("Build the fix; October self-corrects"); no backfill.
What changes. Statements, the census, the economics page and carlos status --instances attributed every box's readings against the console box's own registry. Remote instances went to the ops account, and the hourly month re-sweep moved a moved instance's earlier hours to ops: bdn's October statement had no compute, and about 745 instance-hours sat under bab.
internal/console/usageattrib.go now gives a reading to an account only on evidence that holds for the whole reading:
- the box's tenant tag on a live reading;
- or a host under
<...>.<sqid>.<apps domain>or a sidecar's<name>.<app>.<sqid>.sidecar.internal, for a live account. Only that account can hold such a name (#215 refusals).
Other tenant workloads are counted against no account and logged: custom-domain instances without a tag, and units stamped on a tenant's console-box route. Platform units stay ops. The census counts instance and sidecar records on every box, plus console-box routes no record covers. It skips Trash and fleet placements, and refuses the day on any unreadable record.
Release. Console only (plus the CLI's status --instances printer). The first statements pass after the console release rewrites October from the rollups. Custom-domain instances (5 records on flagship) now count against no account until boxes roll tags into hours (follow-up).
Cap check. The flagship console has no CARLOSPLANCATALOG or CARLOS_BILLING, and there is no control/plans.json, so plans are off and no cap can trip.
Tests. Production-wired in usageattrib_test.go, through the real doors, both boxes' reconcile and reports, and the box's own rollup writer:
- a two-box tenant;
- a hostname reused across accounts;
- a same-account recreate;
- a statement re-run across a move;
- unknown units;
- status across boxes;
- the census.
12 of 12 mutants were killed.
Review. Astra whole-branch: round 1 NOT READY (3 P1s, one family: records, reports and routes are not historical ownership; 4 P2s), all fixed. Round 2 READY. Census root envelope and record-write census re-pin approved and recorded on #280. Copy: two Luna passes.
Discussions
- No discussions on this branch yet.
Tasks
- No tasks yet.
Activity
- claude agent, operated by paul@keymail.dev pushed 8bd9e6a01 usage-attribution-390: Astra round 2 READY (no P1, no P2); census and record-write census approved; Unattributed field comment matches the rule
- claude agent, operated by paul@keymail.dev pushed f039c92cf usage-attribution-390: Astra round 1 findings and round 2 brief
- claude agent, operated by paul@keymail.dev pushed b84f7d476 Merge origin/main (d3c5601b) into usage-attribution-390; census overlay re-proposed last, record-write layer on nearestRegionB; economics fixtures moved into the ops namespace
- claude agent, operated by paul@keymail.dev pushed 75ec5e139 usage-attribution-390: Astra round 1 fixes. attribute by box tag or the hostname's account namespace only; census refuses undecodable records, covers excluded hosts, counts sidecars
- claude agent, operated by paul@keymail.dev pushed acdda11c5 usage-attribution-390: Astra review brief, round 1; census overlay
- claude agent, operated by paul@keymail.dev pushed 902e12c93 usage-attribution-390: usage and billing attribute every box's readings by instance record, not the console box's registry