GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — Keep npm detector unit tests off the host's yarn config by mikolalysenko · Pull Request #2054 · SocketDev/socket-patch Conversation
|
| env | cargo test -p socket-patch-core --lib crawlers:: |
|---|---|
| clean | 798 passed |
HOME with .yarnrc.yml → nodeLinker: node-modules |
13 failed (12 pkg_managers, 1 pnpm_layout) |
YARN_NODE_LINKER=node-modules |
15 failed (the same 13, plus 2 npm_crawler) |
A runner image or a contributor with a global yarn nodeLinker gets red tests on a clean checkout.
The tests call the public detector, and it builds YarnEnv::for_project from the process environment and the home folder.
detect_npm_pkg_manager_with(project_root, yarn_linker) and a private live_pnp_marker_in. The nodeLinker lookup is now passed in as a closure. In production the public functions pass the same yarn_node_linker(scope, root) as before, so behaviour doesn't change.YarnPnpLoader::detect gets the same split (detect_with).#[cfg(test)] hermetic wrappers over YarnEnv::repository_only(). Project-local .yarnrc.yml files are still read.EnvGuard plus #[serial] on purpose. Changing process env while other tests run in parallel is itself a source of flakes.public_detectors_match_the_hermetic_ones_without_a_loader keeps the public entry points covered by unit tests.After the change:
HOME/.yarnrc.yml: 799 passed (was 13 failed)YARN_NODE_LINKER=node-modules: 796 passed, 2 failed. Both are npm_crawler tests that go through the full crawler; they are listed below.cargo clippy --locked -p socket-patch-core --all-features -- -D warnings (CI's clippy command) is clean, and rustfmt --check passes on the touched files.No tests were removed or weakened. Every changed test asserts the same thing on the same fixtures.
npm_crawler::global_scope_reads_a_yarn_store_configured_above_the_repository and test_yarn4_pnpm_linker_relocated_store_transitive_packages_are_found still fail under YARN_NODE_LINKER. They go through NpmCrawler, and fixing them needs the env threaded through the crawler.python_crawler tests that fail under an activated VIRTUAL_ENV.Refs #1919
Fixed in 2abfc1e:
.yarnrc.yml. Outside a git checkout that walk has no bound, so a nodeLinker set above TMPDIR still failed 15 pkg_managers tests. The helper now reads only the project's own rc file, and hermetic_detector_ignores_an_rc_file_above_the_project covers it. With the hostile setup, 3 tests still fail. They are older tests that call yarn_node_linker_in directly, and this PR doesn't touch them.Not fixed here, deliberately:
yarn_node_linker. That is the 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 follow-up. The better long-term fix is one test-time override in YarnEnv, not more *_hermetic twins.YarnPnpLoader::detect hard-codes ReadScope::Workspace (vex.rs). That predates this PR and is unchanged..env.yarn injection. No test that uses it has an env file.Generated by Claude Code
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
detect_npm_pkg_manager reads YARN_NODE_LINKER, YARN_RC_FILENAME and ~/.yarnrc.yml whenever a PnP loader exists. Its 13 unit tests in pkg_managers and pnpm_layout therefore failed on any machine with a global yarn nodeLinker: 13 fail with HOME/.yarnrc.yml setting nodeLinker: node-modules, 15 with YARN_NODE_LINKER=node-modules. Split out detect_npm_pkg_manager_with, which takes the nodeLinker lookup as a closure (production passes the same yarn_node_linker as before), and point the tests at a cfg(test) hermetic wrapper over YarnEnv::repository_only. YarnPnpLoader gets the same split. A new test pins that the public entry points agree with the hermetic ones when no loader exists. Refs #1919. The two npm_crawler tests that go through the full crawler and the python VIRTUAL_ENV tests are left for follow-ups. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_011f9aeS6VN7YUHqXUcokkgF
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR SummaryLow Risk Overview Tests use New coverage confirms public vs hermetic agreement when no PnP loader exists (linker lookup not invoked), and that hermetic detection ignores rc files above the temp project root. Reviewed by Cursor Bugbot for commit 2abfc1e. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
detect_npm_pkg_manager_hermetic used yarn_node_linker_in over YarnEnv::repository_only(), which still walks every ancestor's .yarnrc.yml. A temp dir outside a git checkout has no read boundary, so an rc file anywhere above TMPDIR (e.g. TMPDIR=$HOME/tmp with a global nodeLinker) still flipped 12 of the converted tests. The helper now reads the project's own .yarnrc.yml only; no hermetic test puts an rc file above the project. Adds a regression test for the rc-above-project case, and asserts the injected linker lookup is never called without a loader. Co-Authored-By: Claude <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011f9aeRTCXhYsyXWBxRiqTt
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ 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 2abfc1e. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Final review briefWhat it does. Unit tests for the npm package-manager detector no longer pick up the host's yarn setup ( Risk: low. The production paths are a straight delegation with the same closure, and the new code is Look here
Verified
Changes I made. None. Open questions (not blocking): should the follow-up for #1919 replace the Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.