Skip to content

fix(launch): treat --ami auto as auto-detect - #17

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/ami-auto
May 31, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/ami-auto

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #15.

spawn launch --help says --ami ... auto-detects AL2023, but auto-detection only fired when --ami was empty. Passing --ami auto (as the help text implies you can) sent the literal "auto" to EC2 → InvalidAMIID.Malformed: Invalid id: "auto".

Fix

  • Normalize --ami auto (case-insensitive) to empty at the flag-mapping stage in buildLaunchConfig, so all downstream AMI-detection gates (single, sweep, batch) auto-detect.
  • Defense-in-depth: also treat "auto" as auto-detect at the launchWithProgress detection gate.
  • Update the --ami flag help: AMI ID (ami-...); omit or use 'auto' to auto-detect the latest AL2023.

Tests

TestBuildLaunchConfig_AMIAuto verifies auto/AUTO/Auto → empty (auto-detect) and a real ami-* ID is preserved.

go build, go vet, gofmt, go test ./cmd/ pass.

The --help text said --ami 'auto-detects AL2023', but auto-detection only
fired when --ami was empty; passing --ami auto sent the literal string to EC2
→ InvalidAMIID.Malformed. Normalize --ami auto (any case) to empty at the
flag-mapping stage so all downstream AMI gates auto-detect, plus a
defense-in-depth guard in launchWithProgress. Update the flag help to document
'auto'.

Closes #15.
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch.go 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 96b55dd into main May 31, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the fix/ami-auto branch May 31, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spawn launch --ami auto: "Invalid id: auto" error — help text says it auto-detects AL2023

1 participant