Repository navigation
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 15, 2026
…mmands' flags (#935) spawn resume is deprecated in favour of spawn sweep resume, which lacked --max-concurrent-auto (#494), so following the deprecation notice lost the option. Both commands now declare their flags through registerResumeFlags. A new gate, TestDeprecatedCommandFlagsExistOnReplacement, discovers every deprecated command whose message names a spawn replacement (10 pairs today) and requires each of its flags to exist on the replacement under the same name and shorthand, bound to the same variable (or taken positionally, or, for a deprecated flag, its named replacement flag to exist). The gate also found collect-results --output/-o: sweep collect has only --output-file/-f, so `spawn sweep collect X --output results.csv` set the root output format and silently wrote results.json, which the sweep help example itself showed. collect-results gains --output-file/-f and keeps --output as a deprecated alias; both collect commands share registerCollectFlags. Help, docs-gen and the example script are updated. Fixes #935
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #935
What
spawn sweep resumenow accepts--max-concurrent-auto(spawn resume: --max-concurrent has no quota-derived --max-concurrent-auto equivalent #494).spawn resumeandspawn sweep resumedeclare their flags through one function,registerResumeFlags(cmd/resume.go), so a flag added there reaches both spellings.TestDeprecatedCommandFlagsExistOnReplacement(cmd/deprecated_command_flags_test.go). It walks the cobra tree, finds every command whoseDeprecatedmessage names aspawn ...replacement, resolves that replacement withrootCmd.Find, and checks every local flag of the deprecated command withVisitAll:Usenames<flag-name>(<sweep-id>), the flag is taken positionally, which counts;-o/--output) parses fine and does the wrong thing, which a name check would miss.It fails if discovery finds nothing, and if a deprecation message names a command that doesn't resolve. It discovers 10 pairs today (cancel, collect-results, create-ami, list-amis, list-sweeps, resume, and the 4
notify workspace-*shims).Found by the gate:
collect-results --outputspawn collect-results --output/-o FILEis a local flag that shadows the root format flag. Its replacement,spawn sweep collect, only has--output-file/-f, sospawn sweep collect X --output results.csvset the root output format toresults.csvand silently wroteresults.json. Thespawn sweephelp example showed that exact invocation. This is the same shadowing #309 fixed in queue/slurm/pipeline. It missed this command.Fix, following #309's slurm pattern:
collect-resultsgains--output-file/-f, and--output/-ostays as a deprecated alias bound to the same variable. Both collect commands shareregisterCollectFlags. The help examples,docs-gen/andexamples/result-collection-example.shnow use--output-file.Evidence
sweepResumeCmdregistering only--max-concurrentand--detachinline) makes the gate fail with:spawn resume --max-concurrent-auto -> spawn sweep resume: flag is missing on the replacement (#935)spawn collect-results --output -> spawn sweep collect: the replacement's --output is bound to a different variable, so the same invocation means something elsespawn sweep resume x --max-concurrent-auto --max-concurrent 3gives--max-concurrent-auto and --max-concurrent are mutually exclusive — pick one... --max-concurrent-auto --detachgives--max-concurrent-auto is not yet supported with --detach (spawn#494)make check: everything passes except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: all 9 nested modules clean.make check-tidy: clean.make gen-docsis committed.Notes
sweepResume*andsweepCollect*vars incmd/sweepgroup.goalone. Make staticcheck blocking in make check and CI, and fix its 67 findings (#923) #938 deletes them, and the hunks don't overlap.