š fix(guard): read Mergify's merged draft as the PR it merged (#532)
Slice: #532
After Mergify merges queued pull request #A, it retitles the closed draft merge queue: merged #A: <A's title>. That edit runs niyam-guard / judge and niyam / PR identity again. mergifyTests read only the checking form, so both judged the closed draft as itself and went red. Now scripts/merge-queue.mjs reads the merged form as testing #A, the same as while the draft was checking #A.
Why. Latest run of each check on each athya_mono draft's head (check-runs API, read 2026-11-21):
| Draft (tests) | Changes a guard file | Guard | PR identity |
|---|---|---|---|
| #3841 (#3737, TF-03) | yes | failure | failure |
| #3839 (#3836, onboard) | yes | failure | failure |
| #3831, #3812, #3800 (onboards) | yes | failure | success |
| #3832, #3825, #3820 | no | success | success |
On #3839, Guard refused three files with "names no slice". PR identity reported "mergify[bot] pushed 26da48f, which claims AthyaBot". Nothing gates on these results: the draft is closed unmerged, athya_mono squash-merges so the draft's head reaches no branch, and passedOnPull (src/owner-step.ts) keeps only merged pull requests.
What changes
MERGED_TITLE,^merge queue: merged #(\d+):. Only the number aftermerged #is read. The rest is #A's own title, written by #A's author, so no number in it counts. The draft is still identified as before: authormergify[bot], a Bot, on amergify/merge-queue/branch of the repository.- Only the single form is read. Of athya_mono's 200 latest closed drafts, 116 are
merged #N: ā¦and 84 arechecking #N ā¦, and none is batched or stacked. A batched merged title stays judged as itself. - Limit: a stacked draft that merged would be read as #A alone, so guard files or commits from the pull requests ahead of it would still refuse. None has been seen.
- Rejected: Guard passing a closed draft without judging it. That puts a pass nothing judged on the draft's head sha, and it leaves PR identity red. Also rejected: an
if:skip, because a skipped run passes a required check (#526). - README's Mergify paragraph and
docs/decisions.md. Alok approved #532 with a š on its proposal (09:41:46Z), after the slice's last edit (09:39:47Z).
Checked
- Read-only replay against GitHub with this change:
judgeand PR identity's draft read (mergifyTests+strayCommits) pass #3839, #3841 and #3832.#3839 tested=[3836] guard=0 identity: passes as testing 3836 #3841 tested=[3737] guard=0 identity: passes as testing 3737 #3832 tested=[3828] guard=0 identity: passes as testing 3828 - New tests: a merged title reads as [A], including tails such as
fix #99 raceandx + #5 together on main (abc).merged #1:on draft 1, a batched merged title, and other near-miss forms read nothing. A judge test reads a closed merged draft as #2: it passes on #2's approved slice and is refused as #2 without one. #507's tests used the merged title as an example that reads nothing, and now use a batched one.pnpm check: exit 0 pnpm test: tests 2122, pass 2122, fail 0 pnpm test:scripts: tests 133, pass 133, fail 0 merge-queue.mjs | line 100.00 | branch 100.00 | funcs 100.00 guard.mjs | line 100.00 | branch 97.05 | funcs 100.00
After merge: a release, then each client's onboard to it. Until then, their merged drafts stay red.
Guards: scripts/merge-queue.mjs, scripts/merge-queue.test.mjs, scripts/guard.test.mjs. scripts/merge-queue.mjs is code-owned by Alok, so this waits for his review.
š¤ Generated with Claude Code
Summary by cubic
Fixes Guard and PR identity misjudging Mergify's closed merged draft as itself, turning both checks red after every merge. Mergify retitles the draft merge queue: merged #A: <A's title> once #A merges; the title now reads as testing #A, as it did while checking.
Details
- Only the number after
merged #is parsed; the rest is #A's own author-written title, so no number in it counts. - Only the single form is read; none of athya_mono's 200 latest closed drafts was batched or stacked.
docs/decisions.mdrecords that, with work rules off, Guard still judges a merged draft as itself.- Read-only replay against GitHub passes #3839, #3841, and #3832.
- A release is needed after merge before clients can onboard; until then, their merged drafts stay red.