mirror of
https://github.com/hanzoai/compute.git
synced 2026-10-30 14:50:41 +00:00
There were two price tables. The resale catalog answered /v1/machines/launch; a hardcoded 32-entry map in billing/pricing.go answered the node-pool meter, and it carried no GPU rows at all — GetHourlyCostCents returned 0 for every slug it had never heard of, which is every GPU we sell. The map is deleted. service.HourlyCents is the one resolver, reading the same catalog the quote reads. It refuses instead of returning zero. A slug the catalog does not carry, and a slug the catalog prices at zero, both yield ErrPriceUnavailable — the upstream publishes no free size, so a zero is an unresolved price, not a policy. That distinction is the whole finding: "free by policy" and "we could not work out what this costs" produced identical $0 invoices. AuthorizeCompute and RecordCompute are the matching gate and debit, fail-closed on every non-nil answer from commerce. launchMetered now composes the three rather than restating them inline, so its Actor attribution matches the sweep's and there is one place where the posture lives. Prepaid only: NewMeteringClient drops TierAware, so the compute gate reads the org's prepaid balance and not the tier-aware effective balance that folds in promotional plan allotment. A free-tier grant is meant to buy inference, not an H100. TierAware only affects Authorize's balance read, so the fleet-billing lines this client also carries are untouched. Sweeps say so when they cannot bill. service.Billable replaces four silent early-returns with a WARN and a metric (visor.billing.sweeps_skipped), and the two tickers stop deciding at STARTUP whether billing is possible: a pod that booted before its KMS-synced COMMERCE_SERVICE_TOKEN landed created no billing ticker at all and never billed anything for the life of the pod. Both are now wired unconditionally and decide per tick, so a late credential starts billing on the next hour. Two counter changes worth stating: an unpriceable machine now counts as skipped in the hourly sweep instead of slipping through uncounted, and the node-pool sweep skips a pool created in the current clock hour because the create path now debits it (service.CreatedInHour is the one launch-hour rule, shared). Co-authored-by: Hanzo Dev <[email protected]>