Skip to content

fix(verify): thread --cli-install mode through Plan and drift-check#662

Merged
joshua-temple merged 2 commits into
mainfrom
fix/verify-cli-install-mode
Jul 24, 2026
Merged

fix(verify): thread --cli-install mode through Plan and drift-check#662
joshua-temple merged 2 commits into
mainfrom
fix/verify-cli-install-mode

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

TLDR

  • verify (and the generated cascade-drift-check.yaml, which runs it) always re-planned every generator assuming the default action install mode, since Plan never called setInstallMode on any generator (unlike generate-workflow's own command.go, which does for all eleven generator types).
  • A repo generated with --cli-install=binary would therefore report every Setup CLI step as spurious drift, permanently, with no way to tell verify which mode to check against.
  • Fixed both halves: Plan/verify now accept --cli-install, and the drift-check generator's own emitted cascade verify invocation now passes --cli-install=binary when that's the mode it was generated in (byte-identical output preserved for the default action-mode case).

Why / value

  • --cli-install=binary (added in feat(generate): add --cli-install=binary for allowlist-free CLI install #653) was otherwise unusable together with verify/drift_check at all -- a real capability gap for any adopter whose org's Actions allowlist blocks the setup-cli composite action.
  • Discovered while adopting cascade in a downstream repo (cfacorp/voice-ordering): cascade verify reported drift on every file the moment --cli-install=binary was used, with no flag to reconcile it.

Evidence

Acceptance criterion Test that proves it End-to-end evidence
A binary-mode repo verifies clean when told --cli-install=binary TestRun_CLIInstallBinary_NoDriftWhenModeMatches New test in internal/verify/verify_test.go; passes.
The two modes produce genuinely different bytes (not a coincidental pass) TestRun_CLIInstallBinary_MismatchedModeIsRealDrift Same file; a binary-mode repo checked without the flag correctly reports real drift.
cascade-drift-check.yaml's own emitted cascade verify line passes --cli-install=binary when generated in that mode TestDriftCheckGenerator_BinaryMode_PassesCLIInstallFlag internal/generate/drift_check_test.go; passes.
Default (action-mode) output is unchanged, byte-for-byte TestDriftCheckGenerator_ActionMode_OmitsCLIInstallFlag plus the full existing byte-identical regression suite All pass unmodified.
Full repo build/lint/test stays green go build ./..., go vet ./..., golangci-lint run, gofmt -l, go test ./... All clean/green locally.

verify (and the generated cascade-drift-check.yaml, which runs it) always
re-planned every generator assuming the default action install mode: Plan
never called setInstallMode on any generator, unlike generate-workflow's
own command.go, which does so for all eleven generator types before
rendering. A repo generated with --cli-install=binary would therefore
report every Setup CLI step as spurious drift, forever, since nothing
could tell verify which mode to check against.

Fixed by mirroring generate-workflow's own pattern exactly: PlanOptions
gained a CLIInstall field, parsed once in Plan and applied via
setInstallMode to every generator Plan constructs, so a binary-mode repo
now verifies clean when told --cli-install=binary. Added the matching
--cli-install flag to the verify command itself.

Also fixed the other half of the same gap: cascade-drift-check.yaml's own
emitted "cascade verify" invocation never passed --cli-install, so even a
correctly-generated binary-mode repo's own CI would still report drift at
runtime. The generator now emits --cli-install=binary when its own
installMode is binary, and omits the flag entirely in the default action
mode (byte-identical output for every existing manifest, confirmed by the
full byte-identical regression suite still passing unchanged).

Verified: two new verify tests prove a binary-mode repo verifies clean
when the mode is told, and reports real drift when it isn't (the control,
proving the two modes produce genuinely different bytes rather than the
test passing by coincidence). Two new drift-check generator tests lock in
the flag being present in binary mode and absent in action mode. Full
repo test suite, go vet, golangci-lint, and gofmt all pass.
@joshua-temple joshua-temple self-assigned this Jul 24, 2026
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

All PR Validation checks passed.

TestChangelog_UnreleasedCoversUserFacingCommits correctly caught this was
missing from the prior commit.
@joshua-temple
joshua-temple merged commit b118178 into main Jul 24, 2026
21 checks passed
@joshua-temple
joshua-temple deleted the fix/verify-cli-install-mode branch July 24, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant