From 016f5ae862e1704b522808c6e79409da83425d63 Mon Sep 17 00:00:00 2001 From: Masato Hoshino Date: Wed, 29 Apr 2026 20:51:14 +0900 Subject: [PATCH] test(plugins): cover dead-PID stale runtime-deps lock removal Adds focused regression coverage for dead owner PID runtime-deps install locks so stale lock recovery remains PID-first and does not wait on age when the recorded owner process is gone. Co-authored-by: masatohoshino --- src/plugins/bundled-runtime-deps.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/plugins/bundled-runtime-deps.test.ts b/src/plugins/bundled-runtime-deps.test.ts index 3bc0b8ddcb8..2fe6a742a5e 100644 --- a/src/plugins/bundled-runtime-deps.test.ts +++ b/src/plugins/bundled-runtime-deps.test.ts @@ -2104,6 +2104,28 @@ describe("ensureBundledPluginRuntimeDeps", () => { ).toBe(false); }); + it("expires runtime-deps install locks whose owner PID is dead", () => { + expect( + bundledRuntimeDepsTesting.shouldRemoveRuntimeDepsLock( + // Conventional non-existent PID for dead-process simulation + { pid: 99999, createdAtMs: 0 }, + 1_000, + () => false, + ), + ).toBe(true); + }); + + it("expires runtime-deps install locks whose owner PID is dead regardless of age", () => { + expect( + bundledRuntimeDepsTesting.shouldRemoveRuntimeDepsLock( + // Conventional non-existent PID for dead-process simulation + { pid: 99999, createdAtMs: Date.now() }, + Date.now(), + () => false, + ), + ).toBe(true); + }); + it("does not expire fresh ownerless runtime-deps install locks", () => { expect( bundledRuntimeDepsTesting.shouldRemoveRuntimeDepsLock(