Repository navigation
test(host-kit): answer the identity fixture from the double, not the runner - #4662
Conversation
…runner The identity reader prefers one `/proc/<pid>/stat` read over the `ps` row it parses, so a fixture pid the runner already owns answered with the host's real state and the `ps` double was ignored. The cases passed while the runner's pid space had not reached 42 or 101, and failed on a bigger runner that had. Answers the `/proc` reads with nothing, so the double is the only evidence about the fixture pid whatever its value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
|
This PR is ready at 1fd1f8e. The change only touches host-kit test files and a fixture, so it cannot affect a build, gate or runtime route. 19 of 20 checks pass, and the one that has not finished is a queued reviewer bot, not a build or test job. There are no conflicts, and no other review threads are open. The helper's spy reaches the same fs object that host-process.ts calls, and the unit-core lane is the proof. Whether the flake is gone on the 16 vCPU runner will show in later Coverage runs. Not blocking: the same two-line comment is pasted at host-process-stop-confirm.test.ts:321 and in owned-process-record.test.ts, while the docblock in host-proc.fixtures.ts already gives the reason, so you could delete the two call-site comments; also, the helper has no test of its own, and one case in host-process-liveness.test.ts could call the reader for process.pid and assert the ps double is used. You can take or leave both. |
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
Summary
Three
host-kitfiles doublepsto describe a fixture pid, but the identity reader asks/proc/<pid>/statfirst and uses thepsrow only when that read fails. On a runner whose pid space has already reached the fixture pid, the host answered for it: the case observed a lifetime nobody wrote.owned-process-record.test.tsandhost-process-stop-confirm.test.tsfailed a fullunit-cirun on a 16 vCPU runner and passed on an 8 vCPU one, where pids 42, 101, 111 and 4242 were still unused.host-proc.fixtures.tsanswers every/procread withENOENT, so thepsdouble is the only evidence about a fixture pid whatever its value.host-process-liveness.test.tsalready had that spy inline; it now calls the same helper. No production change: reading/procand falling back topsstays fail-closed.Touched files: 4.
Validation
Base
655ede2796, head1fd1f8e7ca.CI=true npx vitest run --project unit-core packages/host-kit— 42 files, 459 passed, 7 skipped.Probe x64-16reportedpid 101 EXISTS stat=[S …]and then the two files; the same step passed onx64-8where both pids were absent.The probe run that found this is on the unmerged branch
ci/coverage-wall-time(PR #4658). CI for this PR is the remaining gate.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.