Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ priority_rules:
priority: 10000
allow_checks_interruption: true

- name: Priority merges without interruption
conditions:
- label = merge-priority
priority: 9000
allow_checks_interruption: false

- name: Lightweight validated changes first
conditions:
- check-success = Lint & Format
Expand Down Expand Up @@ -160,7 +166,7 @@ queue_rules:
# rulesets. Keep those rules enforced by GitHub; Mergify gets no bypass.

pull_request_rules:
- name: Authorize emergency merge requests
- name: Authorize prioritized merge requests
conditions:
- or:
- base ~= ^(master|develop)$
Expand All @@ -169,7 +175,9 @@ pull_request_rules:
- and:
- base ~= ^stack/
- 'body ~= (?m)^Depends-On: '
- label = merge-urgent
- or:
- label = merge-urgent
- label = merge-priority
- -label = release:hold
- -label = dequeued
- -draft
Expand Down
27 changes: 16 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,20 +435,25 @@ regressions and manual scaling measurements are not made passing by blindly
running every `#[ignore]` test. New exclusions need a concrete reason and
evidence; an unexpected failure must not become a skip.

## Emergency merge priority
## Merge priority labels

Apply `merge-urgent` to request an emergency merge. Mergify adds `merge-ready`
and gives the PR priority 10000, ahead of the normal and lightweight priorities.
It may interrupt lower-priority queue checks to test the urgent PR first; use
this only when the urgency justifies restarting that work. Existing queue
categories and batching still apply, as do stack dependency ordering and all
required checks. This is priority, not permission to merge failing CI.
Both labels add `merge-ready` and request normal queue admission:

| Label | Priority | Running lower-priority checks |
| --- | --- | --- |
| `merge-priority` | 9000 | Finish first; this PR goes ahead of waiting ordinary PRs |
| `merge-urgent` | 10000 | May be interrupted to test this PR first |

Both outrank normal and lightweight priorities. If both labels are present,
`merge-urgent` wins. Reserve it for emergencies that justify restarting checks.
Existing queue categories, batching, stack dependency ordering, and all required
checks still apply. These labels do not permit merging failing CI.

Drafts, conflicts, `release:hold`, and `dequeued` still block automatic admission.
After addressing a dequeue's cause, remove `dequeued` to retry. Removing
`merge-urgent` restores normal priority; remove `merge-ready` and explicitly
After addressing a dequeue's cause, remove `dequeued` to retry. Remove both
priority labels to restore normal priority; remove `merge-ready` and explicitly
dequeue as usual to withdraw the merge request entirely. The generated
`merge-ready` label also activates the existing release-PR freeze mechanism.

The label works after this configuration reaches the PR's base branch. Creating
or applying the label alone does not install the queue policy.
Each label's behavior works after its configuration reaches the PR's base
branch. Creating or applying a label alone does not install the queue policy.
18 changes: 16 additions & 2 deletions scripts/mergify.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ test("lightweight queue priority requires actual skipped product checks and succ

test("emergency labels authorize normal admission and outrank lightweight checks", () => {
const priorities = queueConfig.split("priority_rules:\n")[1].split("queue_rules:\n")[0];
const emergency = priorities.split(" - name: Lightweight validated changes first")[0];
const emergency = priorities.split(" - name: Priority merges without interruption")[0];
assert.match(emergency, /name: Emergency merges first/);
assert.match(emergency, /conditions:\n - label = merge-urgent/);
assert.match(emergency, /priority: 10000/);
assert.match(emergency, /allow_checks_interruption: true/);
const admission = queueConfig.split("pull_request_rules:\n")[1];
const authorize = admission.split(" - name: Queue explicitly requested merges")[0];
assert.match(authorize, /label = merge-urgent/);
assert.match(authorize, /- or:\n - label = merge-urgent\n - label = merge-priority/);
assert.match(authorize, /actions:\n label:\n add:\n - merge-ready/);
for (const guard of ["-label = release:hold", "-label = dequeued", "-draft", "-conflict"])
assert.ok(authorize.includes(` - ${guard}`), guard);
Expand All @@ -214,3 +214,17 @@ test("emergency labels authorize normal admission and outrank lightweight checks
assert.match(authorize, /Depends-On:/);
assert.doesNotMatch(authorize, /queue:|merge:|remove:/);
});


test("priority requests pass waiting work without interrupting running checks", () => {
const rules = queueConfig.split("priority_rules:\n")[1].split("queue_rules:\n")[0]
.split(/^ - name: /m).slice(1);
assert.equal(rules.length, 3);
assert.match(rules[0], /^Emergency merges first/);
assert.match(rules[1], /^Priority merges without interruption/);
assert.match(rules[1], /conditions:\n - label = merge-priority/);
assert.match(rules[1], /priority: 9000/);
assert.match(rules[1], /allow_checks_interruption: false/);
assert.doesNotMatch(rules[1], /check-success|check-skipped/);
assert.match(rules[2], /^Lightweight validated changes first/);
});
Loading