✨ feat(ci): niyam runs the mutation gate on pull requests, reporting until the sweep ends

Merged
AT
2d ago
+1801-46

Slice: #581

niyam runs veda's mutation gate, agnipariksha, on its own pull requests, as Alok asked on 2026-11-20 (quoted on #580). For now it reports and does not block. A gate on changed files judges each changed file whole, so until the sweep has killed the old survivors, any change to an unswept file would be held by mutants it did not make.

Auto-merge is off. This adds three devDependencies, which need Alok's yes:

  • @veda-hq/agnipariksha 0.8.8
  • @stryker-mutator/core 10.1.1 (2026-10-23)
  • @stryker-mutator/tap-runner 10.1.1

All three are pinned exactly.

What it does

  • agnipariksha.json has two lanes, src (src/*.ts) and scripts (scripts/*.mjs). Tests, .d.mts files and fixtures are in no lane. Every Stryker run drops the GIT_* variables (as on veda) and GH_TOKEN/GITHUB_TOKEN.
  • stryker/lane.mjs and the two lane configs follow veda's stryker/lane.mjs:
    • the tap runner on node --test, which strips the .ts suites' types itself;
    • per-test coverage;
    • a 90 s timeout floor;
    • no tsconfig rewrite, since the root's TypeScript 7 lacks the API Stryker calls.
  • The scripts sandbox leaves out pnpm-lock.yaml, as veda's does. A mutant that forces own-provenance.mjs's entry guard true then dies on ENOENT instead of calling npm.
  • .github/workflows/mutation.yml:
    • one Lane job per lane runs agnipariksha --lane <lane> --tracked-only --no-reuse against the base branch, plus a Mutation job over both;
    • exit 1, a surviving or uncovered mutant, is a warning until the sweep ends; exit 2, a refusal, fails;
    • the token is read-only (contents: read), with no secrets and persist-credentials: false.
  • .gitignore adds /reports/ and .stryker-tmp/.

Evidence

  • The gate judged one file to the end on this machine: agnipariksha --lane src --files src/release-tag.ts --no-reuse. Excerpt:
    Instrumented 1 source file(s) with 57 mutant(s)
    Initial test run succeeded. Ran 1 tests in 0 seconds (net 133.311084 ms, overhead 536.6889160000001 ms).
    Done in 13 seconds.
      Survived src/release-tag.ts:40 (Regex)
      Survived src/release-tag.ts:40 (Regex)
      Survived src/release-tag.ts:42 (OptionalChaining)
      Survived src/release-tag.ts:42 (OptionalChaining)
      Survived src/release-tag.ts:43 (OptionalChaining)
    src: 52 killed of 57 in 1 file(s) (52 Killed, 5 Survived; 0 timeout(s) retried) - 5 blocking
    exit 1 after 20 s
    
    This shows the tap runner works on niyam's node:test suites: the dry run passed and each mutant was judged. The five survivors are the sweep's to kill.
  • pnpm check locally: exits 0; pnpm test 2189/2189, pnpm test:scripts 138/138, own-provenance verifies agnipariksha 0.8.8 as built and signed by veda's release workflow, and aggregate-gate-needs passes the new Mutation gate (7 workflows).

Not here:

  • the full inventory and the sweep;
  • the pre-push stage;
  • making Mutation blocking;
  • requiring Mutation in main's ruleset (Alok's, once the sweep ends).

This pull request changes no source file under src/ or scripts/, so neither lane has a file to judge here.

🤖 Generated with Claude Code


Summary by cubic

niyam runs veda's mutation gate, agnipariksha, on its own pull requests. A surviving mutant is reported as a warning rather than a failure until the sweep has killed the existing survivors; a refusal still fails. This PR changes no source file, so neither lane has a file to judge here.

Dependencies

  • Adds @veda-hq/agnipariksha 0.8.8, @stryker-mutator/core 10.1.1, and @stryker-mutator/tap-runner 10.1.1, pinned exactly.

.github/workflows/mutation.yml runs one Lane job per agnipariksha lane, judging each changed file whole against the base branch, and a Mutation gate over both. The token is read-only with no secrets and persist-credentials: false. agnipariksha.json defines two lanes, src (src/*.ts) and scripts (scripts/*.mjs), sharing Stryker's tap runner on node --test, per-test coverage, and a 90 s timeout floor. The scripts sandbox omits pnpm-lock.yaml, so a mutant that reaches own-provenance.mjs dies before calling npm. .gitignore adds /reports/ and .stryker-tmp/.