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 — Fix pnpm env settings read across majors (#1460) by mikolalysenko · Pull Request #1461 · SocketDev/socket-patch Conversation
|
| Issue | Test | Without fix | With fix |
|---|---|---|---|
#1460 (issue repro: pnpm 12 + npm_config_package_lock=, plus npm_config_lockfile on 11/12, pnpm_config_lockfile on 9/10, npm_config_git_branch_lockfile on 12, pnpm_config_git_branch_lockfile on 10; controls refuse in the family the major reads) |
in_process_redirect_pnpm::hosted_scan_reads_pnpm_env_settings_for_the_project_pnpm_major (spawns the CLI with the env set) |
FAILED: [email protected] npm_config_package_lock=: pin count 0, expected 1 |
ok |
| #1460 (lock setting per major, every cell of the issue's table) | pnpm_workspace::tests::the_environment_disables_the_lockfile_only_for_its_pnpm_major |
n/a (new seam) | ok |
| #1460 (family selection, incl. git-branch on pnpm 10) | pnpm_workspace::tests::the_environment_family_follows_the_pnpm_major |
n/a (new signature) | ok |
Local runs:
cargo fmt --all -- --check: okcargo clippy --workspace --all-features -- -D warnings: okcargo test -p socket-patch-core --all-features --lib: 6409 passed. The 4 failures (copy_tree symlink relax, vlt_heal unremovable lock, pypi_poetry/pypi_requirements write-failure) depend on chmod and fail only because the sandbox runs as root. None touch pnpm.cargo test -p socket-patch-cli --all-features --test in_process_redirect_pnpm --test in_process_vendor_pnpm_takeover --test hosted_memory_parity: 33 + 15 + 42 passedcargo test --workspace ran out of sandbox disk while linking ~100 CLI test binaries, so CI is the full run.No wrapper (npm/, pypi/, gem/) changes are needed: this logic lives only in the Rust core.
pnpm_config_*: false positive. Hosted pnpm scan refuses with redirect_pnpm_lockfile_disabled over env lockfile settings the project's pnpm major ignores (e.g. any pnpm 11/12 project run through npm exec with package-lock=false) #1460's table shows pnpm 9.15.9 and 10.34.6 installing from the lock with pnpm_config_lockfile=false set..npmrc git-branch-lockfile/shared-workspace-lockfile read on pnpm 11+, env overriding a file setting, stale .modules.yaml major, upper-case NPM_CONFIG_*: pre-existing behavior of the file and lookup rules, not this root cause. Left for separate issues.pnpm_major read when no variable is set, the stale sharedWorkspaceLockfile contract line, and the duplicated test helpers.🤖 Generated with Claude Code
https://claude.ai/code/session_01E552fKgtx93unKJDowBuF4
Note
Medium Risk
Changes when hosted/vendored pnpm runs refuse vs pin based on CI/npx-injected env vars; behavior now matches real pnpm but could differ from prior overly conservative refusals.
Overview
Fixes #1460: hosted pnpm mode no longer treats npm-era environment variables (npm_config_*) as disabling the lockfile or enabling git-branch locks on pnpm 11+, which only honor pnpm_config_* (pnpm ≤10 still use npm_config_*).
env_setting in pnpm_workspace.rs now picks the env var family from the project’s pnpm major (same sources as existing file-based rules). That affects lockfile_disabled, git_branch_locks, and sharedWorkspaceLockfile env fallbacks via async view_setting. The major is resolved only when a relevant env var is set. CLI_CONTRACT.md documents the per-major behavior.
Adds integration test hosted_scan_reads_pnpm_env_settings_for_the_project_pnpm_major (e.g. npm_config_package_lock= from npx on pnpm 12 no longer blocks pinning) and unit tests for the env-family matrix.
Reviewed by Cursor Bugbot for commit c782837. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
Hosted pnpm refused to pin a lock over environment settings the project's pnpm never reads. pnpm 10 and older read only npm_config_* variables and pnpm 11 and newer only pnpm_config_*, but socket-patch accepted both families on every major. The common trigger: `npx socket-patch scan --mode hosted` in a pnpm 11/12 project whose .npmrc still has an npm-era package-lock=false. npx exports npm_config_package_lock=, pnpm 12 ignores it and installs from the lock, yet the scan warned redirect_pnpm_lockfile_disabled and pinned nothing. The same blindness made gitBranchLockfile and sharedWorkspaceLockfile env lookups refuse or mis-route. The environment is now read in the family the project's pnpm major reads (the same major that already picks pnpm-workspace.yaml vs .npmrc), and in both families only when the major is unknown. Fixes #1460 Assisted-by: Claude Code:claude-opus-5-5
Hosted pnpm scans now look the pnpm major up for the environment fallback only when one of the candidate variables is actually set, so a project with no such variable does not re-read its lock. Also documents the per-major family for sharedWorkspaceLockfile and folds the duplicated test helpers. Refs #1460 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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 c782837. 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: pnpm reads one family of environment variables per major: Risk: low to medium. The code is small and correct. For a known major, though, it moves from refusing to pinning, so it relies on the per-major claim. That claim is backed by the measured table in #1460 for pnpm 9.15.9, 10.34.6, 11.28.3 and 12.11.2, and the tests encode every cell of it. It also trusts Look here:
Verified:
Changes I made: none. Open questions (non-blocking):
Auto-merge (squash) is armed, so approving sends it straight to the merge queue. 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.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Hosted pnpm scan refuses with redirect_pnpm_lockfile_disabled over env lockfile settings the project's pnpm major ignores (e.g. any pnpm 11/12 project run throughnpm exec with package-lock=false)
There was an error while loading. Please reload this page.