āœ… test(agnipariksha): the vanished-temp-directory test owns its TMPDIR

Merged
AT
8d ago
+20-5

Slice: #324

Work item: #238. Lands before #287's pre-push hook line is switched on and before the Mutation check is made required.

What

packages/agnipariksha/src/cli.test.ts, test "a run whose temp directory vanished refuses, whatever it exited with": it now sets TMPDIR, TEMP and TMP to a directory it makes with mkdtemp before it calls spawnStryker, restores the three variables in a finally, and removes the directory itself. Test file only; cli.ts is unchanged.

Why

The test's child runs rmSync(process.env.TMPDIR, { recursive: true }). A mutant that empties scratchTmpEnv drops the scratch variables from spawnStryker's child environment, so the child got the test's inherited TMPDIR. Under agnipariksha's own lane, that is the gate's own scratch, so the lane refused with "temp directory vanished" whenever cli.ts was a target.

Mutant still killed

I applied the mutant by hand (scratchTmpEnv returning {}) and ran the test with TMPDIR/TEMP/TMP pointed at a stand-in for the gate's scratch (.tmp/outer-tmp):

testresultstand-in scratch after
main'sfails (scratchTmpEnv('/s') is {})deleted
this PR'sfails (scratchTmpEnv('/s') is {})survives, empty

So the mutant is still killed, and it no longer deletes anything outside the test's own directory. I did not run agnipariksha's lane on cli.ts, because that lane needs #287's config, which has not merged.

Checks

  • pnpm --filter @veda-hq/agnipariksha check passes
  • root pnpm check passes

No release: veda's lane mutates the source tree.

šŸ¤– Generated with Claude Code


Summary by cubic

Makes the vanished-temp-directory test in packages/agnipariksha own its temporary directory instead of inheriting the runner's, so a mutant that drops scratch vars from the child environment can no longer delete the gate's scratch during the test. The test now sets TMPDIR, TEMP, and TMP to a directory it creates with mkdtemp, restores them afterwards, and removes the directory itself; the scratch assertion still kills the mutant.