⨠feat(mutation): a surviving mutant blocks the push and the pull request, now the sweep is done
Slice: #706
The sweep (#580) killed every existing mutant, so the mutation gate now blocks. A Survived or NoCoverage mutant in a changed file refuses the push in pre-push and fails CI's Lane job. This is the last slice of #580. Alok approved it with š on the proposal (https://github.com/veda-hq/niyam/issues/706#issuecomment-7208860995, page https://claude.ai/artifact/TiBaSNXb2AorqDt73EqL7Y).
What changes
.github/workflows/mutation.yml: exit 1 fails the lane, as exit 2, a refusal, already did. The "reported, not blocking, until the sweep ends" warning and comment are gone..githooks/pre-push: amutationstage afterpinsand beforeniyam, as veda's hook has it:"$root/node_modules/.bin/agnipariksha" --tracked-only --pushed-refs --base "$base" <<< "$refs" || exit 1.released-pinshas already checked the agnipariksha pin above it..dvara.json:mutationis added to the pre-push stage list. dvara 0.8.1 refuses a passing run that marks a stage its list lacks (dvara README, "A stage list"). This file is a guard file, so it was added to #706's Guards: before the proposal.agnipariksha.json:"maxLines": 1500for the config, and1000for thesrclane.scripts/githooks.test.mjs(b0d8355): the throwaway repository it runs the hooks in gets an agnipariksha stand-in, as it has one for niyam. Without it the new stage refused every push there (run 45934273762). Two tests pin the stage: its arguments with git's refs on stdin, and that its exit 1 refuses before niyam runs.pnpm test:scripts: 209/209. This is a guard file #706 doesn't name yet; the ask is at https://github.com/veda-hq/niyam/pull/708#issuecomment-7209109309.
maxLines: what agnipariksha 0.8.8 does, and the values chosen
Read from the pinned package: node_modules/@veda-hq/agnipariksha/README.md ("The cut-off", "Only what the push carries") and dist/lanes.js overCutoff, 2026-11-27.
- The cut-off is per lane, not per file. It sums every line (blank and comment lines too) of all the lane's changed files. A lane over it is left out of a run that names no lane, and the run still exits 0. A run with
--lane, as CI's matrix uses, judges the lane whatever its size, so CI never skips one. --pushed-refsreads git's ref lines. It refuses (exit 2) a push of anything but the checked-out HEAD, or a push from a dirty tracked tree. It judges nothing for a deletion or an up-to-date push.
Values, aiming for a push to wait a few minutes at most:
src: 1000. On CI, the agnipariksha step on the sweep's own runs cost 0.12 to 1.8 s a line (e.g. onboard.ts 2269 lines in 2233 s, work.ts 1421 lines in 1098 s, issue-types.ts 627 lines in 119 s). Locally,src/board.ts(870 lines, 1070 mutants) took 65 s on an 18-core machine. At 1000, every src file exceptonboard.ts,work.tsandpr-autocreate.ts, the slowest per line, is judged before the push. It matches veda's sarathi lane.scripts: 1500, from the top level, which matches veda's. The lane's five files hold 1490 lines in all and cost 0.08 to 0.26 s a line on CI, so it is always judged locally.- A branch whose changed
srcfiles sum past 1000 lines (sayboard.tsplusowner-step.ts, 1689) is left to CI. For such branches the required check is the real gate.
Proof
Three throwaway commits, now reverted in 2ae6492, showed the gate both ways: majorOf in src/version.ts with a weak test, then a test that kills it.
-
CI's
Lane (src)fails on the survivor at a7d3047: run https://github.com/veda-hq/niyam/actions/runs/45933705251agnipariksha: src: stryker run --mutate src/version.ts INFO Instrumenter Instrumented 1 source file(s) with 49 mutant(s) Survived src/version.ts:21 (Regex) Survived src/version.ts:21 (Regex) Survived src/version.ts:21 (Regex) Survived src/version.ts:21 (Regex) Survived src/version.ts:21 (StringLiteral) Survived src/version.ts:21 (Regex) src: 43 killed of 49 in 1 file(s) (43 Killed, 6 Survived; 0 timeout(s) retried) - 6 blocking agnipariksha total: 43 killed of 49 in 1 lane(s), 6 blocking, 0 refused - exit 1 ##[error]a mutant no test kills is left in a changed fileMutationthen fails too: "the lane jobs did not all pass (failure)". -
This branch's pre-push refuses a push that still leaves the survivor (316fd85):
$ .githooks/pre-push origin https://github.com/veda-hq/niyam.git <<< 'refs/heads/claude/gate-706-7a79e3 316fd85f864c00838e08c37dcb8438036dbb5118 refs/heads/claude/gate-706-7a79e3 a7d304713db1b9243b7712cf5f7ebd8ed5d99d7c' ā records: 5 file(s) checked, 0 legacy finding(s) held by .dvara/records-baseline.json (115 ms) ā frozen: no paths are frozen agnipariksha: src: stryker run --mutate src/version.ts Survived src/version.ts:21 (Regex) Ć5 Survived src/version.ts:21 (StringLiteral) src: 43 killed of 49 in 1 file(s) (43 Killed, 6 Survived; 0 timeout(s) retried) - 6 blocking scripts: nothing to judge - not run agnipariksha total: 43 killed of 49 in 1 lane(s), 6 blocking, 0 refused - exit 1 pre-push exit 1The hook was run as git runs it, with the push's ref line on stdin. A real
git pushfrom an agent worktree runs the main checkout's.githooks, becausecore.hooksPathis one setting per clone (scripts/hooks-path.mjs), and repointing it for one push is blocked here. So the stage takes effect on pushes once the main checkout's copy has it, after this merges and the main checkout updates. -
The same change passes once a test kills the mutants (e842bfe):
src: 49 killed of 49 in 1 file(s) (49 Killed; 0 timeout(s) retried) - pass scripts: nothing to judge - not run agnipariksha total: 49 killed of 49 in 1 lane(s), 0 blocking, 0 refused - exit 0 pre-push exit 0CI:
Lane (src),Lane (scripts)andMutationpassed, run https://github.com/veda-hq/niyam/actions/runs/45934005932
Typecheck, test, build failed on those proof heads only because of shuddhi's strict-scalar-parse on majorOf's Number(...). The revert removes it.
After the merge: @AlokBansal8, please add Mutation to main's ruleset as a required check. Until then a red Lane does not hold a merge, and a change over a cut-off is blocked nowhere. Only you change the ruleset.
Not here: new tests or sweeps, and a mutation gate for repositories niyam onboards.
š¤ Generated with Claude Code