Repository navigation
refactor(process): take the host from HOST_PLATFORM and require the platform in process helpers - #11038
Conversation
…latform in process helpers
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Requested labels: ubuntu-24.04 |
[Medium impact] The reviewed changes appear safe to merge, with both earlier findings addressed. SummaryCentralizes host checks on
Reviews (2) · Last reviewed commit: "refactor(process): require the settlemen..." · Reviewed by Greptile |
…ing-embedded ownership checks
|
Correction to both thread replies: the fix commit is 9eb7a54 (not 8418a4d1cb). |
Summary
Removes every remaining
process.platform/process.archread fromsrc/process(26 platform reads, 4 architecture reads;src/processleaves both counted baselines). Pure helpers take the platform as a required parameter; operations bound to the running host (spawning,/proc/self, the live process table, lease pipes) readHOST_PLATFORM. Tests that redefinedprocess.platformfor these modules now inject the platform. Follows #11028.Problem and expected behavior
src/processdecided host behavior from ambientprocess.platformin 17 files, partly asplatform = process.platformdefaults. A caller describing another platform could get the running host's rules, and tests selected Linux or Darwin branches by redefining global process properties. Expected: helpers name the platform they apply; host-bound operations take the host from its one owner.Change and scope
matchesOwnedProcessCommand,privateRuntimeRootCapability,resolveProcessScenarioRuntimePaths,captureProcessScenario(itssignalbecomesAbortSignal | undefinedso the platform can follow),createSystemProcessOwnershipHost,observeSettlement,readLaunchNodeOptions,readLaunchExecArgv.captureProcessScenarionow passes its platform toresolveProcessScenarioRuntimePaths, which previously fell back to the ambient host.HOST_PLATFORM:spawnOwnedProviderProcess(Windows job only on a Windows host),execFileOutputdetach,OwnedLeasepipe selection, Linux/procstart-time reads, Darwin helper cache,systemProcessOwnershipHost, launcher identity matching against the live process table, capture manifests and cleanup host, and optionaloptions.platform ?? HOST_PLATFORM.platformseams that ~250 callers leave unset.ProcessSampling.procReadCoverage,ProcessSamplingShutdownandprocessObservationCommandFinalizationpass the sampler platform instead of redefiningprocess.platform;ProcessOwnership.movedProbeselects Linux by mockingHostPlatforminstead of the global. NewRegexMatchercase: Darwin and Windows launch flags are unrecoverable on any host.src/process; tests in other folders that stubprocess.platform(androidGuardianObservation,artifactSelectedCommand, pwntools,hostRestrictedAvailabilityMcp, ...) move with their modules.Contract and boundary impact
src/platform/HostPlatformowns the host read;src/processhelpers own platform rules for a named platform.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
ambient-host-platform178 reads / 106 files,ambient-host-architecture18 / 12 after this PR (from 204 / 122 after refactor(process): require the platform for environment snapshots instead of reading the host #11028).Validation performed
npx tsc --noEmit -p .— passed.npm run test:focused -- src/process/RegexMatcher.test.ts src/process/capture/ProcessScenarioRuntimeValidation.test.ts tests/boundary/cli/ghidraJavaDoctor.test.ts tests/boundary/process/packedBridgeVerification.test.ts tests/boundary/process/processCaptureLifecycle.test.ts tests/boundary/process/processCaptureNormalization.test.ts tests/boundary/process/processCaptureSensitiveInput.test.ts tests/boundary/process/processCaptureTerminal.test.ts tests/boundary/process/regexMatcher.test.ts src/process/ProcessOwnership.movedProbe.test.ts src/process/capture/ProcessSamplingShutdown.test.ts src/process/capture/ProcessSampling.procReadCoverage.test.ts tests/boundary/process/androidGuardianObservation.test.ts tests/boundary/process/artifactSelectedCommand.test.ts tests/process-global/processObservationCommandFinalization.test.ts— 195 passed, 2 skipped (before the test conversions); converted files rerun — 47 passed, procReadCoverage 36 passed.npm run test:focused --14 ownership/provider-process/lease/cgroup/helper-cache/exec files — 286 passed, 1 skipped.node scripts/verify/architecture-guards.mjs --shrink-baselines— passed;npm run check:fast— passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.