Repository navigation
Bound the PDM site probe through utils::process (#1067) - #1106
Open
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
Open
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
2 tasks
On macOS, scan reads PDM's site config by asking PDM's own Python for platformdirs' site path. That probe kept its own deadline: a tokio timeout around a kill_on_drop child with a private 5 s budget, beside the output_within spawn every other crawler probe uses since #886. The two kill policies could drift apart again. The probe now runs through output_within on the blocking pool, with the shared 10 s PROBE_TIMEOUT. A hung PDM interpreter is killed and reaped at that deadline. A probe that answers in time behaves as before: the same argv, private cwd, scrubbed environment, 4 KiB output limit and JSON check. A new guard test fails when production code outside utils::process spawns a kill_on_drop child. vendor/npm_dir.rs stays on its pending list until its git exchange moves too (#1067). Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 8, 2026 03:09
Collaborator
Author
|
BugBot review Generated by Claude Code |
Mikola Lysenko (mikolalysenko)
pushed a commit
that referenced
this pull request
Oct 8, 2026
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7ec4ec7. Configure here.
Collaborator
Author
|
Ready for review (burn-down agent).
Nothing specific flagged for the reviewer beyond the PR description. Generated by Claude Code |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM Description written by Claude Code:claude-opus-5-5
Refs #1067. This is slice 1,
pdm_site; thenpm_dirgit exchange stays for a later slice.Summary
The macOS PDM site-config probe now runs through
utils::process::output_within, the bounded spawn every other crawler probe has used since #886. Its owntokio::time::timeout+kill_on_dropdeadline and its private 5 s budget are deleted. A new guard test fails when production code outsideutils::processadds akill_on_dropspawn.Why
register/20-audit-core.md, "partly fixed (Bound crawler and tool probes through one spawn deadline (#845) #886);pdm_siteand thenpm_dirgit exchange keep hand-rolled deadlines").npm_dirslice can't drift), D 1 (one of the two remaining hand-rolled spawn deadlines removed, net −16 production lines), S 0, R L.npm_dir.rsandutils/process.rsare both changed by Redact credentials from logged URLs, VEX product ids and hosted Composer locks #1026, so this PR touches neither.What changed
crawlers/python_crawler/pdm_site.rs:probe_runtime_site_dirbuilds astd::process::Commandand runsoutput_within(command, timeout)on the blocking pool (utils::fs::run_blocking), the same patternutils::pipenvandvendor::pypi_hatchuse.runtime_probe_commandreturns thatstdcommand and no longer sets stdio orkill_on_drop, becauseoutput_withinnulls stdin and stderr itself.runtime_site_dir(&Output): at most 4 KiB, exit 0, exactly one JSON string holding an absolute path.tests/child_deadline_guard.rs(new): scans the production part of everysrc/**/*.rsfile (above its first#[cfg(test)]module, CRLF-normalized) forkill_on_drop(, outsideutils/process.rs. APENDINGlist (vendor/npm_dir.rs) fails on new and stale entries. A second test plants a site in a temp tree to prove that the guard fires and ignores test modules.Deleted
pdm_site.rs: the localPROBE_TIMEOUT, thetokio::time::timeout+kill_on_dropread loop (read_runtime_site_dir) and the stdio setup.pdm_site.rs's test module, plus +107 for the new guard file.Behavior
For a probe that answers in time, nothing changes: the same argv (
-E -B -c), private temp cwd, scrubbedPYTHON*environment, null stdin and stderr, 4 KiB limit and JSON check.There are two changes:
utils::process::PROBE_TIMEOUT(10 s) instead of a private 5 s. This was the drift Route the remaining hand-rolled child-process deadlines through utils::process #1067 names.None), still within the deadline.This code is compiled only on macOS (
#[cfg(target_os = "macos")] mod pdm_site).Test evidence
pdm_siteis macOS-only, and cross-checking foraarch64-apple-darwinfails here onring's C build (no Apple toolchain). So I temporarily compiled the module under#[cfg(unix)]on Linux, and did not commit that change. Its code uses only unix APIs. With that change:cargo test -p socket-patch-core --lib pdm_site: 8 passed, including the rewrittenprobe_timeout_kills_its_child(the child records its pid,execssleep 30, and is dead and reaped when the probe returns after the 500 ms budget),probe_bounds_and_validates_output_and_process_status(including the oversized-output case) and the env-scrub and private-cwd tests.cargo clippy --workspace --all-features -- -D warningspassed.cargo test -p socket-patch-core --test child_deadline_guard: 2 passed. Red→green: withmain'spdm_site.rsrestored, the guard fails withspawn these children through utils::process::output_within …: ["crawlers/python_crawler/pdm_site.rs"].rustfmt --checkis clean on both touched files.main's copy ofpdm_site.rswas already clean.Risk
Low. One macOS-only probe on scan's PDM config path, plus one test file. The worst case is a hung PDM interpreter delaying scan by 10 s instead of 5 s.
🤖 Generated with Claude Code
Note
Low Risk
macOS-only PDM config probing plus test-only guard; main risk is hung interpreters taking up to the shared 10s probe budget instead of 5s.
Overview
The macOS PDM site-config probe no longer uses a local
tokio::time::timeout+kill_on_dropread loop. It builds astd::process::Commandand runsutils::process::output_withinon the blocking pool (same pattern as other crawler probes), with stdout validation moved toruntime_site_dir(&Output)(4 KiB cap, success exit, single JSON absolute path).Behavior deltas: hung probes now honor the caller’s timeout budget via
output_within(including the sharedPROBE_TIMEOUT(10s) at the top level, replacing a private 5s constant); oversized stdout is rejected after the child exits instead of mid-stream (stillNone).Adds
tests/child_deadline_guard.rs: scans productionsrc/**/*.rs(above#[cfg(test)]) forkill_on_drop(outsideutils/process.rs, withvendor/npm_dir.rson aPENDINGallowlist until migrated.Reviewed by Cursor Bugbot for commit 7ec4ec7. Configure here.
Generated by Claude Code