π fix(test): the mutation gate can judge src/hermetic-git.ts
Merged
AT
14h ago+48+48+01234567890123456789-11-11-01234567890123456789
Slice: #634
The mutation gate can now judge src/hermetic-git.ts. The inventory on #580 could not judge it, because one of its mutants deleted the run's temp directory.
Cause
removeFixtureRoot's test handed it the realtmpdir()and the checkout'sprocess.cwd(), expecting a refusal.- A mutant that broke the refusal check therefore removed the run's temp directory (agnipariksha refused the file) or Stryker's sandbox.
Fix
removeFixtureRoot(path, root = tmpdir())takes the root it judges against. Its callers (doc-numbers,work-item-numberandrenumber-doctests) are unchanged.- The refusal tests now pass only folders they made: a root, a folder beside it, a name that only starts like the root, and a link out of it. Each must be refused with its exact message, and still exist afterwards.
- The check is now one prefix test,
realpath(path)againstrealpath(root) + sep, in place ofrelative()plusisAbsolute(). On POSIX,relative()never returns an absolute path, so theisAbsolutemutant could never be killed. rmSyncdropsforce: true, which theexistsSyncguard above it already made dead.
Evidence
agnipariksha --lane src --files src/hermetic-git.ts --no-reuse
src: 26 killed of 26 in 1 file(s) (26 Killed; 0 timeout(s) retried) - pass
agnipariksha total: 26 killed of 26 in 1 lane(s), 0 blocking, 0 refused - exit 0
- The file has 26 mutants now, down from 32: the rewrite removed six.
pnpm checkpasses locally.
π€ Generated with Claude Code
Summary by cubic
The mutation gate can now judge src/hermetic-git.ts. Previously it refused the file because a mutant that broke the refusal check removed the run's temp directory or Stryker's sandbox.
removeFixtureRootnow takes arootto judge against, defaulting totmpdir(). The refusal tests hand it only folders they created, so a broken check can't touch anything real.- The containment check is now a single prefix test against the realpath of the root plus a separator. A root that already ends in the separator, like filesystem-root
/, is used as is; appending a separator torealpath('/')would yield'//', which no path starts with. rmSyncdropsforce: true, which theexistsSyncguard had made dead.
This resolves the blocker for inventory #634; agnipariksha now kills 27 of 27 mutants in the file, down from 32.