Repository navigation
Description
Found while de-duplicating region filtering for #811.
spawn launch accepts two flags that have no effect on anything:
--proximity-from string Prefer regions close to this region (e.g., us-east-1)
--cost-tier string Prefer cost tier: low, standard, premium
What actually happens to them:
- Validated.
ValidateConstraintrejects a cost tier outsidelow|standard|premiumand a proximity region that failsIsValidRegion. So a typo produces a real error, which is strong evidence to a user that the flag is wired up. - Persisted. Both are carried on
sweep.RegionConstraintwithdynamodbavtags and written to the sweep record, so they show up in stored state. - Never read. The only consumers are
regions.ScoreRegionsandregions.GetRegionsByPriorityinpkg/regions/priority.go, and both have zero callers anywhere in the repo — verified with a quoted-glob grep overcmd/andpkg/(an earlier unquoted--include=*.gosilently errored and reported zero for everything, so this was re-run).
So region selection ignores them completely.
The output made it worse
shouldApplyRegionConstraints() returns true if any of include/exclude/geographic/proximity/cost-tier is set. So spawn launch ... --cost-tier low with no other region flag entered the constraint branch and printed:
🌍 Applied region constraints: N regions allowed
Filtered regions: [... every region ...]
Constraint: cost_tier=low
N being every region, with nothing filtered. The message asserts a constraint was applied; the only honest reading of it is wrong.
What has been done, and what hasn't
Shipped in the #811 de-duplication PR, because it is a string change rather than a product decision:
- the flag help on both now says
RECORDED BUT NOT YET APPLIED: region ordering by proximity/cost tier is not implemented, so this does not change which regions are selected; - the sweep output adds a
NOTE:line naming whichever of the two was supplied and saying it did not change the selection above; pkg/regions/priority.gois retained with a comment explaining why. Dead-code inventory: ~3,980 unreachable non-test lines, plus two stranded-deployment inverses #811 lists it for deletion and it is genuinely unreferenced — but it is the only implementation of what these two flags promise, and deleting it would convert a wiring gap into a design decision taken by accident.
The decision itself is open, and it is the #783 question again — finish it or withdraw it:
- Finish it: wire
ScoreRegions/GetRegionsByPriorityinto region selection. Needs a design answer first, because the sweep path takes its candidate regions from a parameter file: does scoring reorder them, cap them, or only break ties?--proximity-fromimplies a distance metric (priority.gohas haversine overRegionMetadata.LatLong) and--cost-tierimplies a per-region cost classification — check thatAllAWSRegionsactually carries a usable tier before committing. - Withdraw it: remove both flags and
priority.go. This is a user-visible removal, so MINOR, and it needs a deprecation note since the values are already persisted in existing sweep records — a reader of old records would otherwise find fields nothing explains.
Either way the half-state should not persist: a validated, stored, documented flag that does nothing is worse than an absent one, because the validation is what convinces the user it works.
Activity
De-duplicate region filtering onto the tested implementation (#811)
De-duplicate region filtering onto the tested implementation (#811) (#…
Withdraw --proximity-from and --cost-tier (#864)