From 0cff2b20b5ea785880ad119dde59e6f011a3f9e1 Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 6 Oct 2026 08:52:35 -0500 Subject: [PATCH] Bind directory lock crash tests to their actual holder --- doc/plans/2026-10-02-pi-production-readiness.md | 6 +++++- packages/adapter-utils/src/directory-merge-lock.test.ts | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/plans/2026-10-02-pi-production-readiness.md b/doc/plans/2026-10-02-pi-production-readiness.md index bcdea590a2d..a74dd0f6f5e 100644 --- a/doc/plans/2026-10-02-pi-production-readiness.md +++ b/doc/plans/2026-10-02-pi-production-readiness.md @@ -44,7 +44,11 @@ full checks and prerequisite reviews pass. No merge or release is authorized. All 92 memory/probe/cleanup tests and 146 sandbox transport controls pass. Adapter-utils and server typechecks pass. Broad transport discovery also ran stale compiled tests from `dist/`; its failures remain retained. The canonical -stable runner excludes `**/dist/**`; current source-only validation is pending. +stable runner excludes `**/dist/**`. The source-only run has 1,421 passes, +11 skips and one crash-helper failure. Its helper launched the holder through +the `tsx` CLI. Direct Node with an imported loader binds SIGKILL and exit to +the actual holder; all 12 lock controls then pass. The original broad failures +remain retained. A complete rerun on the final source is still required. New-head CI, full build/typecheck/tests and new distribution proof remain open. ## Case corrections — 2026-10-05 diff --git a/packages/adapter-utils/src/directory-merge-lock.test.ts b/packages/adapter-utils/src/directory-merge-lock.test.ts index c05305fb8d6..50951579d53 100644 --- a/packages/adapter-utils/src/directory-merge-lock.test.ts +++ b/packages/adapter-utils/src/directory-merge-lock.test.ts @@ -10,7 +10,7 @@ import { afterEach, describe, expect, it, vi } from "vitest"; import { withDirectoryMergeLock, WORKSPACE_RESTORE_LOCK_TIMEOUT_CODE } from "./workspace-restore-merge.js"; describe("directory merge lock process lifetime", () => { - const loader = fileURLToPath(new URL("../../../cli/node_modules/tsx/dist/cli.mjs", import.meta.url)); + const loader = fileURLToPath(new URL("../../../cli/node_modules/tsx/dist/loader.mjs", import.meta.url)); const module = fileURLToPath(new URL("./workspace-restore-merge.ts", import.meta.url)); const directories: string[] = []; const children: ChildProcess[] = []; @@ -38,7 +38,9 @@ describe("directory merge lock process lifetime", () => { } async function holder(target: string, env: NodeJS.ProcessEnv) { - const child = spawn(process.execPath, [loader, "--eval", ` + // Import the loader into the holder itself. The tsx CLI starts another + // process, so killing that launcher need not retire the SQLite lock holder. + const child = spawn(process.execPath, ["--import", loader, "--input-type=module", "--eval", ` import { withDirectoryMergeLock } from ${JSON.stringify(module)}; withDirectoryMergeLock(${JSON.stringify(target)}, async () => { process.send?.("locked"); @@ -115,7 +117,7 @@ describe("directory merge lock process lifetime", () => { } finally { clock.mockRestore(); } // A same-process test alone cannot prove that the OS lock survived: on // POSIX, closing an unmanaged descriptor can drop process-wide locks. - const result = await promisify(execFile)(process.execPath, [loader, "--eval", ` + const result = await promisify(execFile)(process.execPath, ["--import", loader, "--input-type=module", "--eval", ` import { withDirectoryMergeLock, WORKSPACE_RESTORE_LOCK_TIMEOUT_CODE } from ${JSON.stringify(module)}; const now = Date.now(); let calls = 0;