Repository navigation
Make pipeline --wait wait, and delete the dead logs --region - #841
Merged
Merged
Conversation
Both flags had exactly two references in the tree — declaration and
registration — so neither did anything with the value it demanded.
`pipeline launch --wait` returned immediately: the launch path invokes
the orchestrator with InvocationType: Event. A CI step written as
`spawn pipeline launch p.json --wait && ./collect-results.sh` exited 0
at once and ran the next step against a pipeline that had not started,
which is the precise thing the flag exists to prevent. It now polls
until terminal and exits non-zero unless the pipeline SUCCEEDED — that
second half is what makes the flag worth having, because a version that
merely blocked would still let the `&&` run after a FAILED pipeline.
Transient read failures and a not-yet-written record are retried rather
than reported as failure, since the orchestrator writes the record
asynchronously and "not found" is normal right after launch.
--wait-timeout bounds the wait at 24h: an unbounded wait on a wedged
pipeline hangs CI forever, which is a different failure from the one
being fixed but no better.
`logs --region` was worse than inert. A local flag wins the binding over
a persistent one, so the value never reached SetSharedFlags and there
was no working --region on that command at all. Deleting the local flag
lets the root flag apply, as it does elsewhere.
TestEveryFlagVariableIsReadSomewhere catches this class structurally,
reading the source because cobra cannot tell a flag that is read from
one that is not. Deprecated flags are exempt — that is what deprecating
means — and the exemption comes from the code's own MarkDeprecated calls
rather than a hand list. Three flags surfaced on the first run
(--use-reservation, pipeline --detached, cleanup --force), all three
deliberate deprecated no-ops. Neither --wait nor logs --region was,
which is why they were defects and not decisions.
Two more gates exist because two reverts went uncaught first time.
Reference counting passed `if flagWait && false { ... }` — three
references each, all dead — so it finds a flag nobody looks at but not
one looked at and ignored; the wiring needs its own assertion. And
IsTerminal's comment claimed a classification gate I had not written:
removing StatusCancelled from the terminal set failed nothing.
One gate was removed after running it. It required that no local flag
shadow a persistent root flag, and reported more than twenty commands
declaring their own --region. That is the repo's convention, not a
defect; keeping it would have meant twenty allowlist entries each
asserting that ordinary code is exceptional — rule 4's anti-pattern
inside out. The reasoning is recorded in the file in place of the test.
Closes #807
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #807.
Correctness audit 2026-10.Both flags had exactly two references in the tree — declaration and registration — so
neither did anything with the value it demanded.
1.
pipeline launch --waitreturned immediatelyThe launch path invokes the orchestrator with
InvocationType: Eventand returns. So:spawn pipeline launch p.json --wait && ./collect-results.shexited 0 at once and ran the next step against a pipeline that had not started — the
precise thing the flag exists to prevent.
It now polls until the pipeline is terminal and exits non-zero unless it succeeded.
That second half is what makes the flag worth having: a version that merely blocked would
still let the
&&run after a FAILED pipeline.failure. The orchestrator writes the record asynchronously, so "not found" is normal
immediately after launch — treating it as failure would make
--waituseless exactlywhen it is used.
--wait-timeoutbounds the wait at 24h. An unbounded wait on a wedged pipeline hangs CIforever: a different failure from the one being fixed, but no better. On timeout it says
the pipeline is still running and how to check it.
PipelineStatus.IsTerminal/.Succeededare new, with an exhaustive switch and nodefault, so an unclassified status cannot fall through to "keep waiting".2.
logs --regionwas worse than inertA local flag wins the binding over a persistent one. So
spawn logs x --region us-west-2bound to the dead local flag, the value never reachedSetSharedFlags, andthere was no working
--regionon that command at all. Deleting the local flag lets theroot flag apply, as it does everywhere else:
The structural gate
TestEveryFlagVariableIsReadSomewherecatches this class directly: a flag variable withonly its declaration and registration in non-test source is accepted from the user and
discarded. It reads the source, because cobra cannot tell a flag that is read from one
that is not.
Deprecated flags are exempt — that is what deprecating one means: still accepted so
scripts do not break, deliberately ignored. The exemption comes from the code's own
MarkDeprecatedcalls, not a hand list (rule 4). Three flags surfaced on the first run —--use-reservation,pipeline --detached,cleanup --force— and all three aredeliberate deprecated no-ops. Neither
--waitnorlogs --regionwas, which is exactlywhy they were defects and not decisions.
Two gates that exist because reverts went uncaught
Worth stating plainly, since the first pass looked complete and was not:
if flagWait && false { return waitForPipeline(…) }. Bothvariables still had three references; the third was dead code. Reference counting finds a
flag nobody looks at, but not one looked at and ignored — so
TestPipelineLaunchActuallyWaitsasserts the wiring: a plainif flagWait {, a call,and the result returned (otherwise a failed pipeline still exits 0).
IsTerminal's comment claimed a classification gate I had not written. RemovingStatusCancelledfrom the terminal set as a deliberate revert failed nothing.TestEveryPipelineStatusIsClassifieddiscovers the constants from the source andrequires each to be named in the switch.
A gate removed after running it
The first version of
cmd/inert_flags_test.gorequired that no local flag shadow apersistent root flag — the theory being that
logs --regionbroke because the local flagwon the binding. Run, it reported more than twenty commands declaring their own
--region:launch,list,doctor, everyarraysubcommand,cleanup,footprint…That is the repo's convention, not a defect. Keeping the gate would have meant an allowlist
of twenty entries each asserting that ordinary code is an exception — rule 4's anti-pattern
turned inside out, where the list is what is normal and the gate is what is wrong. The
reasoning is recorded in the file in place of the test.
The shadowing was never the defect; it only determined how the symptom presented. The
defect was that the flag was never read, and the gate above catches that with no reference
to shadowing at all.
Verification
make check(all nested modules),make check-docswithdocs-gen/regenerated(
logs.md,pipeline.md), changelog gate,semgrep0 findings,make api-snapshotnodrift (
pkg/pipelineis not in the public-surface set), Tier 0 e2e with-count=1.Seven compiling reverts:
--waitinert via dead code (×2 shapes — guard and discardedreturn), the dead
logs --regionrestored,--waitsucceeding on a FAILED pipeline,--wait-timeoutdefaulting to 0, andStatusCancelleddropped from the terminal set.#808 is the remaining Phase 3 issue (compliance flag arity) and is next.