Bind directory lock crash tests to their actual holder

This commit is contained in:
Dotta committed 2026-10-06 08:52:35 -05:00
1 parent fdf3e5baae
commit 0cff2b20b5
2 files changed
+10 -4

No files matched your search

@@ -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
@@ -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;