Repository navigation
fix(fsx): stop promising synchronous ephemeral reaping; surface FSx in terminate and estimates (#613) - #617
Merged
Merged
Conversation
…n terminate and estimates --fsx-lifecycle ephemeral said the filesystem is "reaped when this instance terminates". Nothing reaps an FSx at terminate time: cmd/terminate.go has no FSx handling at all. Reclamation is asynchronous — the out-of-band ttl-reaper deletes the filesystem on a later pass, once it is AVAILABLE and no live instance carries either lease tag (spawn:fsx-id or spawn:fsx-pending), after a grace period, and only in accounts the reaper is configured to scan. A user who read that help, ran `spawn terminate`, and saw it succeed reasonably concluded their 1.2 TiB (~$174/month) filesystem was gone. It wasn't. Three changes, all read-only: - Reword the flag help, the --fsx-create/--fsx-ttl validation errors, and docs/durable-storage-fsx.md to say when reclamation actually happens. A gate test fails if the shorter, false sentence regrows. - `spawn terminate` now names the filesystem (id, size, state), says it is NOT deleted by the command, and gives `spawn fsx list` / `spawn fsx delete <id>`. It handles the still-provisioning spawn:fsx-pending lease too, and does not claim ownership of a --fsx-id filesystem spawn didn't create. `spawn stop` prints the same filesystem with the point that matters there: compute stops billing, the filesystem does not. Terminate still deletes nothing but the instance. - `--estimate-only` now prices the filesystem --fsx-create would create (capacity, throughput tier, approximate monthly cost) and states at the point of use that --cost-limit does not cover it. The rate table lives in one named place (cmd/fsx_cost.go) with its source and the fact that it is an approximation. pkg/aws gains DescribeFSxBrief, a nil-safe read-only lookup: GetFSxFilesystem dereferences DNSName/MountName, which a CREATING filesystem does not have — the exact state this issue hit. Refs #613
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
added a commit
that referenced
this pull request
Oct 1, 2026
…NT_2 storage rate (#627) #618: GetFSxFilesystem dereferenced DNSName, LustreConfiguration.MountName and StorageCapacity unconditionally. All three are optional in the API and a filesystem still CREATING has no DNSName and no LustreConfiguration at all, so reaching this during provisioning panicked instead of returning something usable — and CREATING is the exact window spawn#613 was reported from. The tag scan had the same shape (Tag.Key/Value are both optional). The mapping is extracted as a pure fsxInfoFrom so it can be tested against any lifecycle state without AWS; the new test panics against the pre-fix code. Empty DNSName/MountName is the meaningful answer — a mount cannot be built without them, so 'not ready' is reported rather than crashing. #619: fsx info multiplied capacity by a hardcoded 0.22, commented '$0.22/GB-month for SSD'. That is a PERSISTENT_1 rate applied to filesystems spawn creates as PERSISTENT_2, whose rate at the default 125 MB/s/TiB tier is $0.145 — overstating a 1200 GiB filesystem by ~52% ($264 vs $174). Since #617 made --estimate-only quote storage cost, two spawn commands disagreed about the same filesystem. It now reads the actual throughput tier off the filesystem and uses the single shared rate table in cmd/fsx_cost.go (fsxLustreMonthlyUSD), with both derefs guarded for the same CREATING case. A drift gate fails if any file in cmd/ names an FSx rate in code again, and pins the rate to the PERSISTENT_2 values so 'one source' cannot be satisfied by centralising the wrong number. Refs #618, #619
This was referenced Oct 2, 2026
scttfrdmn
added a commit
that referenced
this pull request
Oct 3, 2026
--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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses asks 2 and 3 of #613 only — the CLI-side honesty and visibility work.
Ask 1 is not in this PR, and the issue stays open until it lands. The reap
logic itself is correct: the ttl-reaper's ephemeral-orphan safety net covers
exactly the reported scenario (a filesystem whose instance vanished while it was
still
CREATING). The actual leak cause is operational — the deployed reaper'saccount list doesn't include the account the launch ran in — and is being fixed
separately. Nothing here touches
lambda/ttl-reaper/, and no new reapingmechanism is added.
A. The wording was the bug
--fsx-lifecycle ephemeralsaid "reaped when this instance terminates".cmd/terminate.gohas no FSx handling at all. Reclamation is asynchronous: theout-of-band reaper deletes the filesystem on a later pass, once it is
AVAILABLEand no live instance carries either lease tag (
spawn:fsx-idorspawn:fsx-pending), after a grace period, and only in accounts it scans. So thepromise is grace-delayed, best-effort and contingent on infrastructure — none of
which the old text admitted.
Reworded consistently in
--fsx-lifecycle's help, both--fsx-create/--fsx-ttlvalidation errors, anddocs/durable-storage-fsx.md(the lifetimetable, the
ephemeralbullet, the end-of-job export note, and the reaper's"promise" section, which now states plainly that reclamation is asynchronous
rather than transactional and depends on the reaper covering your account).
docs-gen/launch.mdregenerated viamake gen-docs.A drift gate (
cmd/fsx_promise_gate_test.go) fails if the shorter, friendlier,false sentence regrows anywhere in
cmd/,docs/,docs-gen/or the README,and also asserts the positive half — the help must actively say reclamation is
asynchronous, since silence reads as "it just works".
B.
spawn terminatesurfaces the filesystemRead from the instance's own lease tags, then enriched with a read-only
DescribeFileSystems:blast radius is unchanged.
spawn:fsx-pending(still-provisioning) lease is reported too, tagged"still provisioning" — that's the window this issue hit.
spawn:fsx-lifecycletag (i.e. one you brought with--fsx-id) is described as one spawn will never reclaim, rather thaninheriting the ephemeral wording. Avoiding a second false promise.
created with
--fsx-createshares one).fsx:DescribeFileSystems, filesystem already gone) stillprints the id and the "not deleted by this command" line — being unable to
describe it is not a reason to go quiet.
spawn stop/hibernategot the same treatment, with the fact that mattersthere: stopping ends the compute bill but the filesystem keeps running and
billing, and the stopped instance still holds the lease that blocks any
automatic reclamation. A "stopped to save money" instance silently accruing
~$174/month is the same surprise in a different shape.
C. FSx in the cost preview
--estimate-onlyused to printTTL cost: $0.80for a launch about to create a~$174/month filesystem. Now:
The
--cost-limitlimitation is stated at the point of use, not only in flaghelp. The plan builder mirrors the create path's own defaults (throughput 0→125,
capacity 0→1200) so the preview can't quote a shape the launch wouldn't use.
There was no existing storage-pricing helper, so the rate table lives in exactly
one named place —
fsxLustreUSDPerGiBMonthByThroughputincmd/fsx_cost.go—with a comment saying it's an approximation, where it came from (AWS FSx for
Lustre pricing page, PERSISTENT_2 SSD, us-east-1, Sept 2026), and that
PERSISTENT_2 folds the throughput tier into the per-GiB price. No attempt is
made to have
--cost-limitactually enforce against FSx — that's a behaviouralchange beyond this issue.
Tests (unit only, zero real AWS)
cmd/fsx_cost_test.go— the estimate contains capacity, throughput, themonthly figure and the not-covered-by-
--cost-limitcaveat with--fsx-createset, and produces nothing without it; durable names its TTL; the rate table is
pinned (including the unknown-tier fallback and 0-capacity → price nothing).
cmd/fsx_lease_test.go— the notice renders from tags withfsx-id, withfsx-pending, and is absent with neither; untagged filesystems aren't claimedas reaped;
stopsays it keeps billing and doesn't borrow terminate's wording.cmd/fsx_promise_gate_test.go— the misleading phrasing is gone and stays gone.Both renderers are pure (
io.Writer/string in, no client), and the AWS lookup isbehind a package-level seam (
enrichFSxLease), the same pattern asresolveLaunchDryRunPrice.Gates
gofmt -wclean ·go vet ./...clean ·go build ./...clean ·go test ./...all green ·make gen-docsrun anddocs-gen/committed(
check-docspasses) ·staticcheck ./...— 61 findings before, the same 61after, diff empty (no new findings; spawn has no golangci-lint).
CHANGELOG updated under
## [Unreleased]. No version promoted, no tag.Suggested bump: PATCH — the fix is corrected text plus additive output on
paths that already print a summary; no flag, schema or behaviour change. (MINOR
would be defensible if you consider the new terminate/stop block a feature.)
Refs #613