Skip to content

fix(launch): a --param-file sweep is a flags launch, and needs no spore name (#1532) - #1542

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/1532-param-file-sweep-mode
Nov 6, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/1532-param-file-sweep-mode

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

1. Launch mode

launchMode now takes a paramSweep argument. A --param-file/--params sweep is modeFlags whatever the TTY, --instance-type and --interactive, because runLaunch sends it to the sweep path before the wizard ever runs. currentLaunchMode() is the one caller-facing form. The two pre-flight guards and the dispatch all read it:

  • validateNoPublicIPPath(batchQueue, wizard)
  • validateNestedSpawnRoleFlags(wizard)
  • the dispatch switch

So a guard now judges the path the launch actually takes. A seam, stdinIsTerminal, lets tests drive runLaunch as a TTY caller would.

2. Spore name: optional on a sweep (behaviour fix, not doc edits)

launchNameArgs no longer requires a name when the parsed flags make the launch a sweep, by isSweepLaunch's rule: --param-file/--params without --batch-queue/--queue-template.

Why not default the name from --sweep-name: buildLaunchConfig copies --name into the base config, and every member inherits it. So spawn launch swr --param-file … names every member swr, and the per-member default <sweep-name>-<index> (defaultSweepMember) never applies. Defaulting the name to --sweep-name would give every member the same name too. Leaving it empty lets the existing per-member naming work: a row's name:, else <sweep-name>-<index>, or sweep-<index> without --sweep-name. Users copy the examples, so the examples now just work.

Unchanged:

  • A name given on a sweep behaves as before: it becomes every member's Name tag unless the row sets one.
  • The conflicting-names and too-many-positionals checks.
  • Every other launch still needs a name, including batch-queue or queue-template with a param file.

Other callers:

  • spawn slurm submit still passes slurm.SporeName(job). That is harmless, since each converted row sets name: from the same value. Only its comment changed.
  • No other caller builds a spawn launch sweep argv.

Tests

  • TestLaunchMode: sweep rows for TTY, pipe, with a type and with --interactive.
  • TestParamFileSweepWithoutInstanceTypeIsNotTheWizard: through runLaunch on a TTY, with instance_type only in defaults:, no --instance-type and no name, with and without --no-public-ip --subnet-id. It reaches the detached sweep path: the SpawnSweepCrossAccountRole lookup and its refusal, with nothing created. It is never refused as a wizard launch. withLogDir(t, false) is set.
  • TestInteractiveLaunchStillGetsTheWizard: a non-sweep launch with no type on a TTY, and one with --interactive, get the wizard's --no-public-ip refusal.
  • TestInteractiveSweepIsRefusedAsASweep.
  • TestSweepNameArgs: the name rules for sweep and non-sweep launches.
  • TestNamelessSweepMembersAreNamedBySweep: members are named swr-0, or by their row's name:.
  • TestExampleParamFileUsageLinesAreAccepted: each # Use with: spawn … line in examples/*params*.yaml goes through rootCmd.Find, the command's flags and its Args validator. A spawn launch line must also be a flags launch on a TTY, and its param file must parse.

Revert evidence

  • Remove the paramSweep short-circuit:
    • TestLaunchMode fails on 3 rows.
    • The runtime test fails with a --param-file sweep was refused as a wizard launch (#1532): --no-public-ip is not supported by the interactive wizard….
    • The example test fails with "launch --param-file simple-params.yaml --sweep-name simple-experiment" is mode 1 on a TTY, want a flags launch.
  • Remove the sweep exemption in launchNameArgs:
    • TestSweepNameArgs fails 3 cases with a spore name is required….
    • The example test fails with spawn launch rejects "launch --param-file simple-params.yaml --sweep-name simple-experiment": a spore name is required….

Checks (all pass, tree clean after regeneration)

  • make check
  • hermetic go test ./... with the AWS env stripped
  • make test-e2e-tier0
  • semgrep scan --config=auto --error .
  • make gen-docs (no change)
  • make api-snapshot
  • make cli-iam-actions

Not in this PR

Several examples pass a param file to --params, which only takes inline JSON and is not implemented. That is filed as #1540.

Fixes #1532

@scttfrdmn scttfrdmn added this to the v0.161.0 milestone Nov 6, 2026
@scttfrdmn scttfrdmn added bug Something isn't working area:launch launch path: instance-type, AMI, user-data, run component:spawn labels Nov 6, 2026
@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check at bcffa5fb: PASS (aws account 942542972736, us-east-1).

I ran spawn launch --param-file p.yaml --sweep-name lc1532 --command true --no-detach --on-complete terminate --region us-east-1 --yes on a TTY. There was no spore name and no CLI --instance-type; instance_type was set only in the param file's defaults:.

  • It took the flags path, with no wizard refusal and no "spore name is required".
  • It launched 2 members named lc1532-0 and lc1532-1, from the per-member default, and spored verified on both.
  • Teardown: both instances are terminated and verified with wait instance-terminated.

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…ines (#1532)

A --param-file sweep with its instance type only in the file's defaults: is
a flags launch on a TTY, not the wizard, so --no-public-ip is not refused
as a wizard launch; a real wizard launch still is. A sweep needs no spore
name (members are named by row, else <sweep-name>-<index>); every other
launch still does. Every '# Use with: spawn ...' line in
examples/*params*.yaml must parse through the real command.

Fixes #1532
@scttfrdmn
scttfrdmn force-pushed the fix/1532-param-file-sweep-mode branch from bcffa5f to b3e853b Compare November 6, 2026 06:30
@scttfrdmn
scttfrdmn merged commit 9e9af9d into main Nov 6, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1532-param-file-sweep-mode branch November 6, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:launch launch path: instance-type, AMI, user-data, run bug Something isn't working component:spawn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launch --param-file without CLI --instance-type is treated as the interactive wizard (refuses --no-public-ip); examples omit the required name

1 participant