carlos / platform Public

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.

Commits 6
Discussions 0 0 open
Tasks 0/0 done

Discussions

  • No discussions on this branch yet.

Tasks

  • No tasks yet.

Activity