Skip to content

fix(help): --name and --fsx-lifecycle show their type as the placeholder; gate every flag (#1520) - #1541

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1520-flag-usage-placeholders
Nov 6, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1520-flag-usage-placeholders

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

spawn launch --help printed --name spawn launch <name> and --fsx-lifecycle spawn terminate. pflag's UnquoteUsage takes the first back-quoted span in a flag's usage as its value name, and both usages put a command in backticks. The commands are now in plain single quotes, so the lines read --name string and --fsx-lifecycle string.

Gate

TestFlagUsagePlaceholderIsTypeName in cmd/flag_usage_backticks_test.go walks every flag of every command under rootCmd. A sibling test in cmd/spored/flag_usage_placeholder_test.go walks every command under spored's newRootCmd().

The rule: the value name --help shows (pflag.UnquoteUsage) must equal the name pflag derives from the flag's type. The test gets that name by asking pflag about a copy of the flag with its backticks removed, which gives string, int, duration, strings, and "" for a bool. It does not keep a list of type names, so a new flag type cannot trip it.

  • Why not "has a space": a one-word code span such as `spored` becomes a placeholder just as wrongly, and a space-only rule lets it through. A placeholder with a space still gets its own error message, because that is always this bug.
  • No false positives today: it walked about 660 spawn flags, and none sets a deliberate placeholder. The CLI's convention is the type name, and flag help must not use backticks at all.
  • Scope: it generalises --no-public-ip / --allow-missing-endpoints help shows a bogus "spawn connect" value name (backticks in the usage string) #1441's bool-only gate (TestBoolFlagUsageHasNoValueName), which stays.
  • Findings: the survey found only these two flags in spawn, and none in spored.

Revert evidence

  • Gate against unfixed main:
    spawn launch --fsx-lifecycle: --help shows the value name "spawn terminate", which has a space in it ...
    spawn launch --name: --help shows the value name "spawn launch <name>", which has a space in it ...
    
  • A one-word span injected into --fsx-lifecycle: `spored` gives --help shows the value name "spored", want the type name "string".
  • spored gate, with `spawn pool` injected into pool-worker --run-id: spored pool-worker --run-id: --help shows the value name "spawn pool", want the type name "string".

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 (docs-gen/launch.md regenerated and committed)
  • make api-snapshot
  • make cli-iam-actions

Fixes #1520

…der; gate every flag (#1520)

pflag takes the first back-quoted span in a usage as the flag's value name,
so --name printed as '--name spawn launch <name>' and --fsx-lifecycle as
'--fsx-lifecycle spawn terminate'. Quote the commands plainly, and add a gate
over every spawn and spored flag: the value name --help shows must be the one
pflag derives from the flag's type.

Fixes #1520
@scttfrdmn scttfrdmn added this to the v0.161.0 milestone Nov 6, 2026
@scttfrdmn scttfrdmn added bug Something isn't working documentation Improvements or additions to documentation component:spawn labels Nov 6, 2026
@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!

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check at 810355f9: PASS. spawn launch --help now shows --name string and --fsx-lifecycle string. Before, they showed the backticked commands spawn launch <name> and spawn terminate.

@scttfrdmn
scttfrdmn merged commit 3556d69 into main Nov 6, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1520-flag-usage-placeholders branch November 6, 2026 06:28
@scttfrdmn scttfrdmn mentioned this pull request Nov 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working component:spawn documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launch --help: --name and --fsx-lifecycle show a backticked command as their placeholder

1 participant