fix(generate): emit valid finalize flags in hotfix workflow#109
Merged
Conversation
The generated cascade-hotfix finalize job invoked `cascade hotfix finalize --sha <merge>`, but that command defines no --sha flag and requires --merge-sha, --fix-sha, and --base-sha. The finalize job failed at runtime with a missing-required-flag error. Pass the real required flags: --merge-sha from the merge commit, and --fix-sha/--base-sha recovered by the context job from the resolution PR-body trailers (the plan job does not run on the merged pull_request event). Also correct the plan job outputs to match the planner's actual GHA keys (hotfix_version_candidate, conflict_expected) and expose fix_sha. Add a cross-check regression test that asserts every `cascade hotfix <subcommand> --flag` the generated YAML emits is a real registered flag on that subcommand's cobra command, guarding the whole class of generated-flag-mismatch bugs. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
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.
Problem
The generated
cascade-hotfix.yamlfinalize job (introduced in #106) invoked:But
cascade hotfix finalizedefines no--shaflag. It requires--merge-sha,--fix-sha, and--base-sha(allMarkFlagRequired). The finalize job therefore failed at runtime with an unknown-flag / missing-required-flag error. The plan job also declared outputs (hotfix_version,expect_conflicts) that the planner never writes; the real GHA keys arehotfix_version_candidateandconflict_expected, so those job outputs resolved to empty.Fix
--merge-shafrom the merge commit, and--fix-sha/--base-sharecovered by the context job from the resolution PR-body trailers (Cascade-Hotfix-Source/Cascade-Hotfix-Basestamped by the apply job). The plan job does not run on the mergedpull_requestevent, so its job outputs are unavailable on that path; the trailers are the carrier.fix_shaexposed.$GITHUB_OUTPUTwrites into one redirect to keep shellcheck clean.Tests
cascade hotfix <subcommand> --flagfrom the generated YAML and asserts each flag is a real registered flag on that subcommand's cobra command, built from the same constructor the CLI uses. It fails against the old--shabug and passes after the fix, guarding the whole class of generated-flag-mismatch bugs.Verification
go build ./...okgo test ./...1151 passedgo test -race ./internal/generate/... ./internal/hotfix/...green, including the actionlint test over the generated workflowgolangci-lint run ./internal/generate/... ./internal/hotfix/...no issuescascade's own tree declares 0 environments, so it emits no hotfix workflow; nothing to regenerate.