fix(cloud): keep EC2 UserData dist-check free of ${...} so !Sub accepts it - #2596
Conversation
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThe fix is clean and minimal. The offending No findings. [OPUS-REVIEWED] 460b390 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
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: |
…ts it
The dashboard-build guard folded the setup-log tail into the WaitCondition reason via a bash default-expansion ${fe_err:-<...>}. The whole UserData is a CloudFormation !Sub, which parses every ${...} as a Sub variable, so CreateChangeSet rejected the template (ValidationError: variable names in Fn::Sub syntax must contain only alphanumeric...). Rewrite to plain $fe_err with an explicit [ -z ] default; add test_every_sub_variable_is_legal to catch any illegal !Sub token.
047d56e to
460b390
Compare
|
Disposition for GPT BLOCKING —
|
Design Review (Fable 5) — ✅ PASSAdvisory design-level review of Both tokens in the fix are now brace-free, all remaining Design-Verdict: PASS Root cause fixed at both levels: the illegal token is gone and a regression test now guards the whole [DESIGN-REVIEWED] 460b390 |
…ts it (kirodotdev#2596) The dashboard-build guard folded the setup-log tail into the WaitCondition reason via a bash default-expansion ${fe_err:-<...>}. The whole UserData is a CloudFormation !Sub, which parses every ${...} as a Sub variable, so CreateChangeSet rejected the template (ValidationError: variable names in Fn::Sub syntax must contain only alphanumeric...). Rewrite to plain $fe_err with an explicit [ -z ] default; add test_every_sub_variable_is_legal to catch any illegal !Sub token. Co-authored-by: Joe Guo <zejiangg@amazon.com>
Problem
Launching an EC2 crew fails immediately at stack creation:
The stack never gets created, so the crew can't come up at all. Regression from #2059.
Why it matters
This is a hard block on the whole dashboard EC2-launch feature: every launch dies at
CreateChangeSetbefore a single resource is provisioned. It slipped past CI becausecfn-lintdid not flag the offending${...}and no test validated the!Subtokens;only the real AWS
CreateChangeSetcall rejects it.Fix
CreateChangeSetrejects the template with theFn::Subvariable-name error.the
WaitConditionfailure reason using a bash default-expansion,${fe_err:-<none captured; ...>}. The entire UserData is a CloudFormation!Sub,which parses every
${...}as a Sub variable reference.fe_err:-<none captured; ...>is not a legal Sub variable name (
:-<, spaces,/,;), so the template is invalid.The existing code already knows this — sibling escapes use the
${!literal}form — butthe new line used a raw brace expansion.
$fe_err/$LOG(no${...}),with an explicit
if [ -z "$fe_err" ]default instead of the brace default. Behaviouris unchanged; the real npm/vite/tsc error is still folded into the reason.
Tests
TestSubTemplateSyntax::test_every_sub_variable_is_legalscans the renderedtemplate and asserts every
${...}is either the${!...}literal escape or a validSub variable name (
[A-Za-z0-9_:.]+). It fails on the pre-fix line and guards thewhole class going forward.
test/test_cloud_ec2.pyfull suite: 74 passed locally.Manual verification
Not yet re-launched. Next EC2 launch from a gateway carrying this template should get
past
CreateChangeSet; if the frontend build then fails, theWaitConditionreason nowcarries the real build error (the feature #2059 intended, minus the syntax break).