✨ feat(veda): veda's own mutation gate, one tap lane per package
Slice #272 under #238. Alok settled questions 1 and 2 on 2026-11-19: the gate uses the tap runner on node:test as the suites are written, and small lanes are judged at pre-push.
Where it stands (2026-11-22). Nothing waits on Alok now:
- #324, the
cli.test.tsfix (below), is onmainthrough #412 (8bc1428). - Alok committed the pre-push stage to this branch as de661e8. That is the three changes under "For Alok", and they match the copies tested in
scripts/githooks.test.mjsbyte for byte. - Alok approved the pull request as code owner, since
eslint.config.jsis a code-owner path. - niyam's Guard needs a guard file named in its slice, so #272 now has a Guards: line naming
.githooks/pre-pushand.dvara.json. Alok approved #238 again after that edit. - aa7cefb makes every lane skip Stryker's tsconfig rewrite. See "Found: a hoisted TypeScript 7 crashes every lane" below.
Auto-merge is on. aa7cefb was checked in a worktree that has the stale TypeScript link, and the lane ran there with no crash.
The cut-off
maxLines is 1,500, with 1,000 for sarathi and 400 for pariksha. It was timed on 2026-11-20 on Alok's Mac, an 18-core M5 Max: load was 1.9 and 2.9 before the two batches, and 2.95 of 4 GiB of swap was in use. A linked session was pushing a fix during the pariksha run. The samples are CI's from #238.
The aim was about 3 minutes per lane, below the 5 minutes recorded on #238. I set it lower so that a push still finishes when the Mac is busy, which made the pariksha pair 3.6 times slower. The number is Alok's to change.
| Lane | Lines | Mutants | Time | s/line | Blocking (CI's) |
|---|---|---|---|---|---|
| kavach | 693 | 609 | 26 s | 0.04 | 10 (10) |
| shuddhi | 350 | 330 | 16 s | 0.05 | 52 (no CI sample) |
agnipariksha, cli.ts left out | 584 | 718 | 7 s | 0.01 | 43 |
| dvara | 514 | 476 | 56 s | 0.11 | 55 (54) |
| sarathi | 311 | 385 | 57 s | 0.18 | 78 (78) |
| pariksha | 739 | 1,049 | 6.6 min | 0.54 | 128 (128) |
- Verdicts. Every lane CI also sampled blocked on the same count as CI, except dvara, which blocked on one more.
- Retries. Retrying timed-out mutants is much of the slow lanes' time:
- kavach, shuddhi and agnipariksha retried none;
- dvara retried 9, in about 22 s;
- sarathi retried 3, one of them 41 of its 57 s, so its 1,000 rests on that one mutant;
- pariksha retried 25, in 2.7 of its 6.6 minutes. It ended with 2 timeouts, the same as CI with 4 runners, so 17 runners here probably caused the other 23.
- The cut-off in a real run.
--files <the pariksha pair>,packages/kavach/src/rule-checks/spawn.ts --tracked-onlyjudged kavach's file. It left pariksha's 739 lines to CI withover its cut-off of 400, and exited 0. - pariksha mostly goes to CI. Its
cli.tsalone is 1,264 lines.
Found: agnipariksha's own lane can't judge its cli.ts. With cli.ts among the targets, the run is refused because its temp directory vanished.
- The cause.
cli.test.ts:529, "a run whose temp directory vanished refuses", has a child process deleteprocess.env.TMPDIR. A mutant that drops the scratch variables fromspawnStryker's child environment makes that child delete the gate's own scratch directory instead. The guard did its job, since under the shared temp directory that mutant would have removed other processes' files. - The fix is in the test. It should set
TMPDIRto a directory it owns before callingspawnStryker. Then that mutant deletes only the test's directory, and the test still kills it. - It must land before the hook line. With the hook on, any push touching
packages/agnipariksha/src/cli.tsis refused, and #273's agnipariksha job would refuse the same way. A fix insidecli.tsitself couldn't pass the hook, which is another reason the fix belongs in the test. That fix is #324, which #412 merged on 2026-11-22. - After #324. The #324 session ran
--lane agnipariksha --files packages/agnipariksha/src/cli.tson a merge of this branch. There was no temp-directory refusal, and the scratch-environment mutants were killed. The run counted 398 killed of 467: 54 Survived and 15 NoCoverage, mostly lines 444 to 451, so once the hook is on, the next push touchingcli.tsmeets 69 old blocking mutants (#411 touches it). Under load 17 to 22, its timeout retries also passed their 15-minute budget, and it was refused for that.
Found: a hoisted TypeScript 7 crashes every lane. To rewrite a lane's tsconfig.json for the sandbox, Stryker runs import('typescript'), and it declares no dependency on typescript.
- Who has the link. The main checkout and eight worktrees have a hidden hoist link,
node_modules/.pnpm/node_modules/typescript, to TypeScript 7.0.2, all dated Nov 14. - Why it crashes. TypeScript 7.0.2 has no
parseConfigFileTextToJson, so Stryker fails before its first mutant withts.parseConfigFileTextToJson is not a function. - Not every checkout. A worktree installed later, like this one, has no such link and never sees the crash.
- Why it matters. With the hook on, it would refuse every push from those checkouts that touches a lane source.
- The fix, aa7cefb.
stryker/lane.mjssetstsconfigFileto a file that never exists, so the rewrite is skipped. - Why nothing is lost. No lane needs the rewrite: the suites run on node:test, which reads no tsconfig, and none reads its package's
tsconfig.json. shuddhi has notsconfig.json, so the rewrite never ran there. - The link itself goes only with a clean reinstall.
pnpm install --forcekeeps it, and that's Alok's to do, since agents can't touchnode_modules/.
What changes
-
Pins. The root pins
@stryker-mutator/coreand@stryker-mutator/tap-runnerat 10.1.1, and@veda-hq/agniparikshaat 0.7.9, the release with the cut-off (#278). -
agnipariksha.json:- Lanes. One per TypeScript package: agnipariksha, dvara, shuddhi, kavach (its TypeScript only; #271 times a Python tool for the rest), pariksha and sarathi.
packages/needs-youis a plugin, not a workspace package: it has nosrc/, and its tests sit intests/, not beside the sources. So it gets no lane. - What each lane mutates. Its
src/, leaving out tests,.d.tsfiles and fixtures. shuddhi's sources are.js, so its lane takes.jsand.ts. - Environment.
unsetEnvremoves theGIT_DIRfamily from every Stryker run, because a hook exports it (docs/lessons/stryker.md). - Reuse.
reuseis off for now.
- Lanes. One per TypeScript package: agnipariksha, dvara, shuddhi, kavach (its TypeScript only; #271 times a Python tool for the rest), pariksha and sarathi.
-
stryker/lane.mjsis the config every lane uses:- the
taprunner, with perTest coverage; - the owning suites agnipariksha passes as
{suites}, with the package's prefix cut off; - the json reporter only, since agnipariksha prints each blocking mutant itself.
Each package's
stryker.config.mjsis one line calling it. - the
-
Ignores.
reports/and.stryker-tmp/are ignored by git and by eslint. git also ignorespackages/*/reports/, which a Stryker run straight from a package writes. The eslint ignore is the one line ineslint.config.js, a code-owner path. -
Docs.
docs/lessons/stryker.mdsays how to run one lane by hand.pnpm-workspace.yaml's comment no longer says veda never runs Stryker. -
agnipariksha's smoke test. It now runs
--lane smoke-no-such-lane. It used to expect noagnipariksha.jsonat the root, and veda now has one. It now requires the unknown-lane refusal, which lists veda's lanes, so it checks that the built CLI loads veda's config. The package's version is unchanged, since nothing a consumer runs changes.
What the gate doesn't judge
agnipariksha judges a changed file only when a <stem>.test.ts (or .test.tsx) sits beside it, and says so for any it skips. #274 should count these as unreviewed once Cubic stops reading tests:
- Sources with no owning suite:
- dvara:
head.ts,records/rules.ts,records/types.ts, andsupervisor.fixture.ts, a test helper main added with #383 - pariksha:
git.ts,load-vitest-config.ts,repo-rules-memory.ts - sarathi:
bin.ts,page/protocol.ts,worktree/hook.ts - shuddhi:
index.js,error-handling/index.js
- dvara:
- The scripts.
scripts/*.mjsare tested byscripts/*.test.mjs, which agnipariksha doesn't recognise as an owner, so they get no lane. That needs an agnipariksha change first.
For Alok: the pre-push stage
Done: Alok committed these three changes as de661e8. .githooks/pre-push and .dvara.json are kavach's protected paths, and the test copies both. They still fit main's hook as of the 2026-11-22 merge: the guards stage still comes before niyam's, and .dvara.json still lists ["records", "frozen", "guards", "niyam"].
1. .githooks/pre-push, after the guards stage:
dvara_stage mutation
"$root/node_modules/.bin/agnipariksha" --tracked-only --base "$base" || exit 1
--base "$base"keeps the hook's own fallback toHEADwhenorigin/mainis missing.--tracked-onlyleaves out untracked files, since a push carries none.- Lanes over
maxLinesare left to CI (#273), because the run names no lane. - The pin is already checked. The hook runs
released-pins.mjsfirst, and that checks every@veda-hq/*pin, this one included. - Old survivors refuse pushes. Stryker mutates a touched file whole, so once the hook is on, a push touching a file that already has surviving mutants is refused for mutants it didn't add. kavach's
args.tshas 4 such mutants and dvara'squiet.ts3, and the lanes timed above blocked on 10 to 128 each. Either kill a file's survivors first, or expect its next change to.
2. .dvara.json, where pre-push's stages gain mutation:
"pre-push": ["records", "frozen", "guards", "mutation", "niyam"]
3. scripts/githooks.test.mjs. The fixture copies .githooks and veda's stage list, so the hook would fail there for want of an agnipariksha.
In the fixture setup, beside the niyam stand-in:
writeFileSync(join(repo, 'node_modules', '.bin', 'agnipariksha'), '#!/bin/sh\necho "agnipariksha $*" >> "$AGNIPARIKSHA_CALLS"\n[ -z "${AGNIPARIKSHA_REFUSE:-}" ]\n');
chmodSync(join(repo, 'node_modules', '.bin', 'agnipariksha'), 0o755);
In the env, AGNIPARIKSHA_CALLS: join(scratch, 'agnipariksha-calls').
In the clean-push test:
assert.match(readFileSync(join(scratch, 'agnipariksha-calls'), 'utf8'), /^agnipariksha --tracked-only --base (origin\/main|HEAD)\n$/);
That's HEAD on the fixture's first push, before origin/main exists. Pin it to whichever the test shows.
Then add a test where AGNIPARIKSHA_REFUSE=1 refuses the push.
Checked
- The wiring.
pnpm exec agnipariksha --lane pariksha --files packages/pariksha/src/semver-range.ts,packages/pariksha/src/codec-registry.ts --no-reuseran on this Mac with other sessions working:- The dry run passed on the two owning suites alone.
- The mutants. Stryker instrumented 1,049, the same count as #238's CI run 44507830088, and found the same 3 NoCoverage.
- The blocking set. The gate blocked on 111 mutants, and every one of them is blocking in CI's report too (matched by file, line and mutator). CI blocked on 17 more. Those are most likely mutants that timed out here and were never retried.
- Side effects.
git statuswas clean after the run, andcore.bareis stillfalse. - The repository check.
pnpm checkpasses. - After merging main (2026-11-22, cca8953). Only
pnpm-lock.yamlconflicted. It is now main's lockfile, withpnpm installadding this branch's three root pins. Then:pnpm check,pnpm lintandpnpm guardspass.- The hook's own command,
pnpm exec agnipariksha --tracked-only --base origin/main, finds nothing to judge in any lane and exits 0. This branch changes no lane source. --lane dvara --files packages/dvara/src/liveness.ts --no-reuseruns on a source main added (#383). The tap dry run passed on its suite, and the run took 28 s. It ended 155 killed of 162, with 7 survivors blocking. Those survivors are in main's code, so they show the old-survivors effect above. Once the hook is on, the next push touchingliveness.tsmeets them.git statuswas clean after that run.
- After aa7cefb. The same dvara run on a clean install gives the same verdict, 155 killed of 162, and dvara's
tsconfig.jsonextends a file outside its package. The run in a checkout that has the stale link is below. - The hook itself.
scripts/githooks.test.mjsruns the hook in a fixture repository, and passes with de661e8: 14 of 14. Its two new tests fail against the old hook. This worktree's own pushes ran the main checkout's.githooks, because itsconfig.worktreesets an absolutecore.hooksPath, so they never exercised the new stage.
Load is the open problem
The wiring check's pair run took 24 minutes on a busy Mac and was refused: its timeout retries passed their 15-minute budget, with 17 test runners. pariksha's limit of 400 now sends that pair to CI. But a lane under its limit can still slow the same way when the Mac is busy.
On the quiet Mac the same pair took 6.6 minutes, so load made it 3.6 times slower. Other sessions working is the normal state when an agent pushes, so the cut-off alone won't keep a push quick when the Mac is busy. No concurrency cap was tried: the Mac went back to load 17 before the run. pariksha's 23 retries suggest a cap would help. Try one with concurrency: 8 in stryker/lane.mjs on the pair, then re-derive pariksha's 400. If pushes stall, the next levers are a lower maxLines, or a cap in stryker/lane.mjs.
Pushes also queue. agnipariksha allows one run per machine, across every worktree: a second run waits, and refuses after 30 minutes. With the hook on, sessions' pushes wait behind each other. Behind a 24-minute run, the next push has 6 minutes before it is refused.
Slice: #272
🤖 Generated with Claude Code