Skip to content

Commit d54ceec

Browse files
committed
fix(ready): keep readiness discovery free of killable-pid OS verification
verifyPidIdentity spawns WMIC/PowerShell (up to seconds on Windows) and is only needed for kill targets. runReady's production discovery now passes verifyPidFn: () => null so no OS command-line check runs outside the wait deadline; the /healthz identity marker and strict /readyz contract validation are unchanged.
1 parent 55f4937 commit d54ceec

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎src/cli/ready.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,14 @@ export async function runReady(args: ReadyArgs, io: ReadyIo = {}): Promise<numbe
179179
// deadlineAt budget recomputes remaining before each candidate probe and
180180
// bounds each fetch by it (plus the per-probe cap below). Non-wait path
181181
// keeps the built-in default.
182+
// verifyPidFn is disabled: readiness is non-destructive, so the killable-pid
183+
// OS command-line verification (WMIC/PowerShell, seconds on Windows) would
184+
// run OUTSIDE the deadline budget for no readiness value. The /healthz
185+
// identity marker and the strict /readyz contract validation remain.
182186
const live = await findLiveProxy(
183-
remainingMs === undefined ? {} : { deadlineAt: Date.now() + remainingMs, timeoutMs: DEFAULT_PROBE_TIMEOUT_MS },
187+
remainingMs === undefined
188+
? { verifyPidFn: () => null }
189+
: { deadlineAt: Date.now() + remainingMs, timeoutMs: DEFAULT_PROBE_TIMEOUT_MS, verifyPidFn: () => null },
184190
);
185191
return live ? { pid: live.pid, port: live.port, hostname: live.hostname } : null;
186192
});

‎tests/cli-ready.test.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,11 +769,19 @@ describe("runReady production findLiveProxy deadline wiring (source-level)", ()
769769
});
770770

771771
test("the non-wait path keeps findLiveProxy's built-in default (no deadlineAt)", () => {
772-
// The default find forwards {} when remainingMs is undefined so the
773-
// built-in per-probe timeout (no deadline) is preserved for the single probe.
774-
expect(readySource).toContain("remainingMs === undefined ? {}");
772+
// The default find forwards only verifyPidFn: () => null when remainingMs is
773+
// undefined so the built-in per-probe timeout (no deadline) is preserved for
774+
// the single probe and no OS pid verification runs outside a deadline.
775+
expect(readySource).toContain("remainingMs === undefined\n ? { verifyPidFn: () => null }");
775776
// deadlineAt is only ever passed conditionally (in the wait branch), never
776777
// as an unconditional findLiveProxy({ deadlineAt: ... }).
777778
expect(readySource).not.toContain("findLiveProxy({ deadlineAt");
778779
});
780+
781+
test("readiness discovery never runs killable-pid OS verification (deadline-bounded, non-destructive)", () => {
782+
// verifyPidIdentity spawns WMIC/PowerShell (up to seconds on Windows) and is
783+
// only needed for kill targets. Readiness must not run it: the check would
784+
// be unbounded by the wait deadline.
785+
expect(readySource).toContain("verifyPidFn: () => null");
786+
});
779787
});

0 commit comments

Comments
 (0)