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

@@ -122,7 +122,6 @@ describe("FN-5279 reliability interactions: merge reuse task worktree", () => {
try {
const rootHeadBefore = git(rootDir, "git rev-parse HEAD");
const rootTrackedStatusBefore = git(rootDir, "git status --porcelain --untracked-files=no");
const result = await aiMergeTask(store, rootDir, task.id);
expect(result.merged).toBe(true);
@@ -141,9 +140,12 @@ describe("FN-5279 reliability interactions: merge reuse task worktree", () => {
const advanced = audits.find((event) => event.mutationType === "merge:integration-ref-advance");
expect(advanced?.metadata).toMatchObject({ advanceMode: "update-ref", succeeded: true });
expect(git(rootDir, "git rev-parse HEAD")).not.toBe(rootHeadBefore);
const rootTrackedStatusAfter = git(rootDir, "git status --porcelain --untracked-files=no");
expect(rootTrackedStatusAfter).not.toBe(rootTrackedStatusBefore);
expect(rootTrackedStatusAfter).toContain("fn-5279-ri-happy.ts");
// 4c31e885b (engine auto-sync) keeps the project root's working tree
// in step with the advanced ref, so the new file is a tracked, clean
// path at HEAD rather than appearing as a dirty/untracked entry. Verify
// landing via `git ls-files` (commit-reachable) instead of `git status`.
const rootLsFilesAfter = git(rootDir, "git ls-files");
expect(rootLsFilesAfter).toContain("packages/engine/src/fn-5279-ri-happy.ts");
} finally {
await fixture.cleanup();
}