Skip to content

Refuse --os windows without --ami; label Windows rates as a lower bound (#884) - #890

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/884-windows-launch-preview
Oct 13, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/884-windows-launch-preview

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #884

1. --os windows with an auto-detected AMI is refused. Auto-detection only ever returns Amazon Linux 2023. Before this, the launch booted Linux while the preview, the spored readiness check and the Windows guards all treated it as Windows. The check lives in ensureAMIAndPreflight, which both real launches and --dry-run go through, so it fires before anything is created. spawn doesn't pick a Windows version for you (2022 vs 2025, Base vs Core, BYOL). Instead, the error names /aws/service/ami-windows-latest/Windows_Server-2025-English-Full-Base; I checked that it resolves (us-east-1 → ami-00d8aa800578d8b12). The headless pkg/launcher.Provision already refuses Windows outright, and the docs always pass --ami, so this only affects the CLI.

2. Windows rates are labelled as a lower bound. truffle prices Linux only. For m7i.xlarge in us-east-1 the Price List API gives $0.2016/hr Linux vs $0.3856/hr Windows, so the preview was 48% low. --dry-run (table and -o json, new field price_is_lower_bound) and --estimate-only now say the figure excludes the Windows licence. --estimate-only resolves no AMI, so it gets the OS from --os, or from an explicit --ami's platform. Real Windows pricing: spore-host/truffle#185.

Gates (cmd/windows_launch_preview_test.go). I reverted each one in a way that still compiles, and each failed:

  • refusal through runLaunchDryRun for AMI ""/auto/AUTO (revert: && false on the guard call)
  • table caveat and JSON flag through runLaunchDryRun with a stubbed price (revert: && false on render; flag computed from "")
  • estimate caveat at count 1 and 3 (revert: && false)
  • AST check that the --estimate-only call passes estimateTargetOS(...) (revert: config.TargetOS, which is always "" on that path)
  • estimateTargetOS never passes "auto" to DescribeImages (revert: && false on the auto check)

make check green; semgrep clean on the changed files.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_single.go 80.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn force-pushed the fix/884-windows-launch-preview branch from 61df306 to 37a1f28 Compare October 13, 2026 19:40
@scttfrdmn
scttfrdmn merged commit 21e4b80 into main Oct 13, 2026
6 checks passed
@scttfrdmn
scttfrdmn deleted the fix/884-windows-launch-preview branch October 13, 2026 19:51
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 --os windows without --ami silently launches Amazon Linux, and previews it as Windows

1 participant