Skip to content

test(host-kit): answer the identity fixture from the double, not the runner - #4662

Merged
thymikee merged 1 commit into
mainfrom
test/host-kit-proc-fixture
Nov 18, 2026
Merged

thymikee merged 1 commit into
mainfrom
test/host-kit-proc-fixture

Conversation

@thymikee

@thymikee thymikee commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Three host-kit files double ps to describe a fixture pid, but the identity reader asks /proc/<pid>/stat first and uses the ps row 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.ts and host-process-stop-confirm.test.ts failed a full unit-ci run 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.ts answers every /proc read with ENOENT, so the ps double is the only evidence about a fixture pid whatever its value. host-process-liveness.test.ts already had that spy inline; it now calls the same helper. No production change: reading /proc and falling back to ps stays fail-closed.

Touched files: 4.

Validation

Base 655ede2796, head 1fd1f8e7ca.

  • CI=true npx vitest run --project unit-core packages/host-kit — 42 files, 459 passed, 7 skipped.
  • Failing at base was reproduced in CI, not locally: run 44171658389 Probe x64-16 reported pid 101 EXISTS stat=[S …] and then the two files; the same step passed on x64-8 where 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.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

…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>
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.38 MB 6.38 MB 0 B
Package (unpacked) 6.38 MB 6.38 MB 0 B
Package (download) 1.94 MB 1.94 MB +6 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 54.1 ms 45.5 ms -8.7 ms
CLI --help 106.4 ms 94.7 ms -11.6 ms

@thymikee

Copy link
Copy Markdown
Member Author

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.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 1fd1f8e

No open findings.

Reviewed with this repository's own Sentinel configuration (655ede2796e5).

💬 Talking to Sentinel

In a finding's thread, reply with:

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.

@thymikee
thymikee added this pull request to stack #4666 November 18, 2026 06:44
@thymikee
thymikee merged commit 91df2cf into main Nov 18, 2026
20 checks passed
@thymikee
thymikee deleted the test/host-kit-proc-fixture branch November 18, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant