chore(test-isolation): detect live engine lock + prune stale tests

Three coupled fixes to make `pnpm test:full` exit cleanly when the local
`fn` dashboard is running:

1. scripts/check-test-isolation.mjs — replace timing-based "is the
   engine writing?" heuristic with a deterministic check: if
   `.fusion/engine.lock.lock/` exists (proper-lockfile's held-lock
   marker), the dir is engine-active and auto-skipped from violation
   reporting. The 2-second mutability probe is retained as a backstop
   for dirs with another external writer but no live lock. Also adds
   `engine.lock` / `engine.lock.lock/` to RUNTIME_IGNORE_PATTERNS so
   a mid-test engine start/stop doesn't trip the signature compare.

2. packages/dashboard/.../__tests__/GitManagerModal.test.tsx — prune
   the Status-panel Sync button + Recent-advances-events describe
   blocks. Their UI was removed in 5d35b64bd ("remove duplicate
   integration-advances UI") but the tests stayed and were timing
   out at 1s each. The Remotes-panel Sync describe is kept because
   the `remotes-sync-integration-tip-btn` still exists.

3. packages/engine/.../merge-reuse-task-worktree.slow.test.ts —
   update the happy-path assertion to reflect 4c31e885b
   ("merger auto-syncs project-root checkout after ref advance").
   Before that change, the merger's `update-ref` advance left the
   project root's working tree stale, so `git status --porcelain`
   would differ after the merge. With auto-sync, the new file is
   tracked + clean at HEAD, so status doesn't change. Verify the
   file actually landed via `git ls-files` instead.

After this, `pnpm test:full` exits 0 with the local dashboard running.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-23 20:18:08 -07:00
parent 0c0839eeb6
commit b8919b7bb4
4 changed files with 76 additions and 361 deletions

View File

@@ -0,0 +1,11 @@
---
"fusion-workspace": patch
---
chore(test-isolation): detect live engine via lock-held marker instead of timing probe
`scripts/check-test-isolation.mjs` previously relied on a 2-second post-test mutability probe to distinguish "tests wrote `.fusion/`" from "the local dashboard is running and writing `.fusion/`". When the engine's heartbeat happened to land outside the probe window, the script flagged the user's live engine as a test pollution violation and failed `pnpm test:full` with exit 1 despite every test suite passing.
Now the script first checks for `engine.lock.lock/` (the proper-lockfile directory the engine creates while holding the singleton lock). When present, the `.fusion` dir is auto-marked externally-active and skipped from violation reporting — race-free, no timing window. The mutability probe is retained as a backstop for dirs without a live lock but with another external writer.
Also added `engine.lock` and `engine.lock.lock/` to `RUNTIME_IGNORE_PATTERNS` so a mid-test engine start/stop doesn't trip the signature comparison on its own.