Skip to content

fix(hotfix): fail loudly when a remote env tip diverges from recorded state - #367

Merged
joshua-temple merged 1 commit into
mainfrom
fix/hotfix-tip-state-divergence-guard
Jun 26, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
fix/hotfix-tip-state-divergence-guard

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The hotfix cherry-pick base is derived from the recorded state SHA, but the existing tip-vs-state divergence guard only inspected a local branch. In CI only remote-tracking refs are fetched, so the guard never fired: a diverged env/<env> tip went undetected, the cherry-pick landed on a stale base, the resulting PR was unmergeable, and the run died with a confusing merge-poll timeout instead of a clear diagnosis.

Fix

Add a plan-time check (verifyRemoteEnvTip in PlanChain, plus RemoteBranchSHA) that compares the fetched remote env tip to the recorded state SHA and fails with an actionable message (env name, both SHAs, replay guidance) when they diverge. No-op when the ref is absent or in sync, so the normal path is provably unchanged. The generated workflow already fetches these refs, so no regeneration or drift.

Tests

TestPlanChain_RemoteEnvTipDiverged_FailsWithGuidance (red before fix) and TestPlanChain_RemoteEnvTipInSync_PlansCleanly (control). Full go test ./... 1777 pass; golangci-lint clean.

… state

The hotfix cherry-pick base is the recorded state SHA, but the existing divergence guard only inspected a local branch, which never exists in CI (only remote-tracking refs are fetched). A diverged env/<env> tip went undetected, the cherry-pick landed on a stale base, and the run died with a confusing merge-poll timeout. Add a plan-time check that compares the fetched remote env tip to the recorded state SHA and fails with an actionable message (env name, both SHAs, replay guidance) when they diverge. No-op when the ref is absent or in sync, so the normal path is unchanged. The generated workflow already fetches the refs, so no regeneration is needed.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple enabled auto-merge (squash) June 26, 2026 03:00
@joshua-temple
joshua-temple merged commit 0629ff6 into main Jun 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant