Repository navigation
fix(server): stopping a preview server no longer depends on the test worker's pid - #139
Conversation
…worker's pid The stop path compared the fake process table in PortScanner tests against the real process.pid, so a test failed with shared-group whenever the worker was assigned one of the fixture pids. The server pid is now read from HostProcess.ProcessId, which defaults to process.pid, and tests with a fake table provide a fixed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
ScriptedAlchemy
left a comment
There was a problem hiding this comment.
Second-pass review of f3bb666: no code blocker found. The injected HostProcess.ProcessId defaults to process.pid in production, the fake process-table tests provide SERVER_PID = 100, and the real-process test retains the real PID. All 31 PortScanner tests passed locally, including the real Linux process/group-stop case.
I also checked the combined tree with the fixed #141: it merges cleanly and preserves both the PID injection and the macOS parser/fixture changes.
Full CI is the remaining validation gap. At this review, completed Fork CI jobs are passing, but Server tests 2, 3, 6, 7 and 8 are still queued in run 44010268629. I am holding the merge until that run completes successfully.
PortScanner.test.ts > rechecks the socket owner before stopping a Linux server without lsoffailed intermittently in CI (seen on #137) withshared-group. The stop path compared the test's fake process table against the realprocess.pid. Whenever the test worker got pid 5000, one of the fixture pids, the target looked like the server itself and stop refused it.Fix: the server pid is now an injected
HostProcess.ProcessIdreference next toHostProcess.Platform. It defaults toprocess.pid, so production behaviour is unchanged. The fake-table tests (layerProbeFailureand the agent-thread stop test, which previously built its table from the realprocess.pid) now provide a fixedSERVER_PID. The live test that uses real processes still reads the real pid.Proof (
vp test run src/preview/PortScanner.test.ts, withObject.defineProperty(process, "pid", { value: 5000 })added temporarily to the test file):× rechecks the socket owner before stopping a Linux server without lsof, the sameshared-grouperror as CIThe live test
stops an agent's server through its job's group, and only a listed serveralso fails on this macOS host on unmodified base (stopsis empty). It doesn't touch the pid and is unrelated to this change. It passes on Linux CI.Other
process.pidcomparisons (ProcessDiagnostics,ResourceTelemetry) already derive their fixtures fromprocess.pidin their tests, so they don't have this collision.Done by Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code