GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix pnpm trustLockfile env override ignored (#1514) by mikolalysenko · Pull Request #1533 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #1514

Summary

On pnpm 11 and 12, a pnpm_config_trust_lockfile (or PNPM_CONFIG_TRUST_LOCKFILE) environment variable takes precedence over the trustLockfile: true that hosted mode writes into pnpm-workspace.yaml. If that variable was false, scan --mode hosted still wrote the key and reported "installs need no extra flags", and then every install in that environment failed with ERR_PNPM_TARBALL_URL_MISMATCH.

The scan now treats a non-true value of that variable as an explicit user setting, the same way it treats trustLockfile: false in the file and the way the npm arm treats npm_config_allow_remote. It writes nothing. The redirect_pnpm_trust_lockfile warning names the variable and gives the remedies: unset it, set it to true wherever the project installs, or re-run with --mode vendored.

Root cause

The trust plan in pnpm_trust (crates/socket-patch-core/src/hosted/engine.rs) chose between write, AlreadyTrue and UserSet by looking only at the text of pnpm-workspace.yaml. It never read the environment that pnpm 11+ reads ahead of that file.

Changes

  • utils/pnpm_workspace.rs: new trust_lockfile_env(major, env). It returns the override only for pnpm 11 and newer, or when the major is unknown. pnpm 10 never verifies lock URLs, and no pnpm reads npm_config_trust_lockfile. The variable lookup goes through the existing env_setting. The pnpm-major heuristic is now one sync helper, pnpm_major_from, shared with the 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 lockfile check.
  • hosted/engine.rs: new RewriteOptions::pnpm_env, an injected environment lookup. The CLI passes the process env. The in-memory engine passes none, since it sees no install environment. pnpm_trust respects an override in both the root-workspace branch and the member-lock branch (Hosted scan from a pnpm 11/12 workspace member with its own lock writes trustLockfile into a nested member pnpm-workspace.yaml that pnpm ignores, so the root install fails with ERR_PNPM_TARBALL_URL_MISMATCH #880). The more specific pnpm 9.0–10.4 pin and keyless-members guidance still comes first.
  • scan/hosted.rs: the member pre-check (redirect_pnpm_settings_elsewhere) no longer refuses with advice to add trustLockfile: true to the root file when the environment overrides that key. In that case the engine pins the member lock and reports the variable.
  • Docs: CLI_CONTRACT.md (pnpm trust contract) and docs/ecosystems.md.

Test evidence

Issue Regression test Red without fix Green with fix
#1514 hosted::engine::tests::issue_1514_a_trust_lockfile_env_override_is_respected (lowercase and uppercase variable, existing trustLockfile: true, member lock; controls: true, npm spelling, pnpm 10 pin) failed: ["pnpm-lock.yaml", "pnpm-workspace.yaml"] written ok
#1514 utils::pnpm_workspace::tests::the_environment_sets_trust_lockfile_only_for_pnpm_11_and_newer n/a (new API) ok
#1514 e2e e2e_redirect_pnpm_build::pnpm11_trust_lockfile_env_override_is_respected (real pnpm 11.28.5, SOCKET_PATCH_PNPM_E2E_REQUIRED=1) failed: rewrittenFiles: ["pnpm-workspace.yaml"], "installs need no extra flags" ok; control re-run without the variable heals the key

Run locally:

  • cargo fmt --all -- --check: ok
  • cargo clippy --workspace --all-features -- -D warnings: ok
  • cargo test -p socket-patch-core --all-features --lib: 6484 passed. 4 failed, all of them read-only-permission tests (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouched, pypi_requirements::wire_failure_rolls_back_already_written_files). They can't fail as root, which is how the sandbox runs, and they are unrelated to this diff.
  • cargo test -p socket-patch-cli --all-features --lib --bins: 920 passed
  • e2e_redirect_pnpm_build -- --ignored pnpm11_: 4 passed
  • The full cargo test --workspace build ran out of sandbox disk while linking the CLI integration binaries. CI covers those.
  • No wrapper (npm/, pypi/, gem/) changes are needed: this is engine-only.

Review findings not fixed (/code-review high)

  • pnpm_config_trust_lockfile=0 coercion. The value is read with the repo's existing env convention (PnpmSetting::as_bool, the npm-config reader: only ''/false/null/undefined are false), the same as every other pnpm env setting here. Changing that convention for one key would make them disagree.
  • Uppercase spelling. Hosted pnpm 11/12 scan ignores a pnpm_config_trust_lockfile=false env override and says "installs need no extra flags", but the next frozen install fails with ERR_PNPM_TARBALL_URL_MISMATCH #1514 verified that PNPM_CONFIG_TRUST_LOCKFILE=false makes pnpm 12.11.2 fail on Linux, so it is honoured.
  • A developer's shell env decides a committed file. This matches the npm npm_config_allow_remote precedent (CLI_CONTRACT), and the warning says plainly that nothing was written and why.
  • Injected env vs std::env in view_setting. The injection keeps the engine testable and lets the in-memory engine opt out. Moving lockfile/gitBranchLockfile onto it is a separate refactor.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Vu8yCCshtPxwd4jscWRAU


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start fix for #1514
35268e0
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 14, 2026
Hosted pnpm 11/12 scan ignores a pnpm_config_trust_lockfile=false env override and says "installs need no extra flags", but the next frozen install fails with ERR_PNPM_TARBALL_URL_MISMATCH #1514
Closed
Claude (claude) added 2 commits October 14, 2026 12:39
@claude
Respect a pnpm trustLockfile env override
3efa5b0
pnpm 11 and 12 read pnpm_config_trust_lockfile (or its uppercase
spelling) ahead of pnpm-workspace.yaml. With it set to false, a hosted
scan still wrote trustLockfile: true there and said installs need no
extra flags, so every install in that environment failed with
ERR_PNPM_TARBALL_URL_MISMATCH.

The scan now treats a non-true value of that variable as an explicit
user setting, like trustLockfile: false in the file: on a project whose
pnpm is 11 or newer (or unknown) it writes nothing and the trust warning
names the variable and the remedies (unset it or set it to true for
installs, or use --mode vendored). The in-memory engine sees no
environment and is unchanged.

Fixes #1514

Assisted-by: Claude Code:claude-opus-5-5
@claude
Document the pnpm trustLockfile env override
32c0158
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 14, 2026
Swarm health manager log #1382
Open
@claude
Share pnpm major lookup; keep specific guidance
2dc1100
Review follow-ups for the trustLockfile env override:

- The trust check now reads the project's pnpm major through the same
  helper as the lockfile setting (#1460) instead of a second copy, and
  the env reader reuses the existing variable lookup.
- A project pinned to pnpm 9.0-10.4, or with a keyless workspace file
  that lists members, keeps its more specific guidance; the override
  only replaces the generic write.
- A workspace member scanned with the override set is no longer
  refused with advice to add trustLockfile: true to the root file,
  which the variable would override anyway; the scan pins the member
  lock and its warning names the variable.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 14, 2026 13:21
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 14, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for 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 2dc1100. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 14, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 14, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Final reviewer: sent to the merge queue (squash). Approved by Tanmay Singla (@Tanmay182003) on the current head 2dc1100, ci-ok and clippy green, no unresolved review threads, no blocking labels.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 14, 2026
Spawn every CLI test child through one hermetic Command builder; 10 test files inherit ambient SOCKET_* today #823
Closed
5 tasks
Merged via the queue into main with commit a3f56f7 Oct 14, 2026
86 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-pnpm-trust-lockfile-env branch October 14, 2026 13:59
This was referenced Oct 14, 2026
CI perf (settings): slow Depot 16-core hosts since 10-13 15:20 add ~1.5–2.5 min to the merge-queue critical path (~0.6k Linux job-min/day) #1512
Open
CI performance dashboard #1182
Open
Hosted pnpm 11/12 scan treats an empty (or null/undefined) pnpm_config_trust_lockfile as false and skips the trustLockfile config, so the next frozen install fails #1557
Closed
Fix pnpm 11 env booleans other than true/false (#1557) #1575
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Hosted pnpm 11/12 scan ignores a pnpm_config_trust_lockfile=false env override and says "installs need no extra flags", but the next frozen install fails with ERR_PNPM_TARBALL_URL_MISMATCH

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Tanmay182003 @claude
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.