Repository navigation
test(sweep): classify every launch flag for the sweep path - #698
Merged
Merged
Conversation
The sweep path drops flags by construction: the dispatch builds a two-field LaunchConfig instead of calling buildLaunchConfig, and buildLaunchConfigFromParams merges rows onto an empty struct. A flag reaches sweep rows only if someone hand-wrote a shim, which has happened one category at a time after each report (#525, #539 twice, #549, #667 single-path-only, #673/#674/#675). Measured: 127 flags, 44 honoured, 83 dropped, 72 of those with no param-file key either — including all EFS/FSx flags and --pre-stop. sweepFlagCoverage classifies each flag with its issue, and three gates keep it honest: unclassified fails the build, a gap must cite an issue, and a flag claimed as honoured must really be referenced on the sweep path. Each gate verified to fail when violated. The gate found seven flags I had not classified on its first run. Does not fix the gaps — stops new ones appearing silently. #697 carries the structural fix.
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.
Part of #697 — the gate, not the fix.
What I found when I went looking for a per-path flag gate
I set out to extend #688's "flag read by nothing" gate to catch "flag read on one path but not another" — the shape of #667 and #539. Tracing why paths drift turned up something larger: the sweep path drops flags by construction.
cmd/launch_single.go, the sweep dispatch:The single-instance path calls
buildLaunchConfig(), which reads every flag global. The sweep path builds two fields and never calls it;buildLaunchConfigFromParamsthen "start[s] with an empty config". So a flag reaches sweep rows only if someone hand-wrote a shim — andapplyCLISpendControlsToSweep(#525) andapplyCLIIAMToSweep(#539) are precisely those shims, two categories reclaimed by hand after each was reported.That makes #525, #539, #549, #667, #673, #674 and #675 one bug reported seven times.
Measured
launchCmdflagsFiltering out what genuinely isn't a sweep concept (
--batch-queue,--mpi*,--min-viable,--interactive,--dry-run), the consequential gaps are:--efs-*, all eleven--fsx-*, and--attach-volume. For an HPC sweep that means every row stages through S3 because shared storage is unreachable.--security-group-ids,--security-group,--subnet-id,--subnet,--vpcare still dropped on sweeps, so every row lands in the VPC default security group.--pre-stop/--pre-stop-timeout— the hook that syncs results before termination. Losing it loses output.--on-idle,--active-ports,--active-processes(idle-detection inputs), both webhook URLs and their correlation/timeout companions,--tag,--team,--plugin,--user-data-file.What this PR does
Only the gate.
sweepFlagCoverageclassifies all 127 flags as honoured, not applicable, or a known gap with its issue, and three tests keep it honest:(3) is the one I care most about. A manifest can drift into wishful thinking, and that is exactly how #539's second half survived — its fix listed the flags that existed when it was written, and
--s3-read/--s3-writewere added to the single path later.The gate found seven flags I had not classified on its first run (
--completion-file,--session-timeout,--user-data,--wait-for-running,--wait-for-ssh,--webhook-correlation,--webhook-timeout). I classified them from the source rather than from memory.All three gates verified to fail when violated: removing a classification, flipping a known gap to "honoured", and dropping the issue reference each produce the right failure. I checked this because four tests I wrote earlier today passed vacuously, and a gate that cannot fail is worse than no gate.
Deliberately not fixed here
The structural fix — pass the real config into the sweep and let param rows override it — is in #697 with its risks written down. It touches a path that launches N instances at once, it would make
buildLaunchConfig's validation start applying to sweeps, and the sweep code branches on fields being empty (firstConfig.IamInstanceProfile == ""decides whether to set up the shared spored role). That wants its own PR and a hardware smoke, not a drive-by at the end of a long session.Gates
gofmt -lempty,go vet ./...,go test -short ./..., changelog gate,semgrep→ 0 findings.