Skip to content

fix(tests): isolate fast-jev no-key test's cwd - #83

Merged
Ivory2024 merged 1 commit into
mainfrom
fix/jev-no-key-test-isolation
Oct 4, 2026
Merged

Ivory2024 merged 1 commit into
mainfrom
fix/jev-no-key-test-isolation

Conversation

@Ivory2024

@Ivory2024 Ivory2024 commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Intent

fix(tests): isolate fast-jev no-key test's cwd. Give the no-key fallback test its own temporary working directory with reliable cleanup so it does not share process.cwd() with other tests in the file. Preserve the existing behavior assertions and ensure the fast-jev no-key path makes no network request.

What Changed

  • tests/fm-jev-hook-guards.test.mjs: fast-jev no-key fallback test now creates its own temp directory via mkdtemp and passes it as session.cwd() instead of sharing safetyRoot with other tests in the file.
  • Wraps the test body in try/finally, removing the temp directory with rm(root, { recursive: true, force: true }) after assertions run.
  • Preserves existing assertions (fallback triggered, zero network requests) unchanged.

Risk Assessment

✅ Low: Single test file change: no-key test now gets its own mkdtemp'd cwd with try/finally cleanup via rm, preserves existing assertions (fallback true, zero requests), imports already present, matches stated intent exactly with no scope creep.

Testing

Ran fm-jev-hook-guards.test.mjs live at target commit: no-key test passes, asserts fallback true and requests 0, uses isolated tmpdir cleaned via finally/rm, confirmed no leftover dirs. 4 other tests in file fail but reproduced identically at base commit before this change, so unrelated pre-existing issues, not caused by this fix.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
no-key fallback test runs in its own tmpdir and cleans up ✅ pass live node --test tests/fm-jev-hook-guards.test.mjs -> ok 1 - fast-jev falls back without a key and sends no request; ls -la after run shows no leftover .fast-jev-no-key-test-* dir
behavior assertions preserved: fallback true, zero network requests ✅ pass live Same test run; assert.equal(fallback,true) and assert.equal(requests,0) both pass (test 1 ok)
cwd isolation: no-key test no longer shares safetyRoot=process.cwd() with sibling tests ✅ pass live grep of test file: no-key test (lines 40/56) uses its own mkdtemp/rm pair, distinct from safetyRoot used by other tests at lines 129,151,193,219,248,271
pre-existing unrelated failures in same file are not caused by this change ✅ pass live Reverted just this test file to base commit 7e5c4fd and reran: tests 6,7,10,11 fail identically, confirming they predate this fix; restored target-commit file afterward, worktree clean

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
no-key fallback test runs in its own tmpdir and cleans up ✅ pass live node --test tests/fm-jev-hook-guards.test.mjs -> ok 1 - fast-jev falls back without a key and sends no request; ls -la after run shows no leftover .fast-jev-no-key-test-* dir
behavior assertions preserved: fallback true, zero network requests ✅ pass live Same test run; assert.equal(fallback,true) and assert.equal(requests,0) both pass (test 1 ok)
cwd isolation: no-key test no longer shares safetyRoot=process.cwd() with sibling tests ✅ pass live grep of test file: no-key test (lines 40/56) uses its own mkdtemp/rm pair, distinct from safetyRoot used by other tests at lines 129,151,193,219,248,271
pre-existing unrelated failures in same file are not caused by this change ✅ pass live Reverted just this test file to base commit 7e5c4fd and reran: tests 6,7,10,11 fail identically, confirming they predate this fix; restored target-commit file afterward, worktree clean
  • node --test tests/fm-jev-hook-guards.test.mjs (target commit 52662121)
  • node --test tests/fm-jev-hook-guards.test.mjs (base commit 7e5c4fd0, same file reverted) to isolate pre-existing failures
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Prevents the no-key fallback test from sharing process.cwd() with other
fast-jev tests via session.cwd(), the same isolation pattern already used
by the with-key test.
@Ivory2024
Ivory2024 merged commit 32c491c into main Oct 4, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant