feat: add cascade plan command to preview workflow diffs#243
Merged
Conversation
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
Running generation overwrites the managed workflow files in place. There was no way to preview exactly what
cascade generate-workflowwould change before committing to it, which makes upgrades and manifest edits feel risky.Fix
Add a read-only
cascade plancommand that renders, as a per-file unified diff, what generation would change in the committed workflow and action files, writing nothing. It is the human-facing preview counterpart tocascade verify:plan= human preview (shows the actual diff).verify= CI pass/fail gate (status lines + drift exit codes).For each file the manifest would generate,
planprints the diff of committed bytes vs generated bytes: a new file as a whole-file add, a changed file as a unified hunk, a byte-identical file produces no diff. A clean tree printsplan: N files, no pending changes.The producer is reused (
generate.Plan);planandverifyare kept separate because verify owns a frozen 0/1/2 exit contract plus orphan detection and stderr status lines, while plan is stdout unified-diff output.Read-only / exit contract
This is deliberately distinct from
verify's 0/1/2 drift contract.Verification
go build ./cmd/... ./internal/...: successgo test ./... -count=1: pass (incl. newinternal/planunit tests: clean tree, mutated file diff, missing-file whole-file add, deterministic output, read-only snapshot, operational error)golangci-lint run ./...: 0 issuesgo build ./... && go vet ./...: successe2e/scenarios/33-plan-diff.yaml: regenerate then assert a clean tree, then mutate a committed workflow and assert the specific unified-diff hunk with exit 0go-difflibpromoted from indirect to a direct dependency.Closes #180