ā test(pariksha): shell-sources tests leave no temp folder behind
Slice: #369
packages/pariksha/src/shell-sources.test.ts now leaves no shell-sources-* folder in its temp directory, so scripts/fresh-tmpdir.mjs no longer reports one. This changes one test file and nothing that ships, so there is no version bump.
What changed
- Fixture git runs with
-c maintenance.auto=false -c gc.auto=0. This was the one pariksha git fixture without those flags. With git ā„ 2.47 (2.54 here), each fixturegit commitstartsgit maintenance run --auto --quiet --detach, which keeps running after the commit returns (GIT_TRACE=2shows it). That child can write into the fixture's.git/objectswhileafterEachremoves it. With the flags set, the trace shows no maintenance child. The selectors under test only run read-only git (ls-files,show,cat-file --batch,diff). - Cleanup no longer depends on
repo.beforeEachrecords eachmkdtempSyncfolder before anything else can throw.afterEachremoves the recorded folders withmaxRetries: 5. A folder it cannot remove stays recorded, and a finalafter()tries again. The oldafterEachremoveddirname(repo), which is'.'whilerepois still unset.
Evidence
The leak was not reproduced locally. I also could not find the CI log that reported /tmp/vt-zSZ6fG/shell-sources-HmmTlG: no CI job on #360's branch that I could reach has it. So which failure mode happened there (a removal that threw ENOTEMPTY, or a folder that survived a clean removal) is not pinned down, and the fix covers both.
- Scratch loop (init, commit, immediate
rmSync), 150 iterations on macOS: 0 leaks, 0 throws. - The original test file under
fresh-tmpdir, 6 copies at once for 5 rounds: 0 of 30 leaked. The fixed file under the same load: 0 of 30. - Injected failures in the fixed file, each run under
fresh-tmpdir: a throwing test body and abeforeEachthat throws right aftermkdtempboth left nothing. - Control: with cleanup skipped,
fresh-tmpdirreported all 36 folders and failed the run. - Untested: the path where
afterEachthrows andafter()removes the folder on retry.
A leak fails every time already. pariksha's test script runs through fresh-tmpdir, which fails a passing run that leaves anything behind. scripts/fresh-tmpdir.test.mjs already covers this: "a passing run that left a path fails with 1 and names it" (line 77) and the spawned-program test (line 241). Per #369, no new test was added for it.
pnpm --filter @veda-hq/pariksha check is green locally: 4006 tests pass and fresh-tmpdir reports nothing.
š¤ Generated with Claude Code
Summary by cubic
Fixes packages/pariksha's shell-sources.test.ts so a passing run no longer leaves a shell-sources-* temp folder behind, which was making fresh-tmpdir fail (part of #369).
- Fixture git runs now pass
-c maintenance.auto=false -c gc.auto=0; otherwise eachgit commitstarts a detachedgit maintenance run --autothat can write into the fixture whileafterEachremoves it. - Cleanup no longer depends on
repo:beforeEachrecords eachmkdtempfolder before anything can throw, andafterEachplus a finalafterremoves the recorded folders with retries.