FN-6255: redirect tmpdir mkdtemp calls in tests

Keep test-created temp directories under the Fusion worker root.

- Redirect fs.mkdtemp and fs.promises.mkdtemp prefixes rooted at the OS temp dir into per-process worker sinks.
- Sweep stale redirect sinks and clean current-process sinks on exit.
- Add regression coverage for sync, async, realpath, nested, and Buffer prefix behavior.
- Remove the restored merger file-scope invariant test from quarantine.

Files changed:
 packages/core/src/__test-utils__/vitest-setup.ts   | 119 +++++++++++++++++++--
 .../__tests__/vitest-setup-tmp-redirect.test.ts    |  68 ++++++++++++
 scripts/lib/test-quarantine.json                   |   5 -
 3 files changed, 181 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-6255

Fusion-Task-Lineage: 4cc855c6-37dd-4dfb-a545-1fd1885779c4
This commit is contained in:
gsxdsm
2026-06-11 12:11:37 -07:00
parent c285f3fb88
commit 2add48c8b6
3 changed files with 181 additions and 11 deletions

View File

@@ -11,11 +11,6 @@
"reason": "Flake: vi.mock('node:child_process') occasionally doesn't take under workspace-concurrent runs, letting real git binary leak and report staged files unrelated to test scope (trips FileScopeViolationError). Same logic covered by real-git fixture tests in reliability-interactions/workflow-and-file-scope. FN-6206.",
"quarantinedAt": "2026-06-10"
},
{
"file": "packages/engine/src/__tests__/merger-file-scope-invariant.test.ts",
"reason": "Flake: same mock-contention mode as the sibling changeset-file test above (vi.mock('node:child_process') not taking under concurrent load). FN-6206.",
"quarantinedAt": "2026-06-10"
},
{
"file": "packages/engine/src/__tests__/merger-ai-cleanup.test.ts",
"reason": "Flake observed during FN-6206 verification: `pruneExistingAiMergeWorktrees skips active-session paths` failed in full `pnpm --filter @fusion/engine test` runs while the file passed standalone, indicating suite-order/concurrency sensitivity. Follow-up FN-6207.",