GeezerVison is showing github.com — Fix vendored pnpm silence on file: copies (#935) by mikolalysenko · Pull Request #1736 · SocketDev/socket-patch
Conversation
LLM Description written by Claude Code:claude-opus-5-5
Fixes #935
Root cause
#1469 fixed the hosted half of #935. A hosted pnpm scan now warns redirect_copy_unpatched when the same pnpm-lock.yaml also installs a file: directory or tarball copy of the pinned name@version. The vendored pnpm backend (crates/socket-patch-core/src/vendor/pnpm_lock.rs) had no matching check. It writes overrides: {name@version: file:.socket/vendor/…}, which pnpm applies only to the registry edge, and reported success with warnings: [] while the file: copy kept installing unpatched. vex was already honest about it (it declines with patched_ref_unattributable), so the missing piece was the scan-time warning. Yarn berry's vendored backend already warns vendor_copy_unpatched for the same shape (#939).
Changes
vex::discover::npm::pnpm_lock_file_copies: the file: directory and tarball copies of one name@version in a pnpm lock. It classifies entries the way pnpm_entry_ref does and reads them through discovery's own record_pnpm_file_copies: a directory's version comes from its package.json through the guarded reads, and a tarball's version from the lock's version: field. Vendoring and vex therefore agree on which copies count. Copies whose name or version already rules them out are dropped before any read.
- Vendored pnpm preflight, both lock dialects: each such copy is named with a
vendor_copy_unpatched warning (entry key, source, and the "depend on the registry release" remedy). The registry copy is still vendored. The warning shows in dry runs too. The lock is re-parsed only when a v9 key names the package (name@file:) or, for legacy locks, any non-vendor file: line exists.
CLI_CONTRACT.md (vendor_copy_unpatched row) and docs/ecosystems.md (pnpm hosted/vendored notes) now cover pnpm.
Tests (red → green)
To show red, I disabled only the new preflight block and re-ran:
vendor::pnpm_lock::tests::file_copy_of_the_vendored_release_is_named (v9 workspace lock; directory copy, tarball copy; negatives: another version's directory or tarball, an unreadable directory; dry run and real run). Red without the fix: directory dry_run=true: []. Green with it.
vendor::pnpm_lock_legacy::tests::file_copy_of_the_vendored_release_is_named (lockfileVersion 6.0, legacy file:forks/left-pad key whose name comes from name:; a copy of another version is not named). Green.
- Real pnpm:
e2e_vendor_pnpm_build::pnpm_vendor_names_a_file_copy_of_the_vendored_release. This is the issue's workspace repro: member a on registry [email protected], member b on file:../../forks/left-pad, vendor --json, then a fresh --frozen-lockfile install from an empty store. With pnpm 10.28.0 and SOCKET_PATCH_PNPM_E2E_REQUIRED=1: red without the fix (exactly one event names the copy; the envelope had no such event), green with it. a installs the vendored bytes and b keeps the fork, as the warning says.
Per issue:
Local gates
cargo fmt --all -- --check: clean.
cargo clippy --workspace --all-features -- -D warnings: clean. (--all-targets fails on lints in unrelated test files such as crawler_ruby_e2e; none are in files this PR touches.)
cargo test -p socket-patch-core --all-features --lib: 6791 passed, 4 failed. All 4 are chmod/unremovable-file tests that can't fail as root (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_…, pypi_requirements::wire_failure_…). Fix berry unwind under a user yarn patch (#962) #1733 and Fix hosted cargo pins for multi-line inline tables (#757) #1735 list the same four; none touch this diff. After the review commit: pnpm_lock modules 268/268, vex::discover 423/423.
- CLI:
e2e_vendor_pnpm_build 40 passed (I skipped the three two_document legs: they pin packageManager: pnpm@11/12, which this sandbox's proxy can't fetch, and one hung on it), and the other pnpm CLI suite run 39/39.
- I didn't run the full
cargo test --workspace: building every CLI test binary has run these containers out of disk before. CI runs it.
- No wrapper changes (
npm/, pypi/, gem/ only dispatch the binary).
CI
All checks are green on 481393b (37 success, the rest skipped). Cursor Bugbot found no issues on 481393b. The PDM VEX leg went red on 515deee because of unearth 0.19.0, published to PyPI today. The fix is #1738, and its commit is ported here as 481393b (it becomes a no-op once #1738 lands).
/code-review high
Fixed in 515deee:
- per-package re-parse of the whole lock: now only when the lock has a
name@file: key (v9);
- every
file: copy's manifest read before filtering: now filtered by known name/version first;
- no legacy-dialect coverage: legacy test added.
Not fixed, and why:
- A
file: directory outside the project root (file:../sibling-repo/left-pad) is not read, so it is not named. Discovery's guarded reads never leave the root, and hosted mode and vex behave the same today. Widening that is a policy change for all three, not this fix. A tarball outside the root is still named, from the lock's version: field.
- When the release is installed only from a
file: copy, vendoring still refuses with vendor_lock_entry_not_found and its pnpm install remedy, which can't help. That's a separate refusal path (yarn berry has a dedicated message for it). It's a good follow-up but outside Warn during pnpm scans when non-registry copies cannot be patched #935's "warn beside a wired registry entry".
- The entry classification sits next to
pnpm_entry_ref rather than being extracted from it. pnpm_entry_ref interleaves ref, diagnostic and copy handling. The copy reading itself (record_pnpm_file_copies) is shared, and a shared reader means a drift would show in the e2e (vex vs warning).
.socket/vendor/ literal in the quick prefilter: it only decides whether to parse. A stale literal costs a parse, never a wrong warning.
Generated by Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
A pnpm workspace can install the patched release from the registry in
one member and from a file: directory or tarball in another. Vendoring
wires a name@version override, which pnpm applies only to the registry
entry, so the file: copy kept installing unpatched while the scan
reported a clean success with no warning.
The vendored pnpm backend now reads the lock's file: copies the same
way vex discovery does (a directory's version from its package.json)
and names each copy of the vendored release with a
vendor_copy_unpatched warning. The registry copy is still vendored.
Hosted mode already warned with redirect_copy_unpatched.
Fixes #935
Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups. The vendored pnpm check re-parsed the whole lock
for every vendored package whenever any file: line existed, and read
the package.json of every file: copy before filtering. It now parses
only when a v9 key names the package (`name@file:`), and skips copies
whose name or version already rules them out before reading them.
Adds the legacy (pnpm 7/8) lock case to the regression tests.
Refs #935
Assisted-by: Claude Code:claude-opus-5-5
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
unearth 0.19.0 (published 2026-10-27 03:05 UTC) moved to httpx2.
PDM 2.x declares an unbounded unearth, so a fresh bootstrap now
resolves 0.19 and every `pdm lock` fails with "PDMPyPIClient is not
an instance or subtype of type (Client)". That turns the required
`e2e_vex_build` pdm leg red on every PR and in the merge queue,
before any socket-patch code runs.
Pin unearth<0.19 for PDM 2.x in the e2e bootstrap and in
scripts/backtest-pdm.py, which resolves the 0.18 line these releases
ran with until today.
Assisted-by: Claude Code:claude-opus-5-5
(cherry picked from commit 3a9da9e)
|
[agent] The e2e_vex_build PDM leg failed on 515deee for a reason outside this PR. unearth 0.19.0 (published to PyPI today at 03:05 UTC) moved to httpx2, and PDM 2.x's unbounded unearth now resolves it, so pdm lock crashes (PDMPyPIClient is not an instance or subtype of type (Client)) before any socket-patch code runs. Main is affected the same way. The fix is #1738 (pin unearth<0.19 in the PDM bootstrap, red→green locally on pdm 2.29.2). I ported the same commit here so this PR can go green; it becomes a no-op once #1738 lands.
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
cursor[bot] reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 481393b. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Burn-down agent: labeled Ready for review at head 481393b.
- CI: 56/56 check runs on
481393b passed or skipped (37 success, 19 skipped); mergeable with main, no conflicts. No main-wide failures.
- Cursor Bugbot: reviewed
481393b, no findings; no unresolved review threads.
- Reviewer note: the diff also carries the
unearth<0.19 PDM e2e pin from Pin unearth<0.19 in the PDM e2e bootstrap #1738 (needed to get the PDM leg green); whichever of the two merges second will merge cleanly or drop to a no-op there.
- Slack announcement not sent this run (the Slack send tool was unavailable); the next run retries.
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Final review brief
What it does: Fixes the vendored half of #935. When a pnpm lock installs a package from the registry and also a file: directory or tarball copy of the same name@version, the override that vendoring writes only reaches the registry copy. The vendored backend now warns vendor_copy_unpatched for each such copy, as yarn berry already does and as hosted mode does (redirect_copy_unpatched). It still vendors the registry entry. It reuses vex discovery's own file:-copy reader, so vendoring and vex agree on what counts as a copy.
Risk: low. The change adds warnings only. It never refuses, rewrites or changes what gets vendored. The lock is re-parsed only when a cheap line pre-check finds a possible copy.
Look here
- vendor/pnpm_lock.rs:248: preflight pre-check (v9:
name@file: key; legacy: any non-vendor file: line) and the warning
- vex/discover/npm.rs:915:
pnpm_lock_file_copies, which skips Socket wirings, filters by name/version before any read, then reads through the guarded record_pnpm_file_copies
- vendor/pnpm_lock.rs:5899: v9 unit test covering directory, tarball, other-version, unreadable-directory and dry-run cases
- vendor/pnpm_lock_legacy.rs:2662:`` legacy (lockfileVersion 6) case
- e2e_vendor_pnpm_build.rs:1827:``` real-pnpm repro of the issue, with a fresh frozen install
Verified: read the full diff and the PR description, which matches the code. The pre-check excludes the vendored .socket/vendor/ keys, so re-runs stay quiet about Socket's own wiring. Registry entries with no file: key are dropped by pnpm_file_copy. Directory reads go through discovery's guarded reads, so no new path handling was added. The detail lines use lock keys, which pnpm always writes with forward slashes, so nothing here depends on the OS. The tests were red before the fix and green after, per the description. CHANGELOG is untouched. CI 37/37 green (19 skipped) on 481393b, Cursor Bugbot passed, no review threads.
Changes I made: none.
Open questions: none. The head also carries #1738's unearth pin (481393b) so the PDM leg is green. The change is identical, so landing either PR first leaves the other mergeable.
Auto-merge is armed, so approving sends it straight to the merge queue.
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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
Milestone
No milestone
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.
|