Skip to content

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

Open

Description

[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

Size

3 files, test-only, ~+40/-20.

Acceptance criteria

  • 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.
  • No production behavior change.

Activity

  1. added
    bugSomething isn't working
    arch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)
    on Nov 1, 2026
  2. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [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

  3. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [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.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)bugSomething isn't workingpriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions