ci: run CI in a merge queue so promotions stop deferring forever - #978
Merged
Conversation
Merges arrive faster than CI completes, so the deploy job's staleness gate defers to a newer commit that then defers itself. Tonight that ran five rounds and production never advanced past the pre-#963 build. A merge queue serialises main so each candidate gets a clean window. GitHub runs queue candidates on the merge_group event. Three things are needed before the queue can be turned on — enabling it first would hang every merge on a required check that never runs: - trigger CI on merge_group; - scope a candidate from the merge group's base/head range, so queued runs stay as narrow as pull requests instead of running the full matrix; - report `CI — required` on merge_group. It is the only required status context, and the queue waits on it per candidate. The 18 verification jobs need no change: they already fall through to the ci-scope outputs whenever the event is not `push`. The deploy jobs need none either — they additionally require github.ref == 'refs/heads/main', and a candidate builds on gh-readonly-queue/*, so a queued candidate cannot promote. Both properties are now pinned by tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
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.
Why
Merges arrive faster than CI completes (~25 min apart vs ~30 min runs), so the deploy job's staleness gate defers to a newer commit — which then defers itself. Tonight that ran five rounds and production never advanced past the pre-#963 build. The gate is correct in isolation; it just has no way to eventually win.
A merge queue serialises
mainso each candidate gets a clean window.What this changes
GitHub runs queue candidates on the
merge_groupevent. Three things are required:merge_group.CI — requiredonmerge_group. It is the only required status context and the queue waits on it per candidate — this is the one that would hang merges if missed.What deliberately does not change
github.event_name == 'push' || needs.ci-scope.outputs.X, so onmerge_groupthey fall through to the scope outputs and behave exactly as they do on a PR.github.ref == 'refs/heads/main', and a candidate builds onrefs/heads/gh-readonly-queue/*. A queued candidate therefore cannot promote to production. This is the safety-critical property, and it is now pinned by a test rather than left implicit.Verification
ci-workflow.spec.mjs: 36/36, including three new guards — themerge_grouptrigger exists, the required context reports there, and all four production jobs stay pinned torefs/heads/main.merge_grouptrigger fails a guard.CI — requiredif:assertion to the new expression rather than loosening it.After merging
Enable the merge queue on
mainin branch protection. Worth doing in the same sitting — the two halves are only useful together.🤖 Generated with Claude Code