Repository navigation
cost: --cost-limit covers storage, not just compute - #640
Conversation
--cost-limit was compute-only. That is how #613's launch committed a 1.2 TiB filesystem at ~$174/month under a --cost-limit of 2.50 — roughly 70x the cap — while the cap was respected to the letter the whole time, because it counted nothing but compute-seconds. The cap is now a TOTAL, enforced in the two places it can be. The split is not cosmetic: --cost-limit is enforced INSIDE the instance by spored, and spored dies with the instance, so it can never act on a resource that outlives it. Up front (CLI, reliable): a launch whose storage commitment alone exceeds the cap is REFUSED, naming the real monthly figure, what is being created, and why the cap cannot bound it. --allow-cost-limit-overrun is the explicit escape hatch. Priced monthly, not TTL-prorated, deliberately: once created, a filesystem bills until something deletes it, and for a durable one nothing does automatically. A month is the floor. In flight (spored): EBS now counts toward the cap alongside compute, because terminating actually stops it — spawn's volumes carry DeleteOnTermination. Priced on WALL CLOCK, not compute time: EBS bills while an instance is merely stopped, and pricing it over compute hours would undercount exactly the case that matters. I wrote it the wrong way first; the test that caught it asserts the 2h-wall-clock vs 1h-compute distinction explicitly. FSx is deliberately NOT in the in-flight tally. Terminating does not delete a filesystem, so firing the cap on FSx accrual would terminate the instance while the thing it reacted to kept billing — an action that looks like enforcement and achieves nothing. That commitment is refused at launch instead, and reclaiming what outlives an instance stays the reaper's job (#624/#625). Verified against the exact #613 invocation: now refused with the $174.00/month figure, exit 1. Four cases confirmed NOT refused: the override flag, a compute-only launch under a $0.01 cap (no regression), a cap that covers the storage, and a $180 cap against the $174 minimum — so the error's advice is actionable. Two test assertions updated rather than deleted, both of which encoded the OLD truth: the #617 estimate test required 'does NOT cover' and the #615 billable view required 'caps COMPUTE only'. Both became false by design; they now assert what did NOT change — that the cap cannot RECLAIM storage outliving the instance — and the first also fails if the obsolete wording returns. 'compute only' survives where it is still accurate (cost.go, status.go), because those lines describe compute FIGURES, not the cap's scope. Refs #616
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Ran the two free checks from the consumer side on 0.116.0 — 118 cookbook TaskSpecs, every one with a
So the change is a strict improvement from where I'm standing, and #613's 70×-over-cap case was exactly the hole worth closing. One loose end:
|
Refs #616. Per your call: the cap becomes a total, with an explicit override, and no new flags — one number meaning what people already believe it means.
The bug
--cost-limitcounted compute-seconds only. That is how #613's launch committed a 1.2 TiB filesystem at ~$174/month under a--cost-limitof 2.50 — roughly 70× the cap — while the cap was respected to the letter the entire time.Why it has to be enforced in two places
--cost-limitis enforced inside the instance byspored, andsporeddies with the instance. So it can never act on a resource that outlives it. That constraint, not taste, produces the split:spored's running tallyUp front: a launch whose storage alone exceeds the cap is refused, with the real figure:
Priced monthly, not TTL-prorated, deliberately: once created, a filesystem bills until something deletes it, and for a
durableone nothing does automatically. A month is the floor, not the estimate.In flight: EBS now counts toward the cap, priced on wall clock rather than compute time — EBS bills while an instance is merely stopped, and the old arithmetic counted none of it.
FSx is deliberately not in the in-flight tally. Terminating doesn't delete a filesystem, so firing the cap on FSx accrual would kill the instance while the thing it reacted to kept billing — an action that looks like enforcement and achieves nothing. That commitment is refused at launch instead; reclaiming what outlives an instance stays the reaper's job (#624/#625).
Behaviour change, stated plainly
A launch that succeeded yesterday under a small cap with
--fsx-createis now rejected. That's the bug, not a regression — those launches were silently uncapped — but it will break scripts, and the changelog says so.Verified against the exact #613 invocation (refused, exit 1) and four cases that must not be refused:
--allow-cost-limit-overrun--cost-limit 0.01--cost-limit 300with the same filesystem--cost-limit 180vs the $174 minimumA bug I wrote and the test caught
I first priced EBS over compute hours, which undercounts exactly the case that matters: a stopped instance accruing storage.
TestAccumulatedCostIncludesEBSasserts the 2h-wall-clock vs 1h-compute distinction explicitly, and I confirmed it fails against the version I nearly shipped:Two test assertions updated, not deleted
Both encoded the old truth and became false by design:
"does NOT cover"→ now requires"cannot RECLAIM", and fails if the obsolete wording returns."caps COMPUTE only"→ now requires the reach statement.They assert what didn't change — the cap can't reclaim storage that outlives the instance — which is the part users still need told.
"compute only"survives incost.goandstatus.go, where it describes compute figures rather than the cap's scope and is still accurate.Incidentally
The changelog gate from #638 caught me immediately:
[Unreleased]already had a### Changedand I added a second, soTestChangelogHasNoDuplicateGroupsfailed on my own PR. Consolidated. First time it's earned its keep.Gates
gofmt·go vet·go build·go test ./...all green ·make check-docsclean withdocs-gen/launch.mdregenerated ·staticcheckzero added (by-message diff) · changelog format tests pass.Suggested bump: MINOR — new
--allow-cost-limit-overrunflag, and--cost-limit's meaning changed in a way users will notice.