feat: plan multi-commit hotfix elevation across the env chain#246
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
The hotfix planner handled a single commit against a single environment. The no-op (idempotency) check at the heart of
Planonly consultedstate.SHAancestry; it never consultedstate.Patches. A commit already applied onto a diverged env branch (recorded inpatchesbut not advancingstate.SHA) would be replanned and re-cherry-picked on every dispatch. There was also no way to elevate a set of commits across the bottom-up environment chain in one pass.Refs #245. This is PR1 of 2; it extends the planner engine only. The generated workflow and e2e scenario land in PR2.
What changed (additive)
parseCommitRefsparses a comma-delimited commit-ref list (trims, rejects empty/duplicate, preserves order; a single ref stays a one-element slice).expandTargetEnvsreturns the bottom-up env sequence from the second env up to and including the target (first env and anything above the target excluded).state.SHAOR already recorded instate.Patches. This closes the core re-elevation gap.PlanChain(refs, targetEnv)returns per-env plans (env, branch, base SHA, ordered to-apply commits after skips, whole-set no-op). Commits in ref order, envs bottom-up.cascade hotfix plan --commitstriggers the chain path with text/JSON/GHA output; the chain output keys (env_sequence,env_count,commits_<env>,no_op_<env>,conflict_expected_<env>) are additive.The single-env
PlanandPlanResultare unchanged;schema_versionstays 1; no new manifest or config field.Verification
go build ./cmd/... ./internal/...: successgo test ./...: 1668 passed, 27 packagesgo vet ./internal/hotfix/...: no issuesgolangci-lint run ./...: no issues