ci(back-merge): realign next onto main to kill drift#374
Conversation
When the post-release merge leaves next content-identical to main (next held no unreleased work, the normal case), force-push next to main's hashes so the hash divergence from rebase-merged promotes cannot accumulate into a giant conflicting promote. When next has real unreleased work, keep the merge and push normally, so nothing is ever lost. The bot's always-bypass on the next ruleset lets it force-push. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c0fa47ddf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # accumulate into a giant conflicting promote later. Otherwise next | ||
| # has real unreleased work, so keep the merge and push normally. | ||
| if git diff --quiet origin/main HEAD; then | ||
| git push --force origin "origin/main:refs/heads/next" |
There was a problem hiding this comment.
Preserve concurrent updates when force-realigning next
In this release workflow, actions/checkout snapshots next before the merge; if any PR or Dependabot merge lands on next while the job is running, this new unconditional --force can still reset refs/heads/next to the previously fetched origin/main, discarding those newer commits. I checked git push -h: --force is only “force updates”, while --force-with-lease requires the old ref value, so using a lease or refetching/rechecking would turn this race into a failed back-merge issue instead of history loss.
Useful? React with 👍 / 👎.
🎯 What & why
Stop the rebase-promote hash drift from accumulating. After each release the back-merge now realigns
nextontomain(whennextholds no unreleased work), instead of only merging, sonextnever diverges into a giant conflicting promote again.🛠️ How it works
After
git merge origin/main: if the result is content-identical tomain(next had nothing unreleased), force-pushnexttomain's hashes; else keep the merge and push normally (no work lost). The bot'salwaysbypass on thenextruleset permits the force-push.🧪 How to verify
Next release: the back-merge run leaves
nextatmain's exact HEAD (zero divergence), with noback-merge-failedissue.✅ I certify