Repository navigation
fix(cloud): accept the interactive tier keys on the Fargate lane - #11534
Conversation
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the tier's disk_gb riding into billed Fargate ephemeral storage — the RFC promises "CPU and memory pairs"; the disk field is this PR's own extension. [DESIGN-REVIEWED] 1ed103d |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The tier's disk maps to ephemeral storage too — the RFC promises "CPU and memory pairs"; confirm the third field is intended, not scope creep. What this change shipsInventory (4 items) — 4 justifiedIntent: make the Fargate lane accept the three EC2 tier keys before the lane is registered, as the in-progress Fargate RFC promises — a FIX (reproduction in description; tests fail on base;
No duplicate mechanism exists (grep [FIRST-PRINCIPLES-REVIEWED] 1ed103d |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
The failure is: Three separate reasons it cannot be this PR:
Locally, on this branch: Nothing to do on this branch for that lane; it clears when #11517 does. |
338873d to
8846bbc
Compare
8846bbc to
ce8500d
Compare
ce8500d to
82458f2
Compare
|
|
Driven on main, all three EC2 tier keys are refused by the Fargate lane:
DEFAULT_TIER_KEY = balanced
_parse_size('light') -> ValueError: size 'light' is not a Fargate cpu/memory pair
_parse_size('balanced') -> ValueError: size 'balanced' is not a Fargate cpu/memory pair
_parse_size('power') -> ValueError: size 'power' is not a Fargate cpu/memory pair
_parse_size('1024/2048') -> TaskSize(cpu='1024', memory='2048', ...)
The RFC's section 9 promises the opposite twice -- "The existing size keys keep
working", and "the Fargate backend maps the same three keys to CPU and memory
pairs, so a launch that does not name a backend behaves as it does today". And
the key refused is the one a caller gets by NOT choosing: sizes.DEFAULT_TIER_KEY
is balanced.
It is latent today only because nothing registers the lane -- engine_for
resolves aws_ec2 alone -- so no caller can reach the refusal. It stops being
latent in the change that registers it, which is why this lands first.
_tier_as_pair respells a tier key into Fargate's own "<cpu>/<memory>/<gib>"
vocabulary, DERIVED from sizes.py's tier table rather than written out again.
That table is where a tier's vCPU, RAM and disk are decided and it has been
changed before; deriving means such a change reaches this lane, while a second
table here would keep answering with the retired shape and nothing would compare
the two. It returns a KEY, not a finished TaskSize, so the derived numbers run
through the same bounds check a hand-written pair does -- a tier whose shape ever
leaves Fargate's table is refused by name instead of being handed to RunTask.
Two refusal messages also now name the key the caller passed. The docstring said
a refusal "names the key the caller passed, never its respelling" while the
cpu-not-in-table and memory-out-of-range branches named only the resolved
numbers, so someone who typed `power` read back `cpu='16384000'` and had nothing
to search for. The test that forces that path is what found it.
Fixes part of #11328
82458f2 to
1ed103d
Compare
Board note: the inherited reds cleared, and this PR was never changed for themRebased onto main's tip Before the rebase, head
That attribution came from main's own CI rather than from inference. Two separate #11593 is the fix, and all five lanes are Nothing in this diff was changed for any of it. The two files are byte-identical One earlier red is worth naming so nobody rediscovers it. On head |
What is the problem?
Driven on
origin/main, all three EC2 tier keys are refused by the Fargate lane:The RFC's Sizing section promises the opposite, twice: "The existing size keys
keep working", and "the Fargate backend maps the same three keys to CPU and memory
pairs, so a launch that does not name a backend behaves as it does today".
fargate_engine.pynever importssizesat all.The key refused is the one a caller gets by not choosing:
sizes.DEFAULT_TIER_KEYisbalanced.Why this issue matters to the user
It is latent today, and only for one reason: nothing registers the lane, so
engine_forresolvesaws_ec2alone and no caller can reach the refusal. Itstops being latent in the very change that registers the lane -- at which point a
user who never mentioned Fargate, and whose size key is therefore a tier name,
gets a refusal from a backend they did not ask for. That is why this lands first,
separately, rather than riding along with registration.
How our fix solves it
_tier_as_pairrespells a tier key into Fargate's own"<cpu>/<memory>/<gib>"vocabulary, and_parse_sizeaccepts both spellings.The shape is derived from
sizes.py's tier table, not written out again here:That table is where a tier's vCPU, RAM and disk are decided, and it has been
changed before -- its own comment records a raised ladder while the keys stayed.
Deriving means such a change reaches this lane; a second table here would keep
answering with the retired shape, and nothing would compare the two.
It returns a key, not a finished
TaskSize, so the derived numbers runthrough exactly the bounds check a hand-written pair does -- against
FARGATE_MEMORY_FOR_CPU, its minimum, maximum and step. A tier whose shape everleaves Fargate's own table is then refused by name rather than handed to
RunTask. All three are legal today, which is asserted rather than assumed.Only the three interactive keys are respelled.
light-x86is a real ladder keyand deliberately not one of them: mapping it would silently pick an architecture
the caller did not ask this lane for.
All four refusal messages name the key the caller passed. The docstring
claims a refusal "names the key the caller passed, never its respelling", and four
branches named only resolved numbers -- cpu-not-in-table, memory-out-of-range, and
both ephemeral-storage branches -- so someone who typed
powerread backcpu='16384000'or a bare GiB count, with nothing to search for. Each of the fouris reached the same way, by moving the ladder until a tier derives an illegal
shape, and each now carries the caller's key. That keeps the docstring's claim
universal rather than narrowed to the pairs it happened to cover. This is the
defect this line keeps producing: prose asserting what the adjacent code does not
do, and the tests that force those paths are what find it.
What tests we did
Eight new tests in
test/test_fargate_launch_engine.py, twelve collected casesonce the parametrised ones expand; the file goes 48 -> 60 and every existing one
still passes. Siblings run too:
test_fargate_runtask.py,test_fargate_taskdef.py,test_cloud_sizes.pyandtest_cloud_launch_job.py-- 284 passed.Expectations are derived from the ladder, not restated, so a raised ladder moves
the test with the code instead of pinning a retired shape.
Every assertion mutation-verified:
10 mutations, 0 holes.
Row 6 is worth reading, twice over. Its first version pointed at the wrong
test, and the matrix reported it caught -- because the mutation only affects the
refusal path, which a tier key never reaches on today's ladder. So the docstring's
claim was untestable with real inputs. The test that fixes that forces the path by
moving the ladder (a thing that has happened) so a tier derives an illegal shape.
Running it revealed the claim was simply false, which is the code fix above.
The second lesson from that row: a mutation result means nothing while the clean
tree is red. The matrix printed "8 mutations, 0 holes" at a moment when the new
test failed on an unmutated tree, because a test that reds either way reds under
mutation too. Clean-tree green is now checked before the matrix is believed.
Gates run locally: every
scripts/check_*.pythe Backend Lint lane invokes, plusisort, flake8, ruff,
black --target-version py310, the comment-history gate andthe brand-name gate.
Any other suggestions on the work
engine_for('aws_fargate')still raisesKeyError, which is the rest of Fargate: FargateLaunchSpec has no configuration home, so the aws_fargate lane cannot be registered yet #11328 -- together with a configuration homefor
FargateLaunchSpec, whose fields have nowhere to be written down today.Registering without a config home would put a selectable Fargate option in
Set-up whose every launch refuses, which is why the two belong in one change.
publish path that makes a digest-pinned image reference possible is feat(scripts): publish the crew base image so a digest-pinned ref can exist #11530.
light-x86,balanced-x86andpower-x86remain unmapped on purpose. If thislane should honour them, the architecture has to come from the caller rather
than from the key, and that is a separate decision.
Fixes part of #11328
Pattern harvest
Rule candidate: a docstring sentence asserting a property must have a test that
FORCES the path it describes. Here
_parse_size's docstring claimed "a refusalnames the key the caller passed, never its respelling" while two branches named
only the resolved numbers -- and the claim was unreachable with real inputs,
because a tier key cannot fail on today's ladder. Writing a test that moves the
ladder to reach that path is what showed the claim was simply false. A property
whose path no test can reach is a property nothing is checking, and prose is the
worst place to keep it. The same sentence then stayed false in a narrower way:
the two branches the first test reached were fixed while both ephemeral-storage
branches kept naming resolved numbers. A property stated for "a refusal" is a
claim about EVERY refusal in the function, so enumerate the raise sites and cover
them all, or narrow the sentence to the set a test actually forces.
Rule candidate: a mutation matrix means nothing until the clean tree is green.
This one printed "8 mutations, 0 holes" at a moment when the new test failed on an
UNMUTATED tree -- a test that reds either way also reds under mutation, so every
row read as caught. Assert clean-tree pass first, then read the matrix.
Rule candidate: when a test's expectation restates a table the code derives from,
the test agrees with itself rather than with the code. The tier expectations here
are computed from
sizes.get_tierfor that reason: the ladder has been raisedbefore with the keys unchanged, and a second copy of the numbers would keep
asserting the retired shape while passing.