⨠feat(pr-signals): say whether CI is green, by the required checks' newest runs
Merged
AT
2d ago+728+728+012345678901234567890123456789-72-72-01234567890123456789
Slice: #694
niyam pr-signals <pr> now says whether CI is green, and never says so below the minimum. This is slice 1 of #693's spec v1. Alok approved it with a š on its Proposal: comment.
Change, all in src/pr-signals.ts, its test and README.md:
cigainsverdict,requiredandminimum.verdictis one ofgreen,pending,failed,conflicted,shortandunjudged, judged in that slice's order. When the rules cannot be read, it isunjudgedwithreason.- The required checks come from
GET /repos/{o}/{r}/rules/branches/{base}on the pull request's ownbase.ref, every page, each part of the branch encoded, asscripts/guard.mjsreads them. A refusal or an answer it cannot read isunjudged, never "no required checks". Guard's ownSHARED_CHECKis not added: only the rulesets decide. - The newest run of each name and app decides. "Newest" is the highest check-run id. A rule's
integration_idis matched against the run'sapp.id. A commit status counts by its context.success,neutralandskippedpass. - Without a ruleset, every name and status on the head decides.
"signals": { "minCheckRuns": N }sets the floor: runs that finished and were not skipped. Without it, the floor is one GitHub Actions run that was not skipped.signalSettingsaccepts the key as a whole number from 1. - A failing signal whose newest run of the same name and app passed carries
superseded: true. Whendedupefolds copies, the signal stays superseded only if every copy was. - One line on standard error for any verdict but green. It replaces
ciWarning's two warnings and names what failed, is missing or still runs. The exit code stays 0.
Choices the slice left open:
- A
mergeable_stateGitHub gives no value for (null) is read likeunknown, so it ispending. - A run counts as finished only when its
statusiscompleted. A run with no status is still going. - When the verdict is
unjudged,requiredis[]andminimumissettingsordefault, since no ruleset was read.
Evidence:
- The fixtures follow real answers read on 2026-11-27. niyam
main's rules name 7 checks, each with anintegration_id(15368 for Actions, 1082092 for Cubic). #692's head has 48 runs, two of themniyam-guard / judge: 140086611192 from the first push's suite, and 140086934755 from a later one. GitHub hands out run ids as runs are created, so the highest id of a name is the newest run. - A real read, run from a veda worktree with this branch's build (
pnpm exec node .tmp/niyam/dist/cli.js pr-signals 654 --ci-only) against https://github.com/veda-hq/veda/pull/654 while its CI ran. It read vedamain's 10 required checks from the ruleset.Typecheck, test, buildwaspending,Mutationmissing(it waits on its lanes), and the rest passed (cubicasneutral). The verdict waspending, and standard error gotā CI on #654 is pending: "Lane (dvara)", "Typecheck, test, build" still running on 67dfda4ā¦. It exited 0. - Mutation:
pnpm exec agnipariksha --lane src --files src/pr-signals.ts --no-reusekilled 1041 of 1041 mutants. The first run left 12 alive and the second 2. Each one was a literal or test that nothing read, and both are fixed in the code. pnpm checkexits 0, with 3227 of 3227 and 207 of 207 tests passing.
Guards: none. No guard file changes. .github/niyam.json and onboard are untouched.
š¤ Generated with Claude Code
Summary by cubic
niyam pr-signals <pr> now says whether CI is green, judging the base branch's rulesets' required checks by each one's newest run.
cigainsverdict(green,pending,failed,conflicted,short,unjudged),requiredandminimum, plusreasonwhen unread.- Required checks come from
GET /repos/{owner}/{repo}/rules/branches/{base}; a refusal isunjudged, never "no required checks". - The newest run of each name and app decides;
success,neutralandskippedpass, and a run counts as finished only when itsstatusiscompleted. - Without a ruleset, every run and status on the head decides, with
"signals": { "minCheckRuns": N }as the floor, else one GitHub Actions run that was not skipped. - A failing signal whose newer run of the same name and app passed carries
superseded: true, anddedupekeeps it only when every copy is superseded. - Standard error gets one line for any verdict but
green; the exit code stays 0.