You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crawler unit tests read the developer's real HOME, YARN_NODE_LINKER and VIRTUAL_ENV: 12 pkg_managers/pnpm_layout tests fail under a user nodeLinker setting #1919
[agent] Filed by the scheduled architecture audit (audit-core). Register: A48.
Kind: bug (test hermeticity). Register ID: A48.
Problem
The PnP detection tests in crawlers/pkg_managers.rs go through YarnEnv::for_project, which reads the process env and ~/.yarnrc.yml (pkg_managers.rs L452-L461 and the YarnEnv resolution above it), instead of the injected bare_env the module already offers. pnpm_layout::modules_dir_setting also walks the tempdir's ancestors (e.g. /tmp/.npmrc).
Executed on a build of main @ cbbbdb9 (by the audit, nothing committed):
HOME pointing at a dir whose .yarnrc.yml says nodeLinker: node-modules → 10 pkg_managers tests fail, plus pnpm_layout::a_configured_modules_dir_without_a_store_is_not_pnpm;
YARN_NODE_LINKER=node-modules → 12 tests fail.
By code reading (unexecuted), the python crawler's test_crawl_all_python, test_crawl_all_recovers_metadata_less_package, test_crawl_all_not_poisoned_by_body_headers, base_copy_behind_a_system_site_venv_is_crawled and venv_copy_hides_the_base_copy_of_the_same_package go through PythonCrawler::get_site_packages_paths (L3573),``` which returns early on a real VIRTUAL_ENV (L752-L760),```` so they should fail in an activated shell.
CI passes only because its env is clean; a contributor with a global Yarn nodeLinker or an active venv sees red tests on a clean checkout.
Proposed change
Drive the PnP tests through YarnEnv/bare_env (or live_pnp_marker_with) instead of for_project; give pnpm_layout tests an injected .npmrc chain or a hermetic root.
Drive the five python tests through the _with env-injected variants (find_local_venv_site_packages_with + env_of).
cargo test -p socket-patch-core --lib crawlers:: passes with YARN_NODE_LINKER=node-modules, with a HOME/.yarnrc.yml setting nodeLinker: node-modules, and with VIRTUAL_ENV set to a real venv.
[agent] Triage: priority:p3 (test hermeticity, no production change). Related to #1889 (shared env test guard, PR #1891); the guard from that PR is the natural tool for the tests that must read process env.
[agent] One more site for this issue, from the audit-core run at cbbbdb9: the ruby crawler test crawl_all_finds_flat_bundler1_project L3341-L3374 goes through the ambient crawl_all.
Executed: it passes normally and fails with BUNDLE_PATH__SYSTEM=true (a panic at L3369).
From reading the code: a ~/.bundle/config that sets path.system, or an exported BUNDLE_GEMFILE, breaks it the same way. Its doc only defends against BUNDLE_PATH.
Fix: drive it through discover_bundle_stores_with_env plus scan_gem_dir, or through a crawl_all_with_env seam.
Activity
audit-core: crawlers nuget/pkg_managers/pnpm_layout/python (cbbbdb9),…
mikolalysenko commentedon Nov 1, 2026
[agent] Triage: priority:p3 (test hermeticity, no production change). Related to #1889 (shared env test guard, PR #1891); the guard from that PR is the natural tool for the tests that must read process env.
Generated by Claude Code
mikolalysenko commentedon Nov 1, 2026
[agent] One more site for this issue, from the audit-core run at
cbbbdb9: the ruby crawler testcrawl_all_finds_flat_bundler1_projectL3341-L3374 goes through the ambientcrawl_all.BUNDLE_PATH__SYSTEM=true(a panic at L3369).~/.bundle/configthat setspath.system, or an exportedBUNDLE_GEMFILE, breaks it the same way. Its doc only defends againstBUNDLE_PATH.Fix: drive it through
discover_bundle_stores_with_envplusscan_gem_dir, or through acrawl_all_with_envseam.Generated by Claude Code