✨ feat(onboard): Mergify's queue draft runs niyam's checks and Guard once per head

Merged
AT
4d ago
+494-38

Mergify's queue draft now runs niyam's checks and Guard once per head, not once per edit of its description.

The two caller jobs niyam onboard writes get an if: that skips an edit of the draft when all of these hold:

  • the event is edited, and its changes name neither title nor base;
  • the draft is known as mergifyTests knows it: author mergify[bot] with type Bot, head on mergify/merge-queue/, head repository the repository itself;
  • the title is not the stacked on N pull requests ahead form, whose tested pull requests come from the body.

The two jobs are niyam in niyam.yml and niyam-guard in niyam-guard.yml. The expression lives once, in src/queue-draft.ts.

Why a skip here passes no refusal. GitHub reports a skipped caller job under its own name: niyam or niyam-guard. It never reports niyam / PR identity or niyam-guard / judge, so the draft's last verdict at its head stands, a refusal or a 403 included. #683's head shows it: the closed run's skipped niyam job reported niyam alone, beside the earlier niyam / PR identity and niyam-guard / judge runs. athya_mono requires niyam / Work rules, niyam / PR identity, niyam / Design frames and niyam-guard / judge. None of them is ever reported skipped, so nothing relies on Mergify's check-skipped.

Narrower than option A. Option A of athya-hq/athya_mono#3968 also put an if: on shared-guard.yml's judge. This leaves it off. A skipped judge reports niyam-guard / judge as skipped, the newest run of that name, which passes the check over a refusal at that head. #526 rejected that design for this reason. shared-guard.yml changes in its comments alone. Slice #685 says so, and Alok was asked there.

Unchanged:

  • opened, synchronize and reopened judge every head;
  • every edit of an ordinary pull request;
  • the draft's title and base edits, merged #A included;
  • pushes, closed, and the other jobs.

onboard. It adds the skip to a niyam.yml and a caller written before this, and says so in the plan (skips Mergify's queue-draft edits) and in the pull request. It reads 0.7.20's caller (CALLER_0720, recorded from this repository's own) as its own, with older: true.

README: the paragraph One run per draft head (#685), under Mergify's merge queue.

Beyond the slice's shape: src/guard-caller.ts gets its own suite, src/guard-caller.test.ts. Before this, the mutation gate never judged the file. callerAt and pushBranch now read YAML without the guards that the whole-template comparison already makes, so no equivalent mutant survives. What they accept is unchanged: the onboard and doctor suites pass as they were, and the new suite covers each shape they refuse.

Evidence

  • pnpm check exits 0 on this head: 2935 src tests and 138 scripts tests. guard-caller.ts and queue-draft.ts are at 100% lines, branches and functions.
  • pnpm exec agnipariksha --lane src --files src/guard-caller.ts,src/queue-draft.ts --no-reuse: 228 killed of 228, 0 blocking.
  • pnpm exec agnipariksha --lane src --files src/onboard.ts --no-reuse exits 1: 320 blocking of 3172. All 320 are in lines after 703, the part of onboard.ts no sweep slice has covered yet. Lines 1–703, which hold the template change (514–522), have 0. None of the 320 is on this pull request's other changed lines (619, 909–913, 947, 1425, 1450).
  • src/queue-draft.test.ts evaluates both if:s as GitHub does (its expression rules, read 2026-11-26):
    • a body edit of the draft is skipped;
    • each identifying condition failing alone runs: author, type, branch, fork, no head repository, a title change, merged #A, a base change, the deep-stack title;
    • opened, synchronize and reopened run, and so does an ordinary pull request's edit;
    • closed still skips the niyam job, and push still runs it.
  • Not linted with actionlint, because a hook here refuses to run it. niyam.yml's new if: runs for real on athya_mono's onboard pull request. The caller's runs from main, so its first proof is the first niyam-guard / judge run after that onboard merges.

Slice: #685

🤖 Generated with Claude Code


Summary by cubic

Stops over-running niyam's checks and Guard on every edit of Mergify's queue draft, so the draft is checked once per head instead of once per edit.

  • Skips the niyam and niyam-guard caller jobs on a draft edit that changes neither title nor base, with the identifying conditions (author, branch, repo) and an exception for deep-stack titles; the expression lives once in src/queue-draft.ts.
  • GitHub reports a skipped caller job as niyam or niyam-guard alone, never as niyam / PR identity or niyam-guard / judge, so the draft's last verdict stands.
  • shared-guard.yml's judge gets no skip: a skipped judge would pass the required check over a refusal.
  • onboard adds the skip to older workflows and callers it rewrites, and says so in the plan and PR body.
  • guard-caller.ts gains a test suite, and callerAt and pushBranch now parse YAML without redundant guards.