Repository navigation
Fix pnpm 11 env booleans other than true/false (#1557) - #1575
Merged
Mikola Lysenko (mikolalysenko) merged 6 commits intoOct 15, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A hosted scan run with pnpm_config_trust_lockfile (or the uppercase spelling) set to an empty string, "null" or "undefined" treated it as an explicit false: it wrote no trustLockfile: true, warned that the key would not take effect, and the next frozen install failed. pnpm 11 and 12 ignore such a value and read pnpm-workspace.yaml, which is common in CI where an unset repository variable exports "". The scan now treats those values as unset, so it writes the key and a member scan still gets its governing-root refusal. Only a literal false is respected, as pnpm does. Fixes #1557 Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
pnpm 11 reads a pnpm_config_* boolean variable only when it is exactly "true" or "false" and otherwise falls back to pnpm-workspace.yaml. This holds for every key, not just trustLockfile: an empty pnpm_config_lockfile or pnpm_config_shared_workspace_lockfile was also read as false, so a scan could withhold pins or misread the workspace while pnpm itself ignored the variable. Move the rule from the trust-only wrapper into the shared env lookup, so every pnpm_config_* setting (and the uppercase trust spelling) follows it. The npm_config_* family that pnpm 10 and older read keeps its existing coercion. Refs #1557 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 15, 2026 13:30
Collaborator
Author
|
BugBot review Generated by Claude Code |
Collaborator
Author
|
Ready for review at
Slack announcement not sent this run (Slack send isn't available to the burn-down agent); the next run will retry. Generated by Claude Code |
pnpm 12 trims a pnpm_config_* value before reading it as true or false, so " false" and "false " turn a setting off there; pnpm 11 does not trim and ignores them. The previous commit matched exactly for every major, so on pnpm 12 a padded false lockfile variable let hosted pins through that pnpm never installs, and a padded false trust variable got a trustLockfile key written that it overrides. Trim unless the project is on pnpm 11, including when the major is unknown, which matches the behaviour before this PR. Refs #1557 Assisted-by: Claude Code:claude-opus-5-5
Collaborator
Author
|
BugBot review Generated by Claude Code |
The hosted member preflight read pnpm_config_trust_lockfile with no pnpm major, so a padded " false" counted as an override on a pnpm 11 member and skipped the governing-root refusal, while the rewrite (on pnpm 11) ignored it and wrote no trust key, leaving pins that fail at install. The preflight now reads the variable at the project's own pnpm major, as the rewrite does. Refs #1557 Assisted-by: Claude Code:claude-opus-5-5
Collaborator
Author
|
BugBot review Generated by Claude Code |
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 45721dd. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 15, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-pnpm-trust-env-empty
branch
October 15, 2026 16:00
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
Fixes #1557
Summary
A hosted pnpm 11/12 scan run with
pnpm_config_trust_lockfile(orPNPM_CONFIG_TRUST_LOCKFILE) set to an empty string,nullorundefinednow writestrustLockfile: trueas if the variable wereunset, and its warning no longer claims the variable was respected. The
next frozen install in that environment succeeds. An empty variable is a
normal CI shape:
env: X: ${{ vars.Y }}with the repo variable unset.Root cause
#1533 (the #1514 fix) parsed pnpm 11+'s
pnpm_config_*variables withthe npm/
.npmrccoercion inPnpmSetting::as_bool, where"",nullandundefinedmean false. pnpm 11 doesn't do that. Measuredwith
pnpm config geton pnpm 11.28.5, apnpm_config_<bool>variablecounts only when it is exactly
trueorfalse. Any other value(empty,
null,undefined,0,FALSE,false,yes) is ignoredin favour of pnpm-workspace.yaml, for every key I probed:
trust-lockfile,lockfile,shared-workspace-lockfileandgit-branch-lockfile.The fix is in the shared lookup
env_setting(
utils/pnpm_workspace.rs). Thepnpm_config_family, plus theuppercase trust spelling, goes through one helper,
pnpm_env_setting,that keeps only
trueorfalse. Both trust call sites(
hosted/engine.rspnpm_trust_env_overrideandscan/hosted.rstrust_env_off, the member governing-root refusal) pick this up. So dolockfile_disabledand thesharedWorkspaceLockfileandgitBranchLockfileenv fallbacks. Thenpm_config_family that pnpm 10and older read keeps its existing coercion.
The first commit filtered only the trust variable.
/code-review highpointed out that the same wrong parse applies to the other
pnpm_config_*keys, and the pnpm 11 probe confirmed it, so the secondcommit moved the rule to the shared boundary.
Review follow-up: pnpm 12 trims the value before matching (
" false"and"false "are false; measured on pnpm 12.11.2), while pnpm 11 doesn't.pnpm_env_settingtherefore trims unless the project is on pnpm 11, and also trims when the major is unknown (the pre-PR behaviour). APADDEDtable in the unit test covers both majors. Bugbot follow-up: the hosted member preflight (scan/hosted.rs) now reads the variable at the project's pnpm major throughtrust_lockfile_env_for, so it agrees with the rewrite (testthe_trust_variable_follows_the_project_pnpm_major).Two existing assertions changed to match measured pnpm behaviour:
pnpm_config_trust_lockfile=falseenv override and says "installs need no extra flags", but the next frozen install fails with ERR_PNPM_TARBALL_URL_MISMATCH #1514 unit test's uppercase" false "(padded) is now"false",because that test loops over pnpm 11, where the padded form is ignored.
The padded cases moved to the new
PADDEDtable.pnpm_config_git_branch_lockfile=TRUEis nowtrue. The test is about pnpm-over-npm precedence, and pnpm ignoresTRUE.Test evidence
Red without the fix, green with it:
utils::pnpm_workspace::tests::a_pnpm_config_variable_counts_only_as_true_or_false(unit; it started asan_empty_or_null_trust_lockfile_variable_sets_nothing, which was red before the fix)hosted::engine::tests::issue_1557_an_empty_trust_lockfile_variable_keeps_the_write: red without the fix (no pnpm-workspace.yaml written), green with ite2e_redirect_pnpm_build::pnpm11_empty_trust_lockfile_env_is_ignored(real pnpm 11.28.5, dead registry): red without the fix at "an empty variable pnpm ignores must not stop the write". Green with it: the scan writes the key, and a freshpnpm install --frozen-lockfilerun withpnpm_config_trust_lockfile=installs the patched bytes.Ran locally:
cargo fmt --all -- --check: okcargo clippy --workspace --all-features -- -D warnings: okcargo test -p socket-patch-cli --all-features --test e2e_redirect_pnpm_build -- --ignored --skip pnpm_pinned_matrix: 11 passed, including Hosted pnpm 11/12 scan ignores apnpm_config_trust_lockfile=falseenv override and says "installs need no extra flags", but the next frozen install fails with ERR_PNPM_TARBALL_URL_MISMATCH #1514'spnpm11_trust_lockfile_env_override_is_respectedin_process_redirect_pnpm38,hosted_memory_engine43,hosted_memory_parity42,scan244: all passedcargo test --workspace --all-features --no-fail-fast: everything passes except 10 tests in 4 targets that fail in this sandbox for reasons outside this diff. 9 are chmod-based write-failure tests, which can't fail a write when run as root (copy_treesymlinked root,vlt_healunremovable lock,pypi_poetry/pypi_requirementswire write failure,in_process_redirectwrite-failure ×3,repaircleanup ×2). The 10th,e2e_bun_lockb::binary_shared_bundled_record_hosted_pin_is_managed, tries to reach patches-api.socket.dev, which the sandbox blocks. None of them touch pnpm env parsing; CI is authoritative.Per-issue checklist
null/undefined)pnpm_config_trust_lockfileasfalseand skips the trustLockfile config, so the next frozen install fails #1557, empty /null/undefinedpnpm_config_trust_lockfile(both cases): unit, engine and real-pnpm e2e tests above. The member-refusal predicate inscan/hosted.rsuses the sametrust_lockfile_env, which the unit test covers.Follow-ups
No wrapper (
npm/,pypi/,gem/) changes are needed; this is Rust-only parsing.🤖 Generated with Claude Code
https://claude.ai/code/session_014yr5aboMV1HKW9nDgrD6GP
Generated by Claude Code