✨ feat(agnipariksha): --pushed-refs judges only a push of HEAD, and cli.ts passes its lane, 0.8.5
What
agnipariksha --pushed-refs reads git's pre-push ref lines (<local ref> <local sha> <remote ref> <remote sha>) on stdin. It refuses the run, before the machine lock and judging nothing, when:
- a pushed local sha is not the checked-out
HEAD. The refusal names the ref and says to check it out and push again. An annotated tag atHEADpasses. - a tracked file differs from
HEAD, staged or not. The refusal names the files and says to commit or stash them, then push again.
A line whose local sha is all zeros is a deletion, and is skipped. A push that carries no commit, with deletions only or no lines at all, judges nothing and exits 0: git runs the hook with no lines for an up-to-date push, which I checked on a scratch repository. A line not in git's shape refuses. With every pushed ref at HEAD and a clean tracked tree, the run is the same as without the flag.
The logic is in src/pushed-refs.ts, with its own suite, including a test against a real git repository. cli.ts parses the flag and reads stdin.
Version 0.8.5, not a minor. The README's version rule allows a minor only after x.y.20, and v0.8.4 is the latest tag, so the next legal version is 0.8.5.
The cli.ts cleanup, folded in
#287's pre-push gate judges a touched file whole. cli.ts is under the lane's 1,500-line cut-off, and it had 54 Survived and 15 NoCoverage mutants on lines #411 never touched. So the flag could not be pushed until they were cleared. Alok chose to fold that cleanup into this pull request ("Fold into this PR", in the session on 2026-11-22) rather than give it a slice of its own (#419, which this pull request closes as superseded).
Stryker on src/cli.ts alone (stryker run --mutate src/cli.ts --concurrency 8, owning suite cli.test.ts):
| Killed | Survived | NoCoverage | Timeout | Time | |
|---|---|---|---|---|---|
| before | 422 | 53 | 15 | 15 | 55 s |
| after | 450 | 0 | 0 | 8 | 59 s |
Timeouts count as caught, and how many mutants time out varies with load: 5 in one run, 8 in the latest. The hook's own line, agnipariksha --tracked-only --base origin/main, judges changed-files.ts, cli.ts and pushed-refs.ts together. On the push of this branch it judged 590 of 590 killed, with 2 Timeouts and 7 retried within budget, nothing blocking and nothing refused, in about 6 minutes. An earlier push, before the bootstrap capture fix, was refused on the retry budget.
What changed:
- The entry. It moves behind an exported
entry(proc), tested with a fake process, andsrc/bin.tsonly calls it. Thebinis nowdist/bin.js.bin.tshas no logic and no suite, so the gate reports it as "not judged (no colocated suite)".- Before this change, a mutant of the old
isEntryguard ran a real gate on import: one did during a hand run of Stryker here. - Every caller I found in veda and athya_mono runs the
agniparikshabin throughpnpm exec, and none runsdist/cli.jsby path.
- Before this change, a mutant of the old
- The argument loop steps with
argv.entries(), so no mutant can make it spin. - Code no test could tell apart is gone, none suppressed:
- the tee's tail window, since markers are now matched per line and each marker is one line;
- the over-long-line flag;
- defaults that cannot apply;
--files's unused base;- an owner check that could not fail.
- Hanging mutants. The tests that spawn a process, take the real lock or sleep get a 15 s
timeout. A mutant that never settles then fails well inside its 180 s retry instead of using up the retry pass's 15-minute budget.- The existing bootstrap test discarded stdout while it ran. Under a lock mutant it waited on its own lock with stdout discarded, so the failure an earlier test had reported never reached the runner and its bail never fired: three retries ran their full 3 minutes and the first push was refused. That capture now passes the writes through.
- Hand-applying a hang mutant now gets a failure reported at once.
- New tests cover the tee to the gate's stdout, inherited stdin, a partial last character, a temp directory with files left in it,
stopAllon a live run,realDeps's real-filesystem paths andbootstrap's refusal outside a repository.
cli.test.ts changes only by additions, except two parts:
- the
isEntrytest goes with its function, replaced by theentrytest; - the existing tests that spawn a process, and the bootstrap tests, gain the timeout option, and the bootstrap test's stdout capture passes the writes through.
The first lane run here also refused for a second reason: its timeout retry pass ran past the 15-minute budget. With 15 Timeouts, most of them hangs, it could never fit. A concurrency cap in stryker/lane.mjs is a change of its own, left as a follow-up.
The pre-push hook
Agents do not edit .githooks/. Once this is released and veda's pin moves to it, the hook change for Alok goes in the pin-bump pull request.
Slice: #411
🤖 Generated with Claude Code
Summary by cubic
Adds --pushed-refs, which reads git's pre-push ref lines on stdin so the gate judges only a push of the checked-out HEAD from a clean tracked tree. Bumped to 0.8.5, with the bin moved from dist/cli.js to dist/bin.js.
New Features
- Refuses with exit 2, before the machine lock, when a pushed ref isn't
HEADor a tracked file differs fromHEAD, naming the ref or files. - A line not in git's shape refuses — an empty ref or a remote sha that isn't hex included. An annotated tag at
HEADpasses, and deletion lines are skipped. - A push with no commits (deletions only, or no lines) judges nothing and exits 0.
Refactors
- A hook has to pass
--pushed-refsand its ref lines itself; nothing turns it on for one. cli.tsnow passes its own mutation lane: the entry moves behind an exportedentry(proc)in the newsrc/bin.ts, so importingcli.tsstarts nothing, and thedist/bin.jssubpath is blocked inpackage.json.- Removes code no test could tell apart, and gives process-spawning tests timeouts so a hung mutant fails fast.