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 vendored pnpm shadowing workspace overrides (#360) by mikolalysenko · Pull Request #785 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 4, 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 #360

Summary

With a lockfile 9.0 project on pnpm 10.5+ that keeps its overrides: in pnpm-workspace.yaml, vendor / scan --mode vendored no longer adds a package.json pnpm.overrides copy. That copy replaced the user's workspace overrides on pnpm 10. Before this change, vendor reported success, but every pnpm install --frozen-lockfile then failed with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, and a re-lock silently dropped the user's overrides. Now only the workspace file and the lock are wired.

The diff is 2 files (vendor/pnpm_lock.rs and tests/e2e_vendor_pnpm_build.rs). An earlier commit on this branch reformatted the whole workspace with rustfmt by mistake. The second commit, eb4ddc6, reverts all 130 unrelated files to main.

Root cause

The vendored pnpm 9.0 writer (vendor_pnpm_dialect) always called apply_pkg_override. That function writes a back-compat package.json pnpm.overrides entry for pnpm versions that read overrides only from package.json. On pnpm 10.5–10.x, a package.json pnpm.overrides field takes the place of the workspace-file overrides: instead of merging with them. The lock socket-patch wrote (the user's overrides plus ours) then no longer matched the override set pnpm computes (ours only).

Fix

New helper workspace_overrides_govern. It returns true only when all three hold:

  • package.json has no pnpm.overrides of its own;
  • pnpm-workspace.yaml has a block overrides: section with a user-authored (non-vendored) key;
  • the lock's overrides: section records that key.

The third condition is direct evidence that the pnpm which wrote this lock reads the workspace file. pnpm 9 and 10.0–10.4 ignore workspace overrides and never record them, so on those versions the package.json copy is still written, as before.

When the helper returns true, the package.json step is skipped: no write and no pnpm_pkg_override wiring record. Revert, rollback and the in-sync re-run all follow the wiring records, so they need no change. The legacy (pnpm 7/8) dialect is untouched.

Test evidence

Each regression test failed before the fix and passes with it.

Issue Test Before fix After fix
#360 unit vendor::pnpm_lock::tests::workspace_read_overrides_skip_the_package_json_copy FAILED: package.json gained pnpm.overrides ok
#360 e2e e2e_vendor_pnpm_build::pnpm_vendor_keeps_user_workspace_overrides_authoritative (real pnpm 10.34.6) FAILED: package.json gained pnpm.overrides ok

What the e2e test does:

  1. Installs a real project with workspace overrides: {is-number: 7.0.0} and vendors left-pad.
  2. Asserts package.json is byte-identical after vendoring.
  3. Copies the committable files to a fresh checkout and runs pnpm install --frozen-lockfile with an empty store. It asserts the install succeeds, installs the patched left-pad bytes, and still resolves is-odd's is-number to 7.0.0, so the user's override holds.
  4. Runs vendor --revert and asserts package.json, pnpm-workspace.yaml and pnpm-lock.yaml are restored byte for byte.

These control tests pass, showing the existing behavior is kept:

  • workspace_overrides_unrecorded_in_lock_keep_the_package_json_copy: pnpm 9 / 10.0–10.4 locks still get the copy.
  • existing_package_json_overrides_keep_the_package_json_copy

Commands run locally:

  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • cargo fmt: the changed hunks are rustfmt-formatted. cargo fmt --all -- --check is not clean on main itself (about 130 files), and CI runs no fmt check.
  • cargo test --workspace --all-features --no-fail-fast: 9728 passed, 12 failed. All 12 are pre-existing permission-based write/remove-failure tests (e.g. vendor_state_write_failure_reports_failed_event uses chmod 0o555). They can't fail as intended in this sandbox because it runs as root, and none touch pnpm. CI runs as non-root and is green.
  • cargo test -p socket-patch-cli --all-features --test e2e_vendor_pnpm_build: 17 passed (1 ignored), re-run on eb4ddc6.
  • cargo test -p socket-patch-core --lib -- vendor::pnpm: 201 passed, re-run on eb4ddc6.
  • Pinned-matrix leg pnpm_pinned_matrix_vendored_lifecycle_and_manifestless_vex with SOCKET_PATCH_PNPM_E2E_VERSION=10.28.0: ok.
  • Wrapper tests: not touched (no npm/, pypi/ or gem/ changes are needed).

CI on eb4ddc6: all 8 Actions workflows that run for these paths passed (CI, pnpm, npm, Bun, vlt, Composer, Benchmarks, Audit GHA Workflows), and Bugbot found no issues.


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 #360
0609405
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 4, 2026
Vendored pnpm 10.5+ with overrides: in pnpm-workspace.yaml: the new package.json pnpm.overrides shadows the user's overrides, so frozen installs fail and a re-lock drops them #360
Closed
@claude
Keep pnpm workspace overrides authoritative
caaea02
On pnpm 10.5+ a project can keep its overrides in
pnpm-workspace.yaml. Vendoring still wrote a package.json
pnpm.overrides copy, which pnpm 10 uses in place of the workspace
overrides. Frozen installs then failed with
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, and a re-lock silently dropped the
user's overrides.

When the lock already records a user override from the workspace file
and package.json has none of its own, vendoring now wires only the
workspace file and the lock. pnpm 9 and 10.0-10.4 never record
workspace overrides, so they keep the package.json copy as before.

Fixes #360

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

Mikola Lysenko (mikolalysenko) commented Oct 4, 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 4, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

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

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.

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

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

All reactions
@claude
Revert unrelated rustfmt churn
eb4ddc6
The previous commit ran rustfmt over the whole workspace, which
reformatted 130 files the fix never touched. Restore them to main so
the PR only carries the pnpm override change and its tests.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 4, 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 4, 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 eb4ddc6. Configure here.

Sorry, something went wrong.

Uh oh!

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

All reactions
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 4, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator Author

[burn-down agent] Ready for review at eb4ddc6075 (eb4ddc6).

  • CI: 97/97 checks green, 3 skipped. Mergeable; 0 commits behind main. Merge state is blocked only on the required approval.
  • Bugbot: reviewed eb4ddc6, found no new issues. No unresolved review threads.
  • What to check: the diff is 2 files (vendor/pnpm_lock.rs plus an e2e test). The 130-file rustfmt churn from the first commit is reverted in eb4ddc6. Look at the workspace_overrides_govern gate, which skips the package.json copy only when the lock records the workspace overrides.

Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

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

Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 5, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) merged commit 13595a7 into main Oct 5, 2026
409 checks passed

Uh oh!

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

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-pnpm-workspace-overrides-shadow branch October 5, 2026 11:37
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 5, 2026
Vendored pnpm refuses a user exact-pin override (left-pad: 1.3.0) in pnpm-workspace.yaml with a misleading "does not match package.json" error, though the same pin in package.json is taken over #854
Closed
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

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Vendored pnpm 10.5+ with overrides: in pnpm-workspace.yaml: the new package.json pnpm.overrides shadows the user's overrides, so frozen installs fail and a re-lock drops them

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.