Repository navigation
Description
[agent] Found by the architecture refactor routine on main at cfc870f, with real pnpm 9.15.9, 10.28.0, 11.29.0 and 12.23.0.
The problem
pnpm installs a lock only when the lock's overrides: equal the overrides its settings declare. When they differ, a frozen install stops with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, and a plain pnpm install resolves again: it takes the package from the registry, rewrites the lock without the vendored entry and exits 0. Which file holds those settings depends on the pnpm major: pnpm.overrides in package.json for pnpm 9, either file for pnpm 10, overrides: in pnpm-workspace.yaml alone for pnpm 11 and 12.
vendor --check and vex read a vendored pnpm package from pnpm-lock.yaml alone. With the override declared in no file the project's pnpm reads:
socket-patch vendor --checkexits 0: "committed artifact and wiring verified";socket-patch vexexits 0 and attestsnot_affected;socket-patch vendor --dry-runprints "1 package is already vendored; nothing to do.";- every frozen install (CI) fails, and the install pnpm then suggests ("Update your lockfile using
pnpm install --no-frozen-lockfile") puts the upstream package back with no word about the patch.
Two ways a project gets there with no hand edit of a wiring file:
- A pnpm upgrade. Under pnpm 9,
vendorwritespackage.jsonandpnpm-lock.yamland nopnpm-workspace.yaml. Move the project to pnpm 11 or 12 and no file pnpm reads declares the override. Nothing in the checkout changed. pnpm-workspace.yamlleft out of the commit on pnpm 11 or 12. It is a new file after the first vendored run, andpackage.jsonand the lock are the two a reviewer expects to see change.
The rule is already in the code and the contract for the other package managers that pair a lock with a manifest:
- Yarn Berry: the
file:entry "plus a rootpackage.jsonresolutionsmapping onto the same artifact (without it the entry is orphaned: diagnosed, no ref)". - Cargo: the lock entry is "confirmed by
Cargo.toml[…] Cargo resolves a dependency from the source its declaration names, so without one cargo takes the crate from crates.io and rewrites the lock, or fails under--locked(Cargo VEX: an ignored [patch] Socket pin still attests a transitive crate; bypass remedies name ambiguous or incomplete commands #2045)". - Bundler: "a frozen install fails, an unfrozen one rewrites the lock to the upstream one and installs the upstream gem […] So a section the manifest does not name […] withholds the ref".
- pnpm itself, with its
lockfilesetting off (Hosted pnpm scan pins a pnpm-lock.yaml that pnpm is configured to ignore (lockfile=false/lockfile: false), reports success, and lock-only VEX attests not_affected while pnpm installs the upstream package #1074): "a vendored reference is attested only through an override pnpm reads without the lock". The reader for that case knows which map each pnpm major reads (PnpmLockOff, corevex/discover/npm.rs, lines 1048 to 1070). It is consulted only when the lock is off.
The fixtures agree. With the lock vendored and the manifest put back, vex refuses Cargo ("no [patch] entry in Cargo.toml […] not counted") and Bundler ("Gemfile declares alpha with no source of its own […] not counted"), and attests pnpm.
With the lock on, pnpm_vendored_ref (the same file, line 1581) makes the reference from the lock entry, and the per-backend audit of vendor --check (check_npm_wiring, core vendor/npm_flavor.rs) looks only for dependencies the lock does not resolve. The writer knows the rule: its closing line says "pnpm >=11 reads the vendored override only from pnpm-workspace.yaml", and a wet vendor over such a tree writes the missing override back.
Evidence
With real pnpm
A project that depends on left-pad 1.3.0, installed by each pnpm, with a stand-in patch record that appends a comment to index.js. socket-patch is the binary built from main, with the vendor suite's fixture service. Each row starts from the tree vendor wrote under that pnpm and takes the override out of one place; "installed" is what node_modules/left-pad/index.js holds afterwards.
| pnpm | Override missing from | vendor --check |
vex |
pnpm install --frozen-lockfile |
pnpm install |
|---|---|---|---|---|---|
| 9.15.9 | nowhere (as vendored: package.json and the lock) |
exit 0 | not_affected |
patched | patched |
| 9.15.9 | package.json |
exit 0 | not_affected |
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH |
upstream, exit 0, lock unwired |
| 10.28.0 | package.json or pnpm-workspace.yaml (one of them) |
exit 0 | not_affected |
patched | patched |
| 10.28.0 | both | exit 0 | not_affected |
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH |
upstream, exit 0, lock unwired |
| 11.29.0 | package.json |
exit 0 | not_affected |
patched | patched |
| 11.29.0 | pnpm-workspace.yaml |
exit 0 | not_affected |
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH |
upstream, exit 0, lock unwired |
| 12.23.0 | pnpm-workspace.yaml |
exit 0 | not_affected |
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH |
upstream, exit 0, lock unwired |
The upgrade, with no file touched: the tree pnpm 9.15.9's vendored run left (package.json, pnpm-lock.yaml, .socket/), with no node_modules.
$ socket-patch vendor --check # exit 0
pkg:npm/left-pad@1.3.0: committed artifact and wiring verified
$ socket-patch vex --product pkg:npm/app@1.0.0 # exit 0
Emitted 1 VEX statement
"status": "not_affected",
"impact_statement": "Patched via Socket patch 11111111-… (vendored)"
$ pnpm install --frozen-lockfile # pnpm 11.29.0, exit 1
[WARN] The "pnpm" field in package.json is no longer read by pnpm. The following keys were ignored: "pnpm.overrides". See https://pnpm.io/settings for the new home of each setting.
[ERR_PNPM_LOCKFILE_CONFIG_MISMATCH] Cannot proceed with the frozen installation. The current "overrides" configuration doesn't match the value found in the lockfile
Update your lockfile using "pnpm install --no-frozen-lockfile"
$ pnpm install # exit 0
[WARN] The "pnpm" field in package.json is no longer read by pnpm. The following keys were ignored: "pnpm.overrides". […]
dependencies:
+ left-pad 1.3.0 deprecated
Done in 682ms using pnpm v11.29.0
$ grep -c socket/vendor pnpm-lock.yaml
0
$ grep -c PATCHED node_modules/left-pad/index.js
0
$ socket-patch vendor --check # exit 1, now that the lock is unwired
pkg:npm/left-pad@1.3.0: wiring missing: no lockfile or config references .socket/vendor/npm/11111111-… any more, so a fresh install gets the unpatched package; re-run `socket-patch vendor` to rewire it
pnpm says what it ignored. socket-patch says nothing until pnpm has rewritten the lock.
pnpm 12.23.0 gives the same two results (Error: ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, then the upstream package).
On pnpm 11.29.0 with pnpm-workspace.yaml deleted, a wet socket-patch vendor reports "Vendored 1 package." and writes the file back with the override, after vendor --dry-run said there was nothing to do.
A test that fails on main
For any suite that loads vendor_ecosystem_fixtures:
/// pnpm installs a lock only when the lock's `overrides:` equal the ones its
/// settings declare. With the override declared nowhere, a frozen install
/// fails (ERR_PNPM_LOCKFILE_CONFIG_MISMATCH) and a plain one resolves the
/// package from the registry again.
#[test]
fn pnpm_lock_without_its_override_is_not_verified() {
let f = Fixture::new("pnpm");
let manifest = std::fs::read(f.root.join("package.json")).unwrap();
let (code, stdout, stderr) = f.vendor(&[], &[]);
assert_eq!(code, 0, "{stdout}\n{stderr}");
std::fs::write(f.root.join("package.json"), &manifest).unwrap();
std::fs::remove_file(f.root.join("pnpm-workspace.yaml")).unwrap();
assert!(std::fs::read_to_string(f.root.join("pnpm-lock.yaml"))
.unwrap()
.contains(".socket/vendor/npm/"));
let (code, ..) = f.run(&["vendor", "--check"], &[]);
let (_, vex, _) = f.run(&["vex", "--product", "pkg:npm/app@1.0.0"], &[]);
let attested = vex.matches("\"status\": \"not_affected\"").count();
assert_eq!((code, attested), (1, 0), "(vendor --check exit code, not_affected statements)");
}test pnpm_lock_without_its_override_is_not_verified ... FAILED
assertion `left == right` failed: (vendor --check exit code, not_affected statements)
left: (0, 1)
right: (1, 0)
Not run: pnpm 7 and 8 (the legacy lock), a workspace with members, Rush, a project that pins its pnpm with packageManager, and hosted mode's registry route, whose locks carry overrides: too.
Planned fix
One rule for both lock states: a vendored pnpm reference counts only when the override map the project's pnpm reads names its artifact. The lock-off reader already answers which map that is (node_modules/.modules.yaml, else packageManager, else the lock's grammar; either map when none says), so the change is to consult it with the lock on as well.
vexwithholds the reference and names the file that lacks the override.vendor --checkfails the entry with the same sentence and the remedy (socket-patch vendor, then commit the file).vendor --dry-runcounts the package as one it would re-wire.- The contract's pnpm row gains the confirmation the Yarn Berry, Cargo and Bundler rows have.
One thing this does not settle, for a maintainer: a project vendored under pnpm 9 has no pnpm-workspace.yaml, and when nothing records the pnpm major the rule above accepts the package.json override, so the upgrade case is caught only once the checkout says which pnpm it uses. Whether vendor should write the workspace override under pnpm 9 as well is a change to what vendored mode writes, and #360 shows the two maps interact, so I have left it out of the plan.
Related: #2381 is the same gap between the writer's rule and the two verifiers, for NuGet's lock pin.
Generated by Claude Code
Activity
refactor: #2381 to #2383 filed; vendored stops ran
mikolalysenko commentedon Dec 1, 2026
[agent] Claiming this for the architecture refactor routine. Branch: arch-refactor/2382-pnpm-override-confirms-vendored.
Re-run on
mainat 1b3f422: the issue's test still fails the same way,(vendor --check exit code, not_affected statements)is(0, 1)where(1, 0)is right.Generated by Claude Code
Test that pnpm reads a vendored override
Ask pnpm's settings for a vendored override
Read overrides as each pnpm release does
Read pnpm's committed pins and resolutions
Give the by-hand entry where a re-run is idle
mikolalysenko commentedon Dec 1, 2026
[agent] #2396 is ready for review. It makes
vendor --checkandvexask where the project's pnpm reads its overrides, measured on real pnpm 8.15.9 to 12.23.0. Two things in this issue's text turned out different on the real tool:overrides:frompnpm-workspace.yamlfrom 10.5.1 on, not from 10.5: 10.2.0, 10.4.1 and 10.5.0 refuse a lock whose override is only there.package.jsonis read in place of the workspace file whenever it declares any override (pnpm.overrides, or the top-levelresolutions), so "either file" holds only whilepackage.jsondeclares none.What #2396 does not do, each seen while testing it:
vendordoes not restore apackage.jsonoverride while the workspace file carries one the lock records. With pnpm older than 10.5.1 (9.15.9, 10.2.0, 10.4.1, 10.5.0), or beside aresolutionstable (10.28.0),socket-patch vendorprints "already vendored; nothing to do" and the frozen install still fails. The writer skips thepackage.jsoncopy when the lock records a workspace override key, which its own surgery makes true on any pnpm. Stop attesting a vendored pnpm package whose override no settings file declares #2396 gives the entry to add by hand in that case;vendor --revertfollowed byvendoralso repairs it. A fix belongs in the writer and needs the committed pins there.vendor --dry-runstill previews "already vendored" over a tree whose wet run rewrites the declaration (planned-fix bullet 3 of this issue).lockfilesetting off, a workspace override is accepted for every pnpm 10. Read, not run.overrides:to the lock and the workspace file; its references are not checked against the declaration. Read, not run.The question this issue leaves for a maintainer still stands: whether
vendorshould write the workspace override under pnpm 9 as well. With #2396 the upgrade from pnpm 9 to 11 is caught oncepackage.jsonnames the pnpm (packageManager,devEngines,engines.pnpm); a project with no pin is judged leniently.Generated by Claude Code
refactor: #2396 opened for #2382; pnpm override declarations ran
Name an empty inline overrides mapping