Repository navigation
Description
[agent] Found by the architecture refactor routine on main at 1b3f422, with real pnpm 9.15.9, 10.4.1, 10.5.0, 10.5.1 and 10.28.0.
The problem
With pnpm's lockfile setting off, pnpm never reads pnpm-lock.yaml, so a vendored package installs from its committed artifact only through an override. The contract states the rule (CLI_CONTRACT.md, pnpm with its lockfile off, #1074): vex attests such a reference "only while the override map the governing pnpm reads without a lock routes the package […] to the same artifact".
The reader that applies it goes by pnpm major (PnpmLockOff::routes, core vex/discover/npm.rs, lines 1113 to 1127): for a project that pins pnpm 10 it accepts the override from package.json or from pnpm-workspace.yaml. Real pnpm 10 reads one of them:
- pnpm 10.0 to 10.5.0 read
package.jsonalone; - pnpm 10.5.1 and newer read
pnpm-workspace.yamlonly whilepackage.jsondeclares no override of its own (pnpm.overrides, or the top-levelresolutions).
With the vendored override in the workspace file only, on those releases:
pnpm installinstalls the upstream release and exits 0. Nothing fails: with the lock off there is no frozen install to refuse the mismatch, and pnpm's only word is "A pnpm-lock.yaml file exists. The current configuration prohibits to read or write a lockfile".socket-patch vexexits 0 and attestsnot_affected, before and after that install. After it, the warning beside the statement says "re-run your package manager's install to resync it", and the re-run installs the upstream release again.socket-patch vendorandvendor --dry-runprint "1 package is already vendored; nothing to do."socket-patch vendor --checkexits 0, which the contract allows for a lock pnpm does not read (vex_lock_not_read: "vendor --checkandscanstill treat the wiring as live").
With the lock on, the same files are #2382: a frozen install fails with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, and #2396 makes vex and vendor --check refuse them. #2396 leaves the lock-off reader as it is (its description lists that), and its binary (82814cb) gives the same answers as main on every lock-off row below.
A project gets there with no hand edit of a wiring line:
- A pnpm 10.28.0 project with
lockfile=falsein.npmrc, apnpm-lock.yamlin the tree and overrides of its own inpnpm-workspace.yaml. socket-patch vendorwrites the vendored override to the workspace file and the lock, and nopnpm.overridestable (a new table would replace the workspace overrides, Vendored pnpm 10.5+ withoverrides:in pnpm-workspace.yaml: the new package.jsonpnpm.overridesshadows the user's overrides, so frozen installs fail and a re-lock drops them #360).pnpm installinstalls the patched copy.- The project adds a
resolutionsentry for another package topackage.json. pnpm now readspackage.jsonin place of the workspace file, and the nextpnpm installputs the upstreamleft-padback.
I know no way to the rows on pnpm 10.4.1 and 10.5.0 that does not take the package.json override out by hand. Only a project that keeps a pnpm-lock.yaml beside the setting can be vendored at all: with no lock, vendor refuses ("vendoring rewires the lockfile, so one must exist").
Evidence
With real pnpm
A project that depends on left-pad 1.3.0, a stand-in patch record that prepends a comment to index.js, the binary built from main and the vendor suite's fixture service. Every row has lockfile=false in .npmrc, the vendored pnpm-lock.yaml and .socket/, and pins its pnpm with packageManager. "Installs" is what node_modules/left-pad/index.js holds after that pnpm's pnpm install; vex gave the same answer before and after the install.
| pnpm | Vendored override in | package.json also declares |
pnpm install installs |
vex |
|---|---|---|---|---|
| 9.15.9 | pnpm-workspace.yaml |
nothing | upstream | no statement (vex_lock_not_read) |
| 10.4.1 | package.json |
nothing | patched | not_affected |
| 10.4.1 | pnpm-workspace.yaml |
nothing | upstream, exit 0 | not_affected |
| 10.5.0 | pnpm-workspace.yaml |
nothing | upstream, exit 0 | not_affected |
| 10.5.1 | pnpm-workspace.yaml |
nothing | patched | not_affected |
| 10.28.0 | pnpm-workspace.yaml |
nothing | patched | not_affected |
| 10.28.0 | both files | nothing | patched | not_affected |
| 10.28.0 | pnpm-workspace.yaml |
pnpm.overrides for another package |
upstream, exit 0 | not_affected |
| 10.28.0 | pnpm-workspace.yaml |
resolutions for another package |
upstream, exit 0 | not_affected |
The three steps above, run as written (pnpm 10.28.0; the project's own workspace override is is-number: 7.0.0):
$ socket-patch vendor # step 2
Vendored 1 package.
$ grep -c '"pnpm"' package.json
0
$ cat pnpm-workspace.yaml
packages:
- "."
overrides:
is-number: 7.0.0
left-pad@1.3.0: file:.socket/vendor/npm/1a2b3c4d-5e6f-4a1b-8c2d-0123456789ab/left-pad-1.3.0.tgz
$ pnpm install && grep -c SOCKET-PATCHED node_modules/left-pad/index.js
1
# step 3: "resolutions": { "is-number": "7.0.0" } added to package.json
$ rm -rf node_modules && pnpm install # exit 0
WARN A pnpm-lock.yaml file exists. The current configuration prohibits to read or write a lockfile
WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
dependencies:
+ is-number 7.0.0
+ left-pad 1.3.0 deprecated
$ grep -c SOCKET-PATCHED node_modules/left-pad/index.js
0
$ 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
Warning: pkg:npm/left-pad@1.3.0: the installed tree does not match its vendored artifact; the attestation is based on the committed .socket/vendor artifact (the project's lockfile or package-manager config wires it in), but the live tree carries different bytes — re-run your package manager's install to resync it.
"status": "not_affected",
"impact_statement": "Patched via Socket patch 1a2b3c4d-5e6f-4a1b-8c2d-0123456789ab (vendored)"
Emitted 1 VEX statement
$ socket-patch vendor # exit 0
1 package is already vendored; nothing to do.
$ rm -rf node_modules && pnpm install && grep -c SOCKET-PATCHED node_modules/left-pad/index.js
0
A test that fails on main
Beside pnpm_disabled_lockfile_attests_a_vendored_ref_only_through_an_override in core vex/discover/npm.rs, whose last block pins "a pinned pnpm 10 reads either map" with 10.34.1 and no override in package.json:
#[tokio::test]
async fn pnpm_disabled_lockfile_reads_the_map_its_pnpm_10_release_reads() {
let rel = format!(".socket/vendor/npm/{UUID_B}/left-pad-1.3.0.tgz");
let lock = format!(
"lockfileVersion: '9.0'\n\nimporters:\n\n .:\n dependencies:\n left-pad:\n \
specifier: file:{rel}\n version: file:{rel}\n\npackages:\n\n \
left-pad@file:{rel}:\n resolution: {{integrity: {SRI}, tarball: file:{rel}}}\n \
version: 1.3.0\n"
);
const PURL: &str = "pkg:npm/left-pad@1.3.0";
let workspace = format!("packages:\n - '.'\noverrides:\n left-pad@1.3.0: file:{rel}\n");
let mut attested = Vec::new();
for (pnpm, own) in [
("10.4.1", ""),
("10.5.0", ""),
("10.28.0", r#","pnpm":{"overrides":{"is-number":"7.0.0"}}"#),
("10.28.0", r#","resolutions":{"is-number":"7.0.0"}"#),
] {
let p = Project::new();
p.write("pnpm-lock.yaml", &lock);
p.write(".npmrc", "lockfile=false\n");
p.write("pnpm-workspace.yaml", &workspace);
p.write(
"package.json",
format!(
r#"{{"name":"app","packageManager":"pnpm@{pnpm}","dependencies":{{"left-pad":"1.3.0"}}{own}}}"#
),
);
let out = run(&p).await;
assert_refs(&out, &[(PURL, UUID_B, WiringMode::Vendored)]);
if marks(&out, PURL).is_empty() {
attested.push(format!("pnpm@{pnpm}{own}"));
}
}
assert!(
attested.is_empty(),
"attested from pnpm-workspace.yaml, which that pnpm does not read: {attested:#?}"
);
}test vex::discover::npm::tests::pnpm_disabled_lockfile_reads_the_map_its_pnpm_10_release_reads ... FAILED
attested from pnpm-workspace.yaml, which that pnpm does not read: [
"pnpm@10.4.1",
"pnpm@10.5.0",
"pnpm@10.28.0,\"pnpm\":{\"overrides\":{\"is-number\":\"7.0.0\"}}",
"pnpm@10.28.0,\"resolutions\":{\"is-number\":\"7.0.0\"}",
]
Not run: pnpm 11 and 12 (they read the workspace file alone, and the reader asks for it there), a workspace with members, Rush, and a checkout whose node_modules/.modules.yaml names another pnpm than packageManager.
Planned fix
One answer to "which file does this project's pnpm read overrides from". #2396 adds it for the lock-on case, at release precision and from the committed pins (pinned_override_sources, with the 10.5.1 boundary and the package.json-declares-any rule). PnpmLockOff::routes asks that instead of its own pnpm10 flag, so the two lock states cannot drift again. This waits for #2396.
vexwithholds the reference (vex_lock_not_read), and the detail names the file that pnpm reads.- The contract's sentence "a pinned pnpm 10 also reads the
pnpm-workspace.yamlmap" gets the release boundary and thepackage.jsoncondition.
Not in this plan: the writer. In step 3's tree vendor says "already vendored" because it skips the package.json copy while the workspace file carries an override the lock records, and it looks for pnpm.overrides there, not resolutions. That is the writer gap noted in #2382's comment; with the lock off it is the reason no re-run repairs the tree.
Related: #2382 and #2396 (the same files with the lock on).
Generated by Claude Code
Activity
refactor: #2403 and #2404 filed; L121 to L123 ran
mikolalysenko commentedon Dec 2, 2026
[agent] Claiming this for the architecture refactor routine. Branch: arch-refactor/2403-pnpm-lock-off-override-source.
Confirmed again on
mainat 7d78f2f: the unit test in this issue still fails with all four rows attested, and real pnpm 10.4.1, 10.5.0, 10.5.1 and 10.28.0 install what the table says.Generated by Claude Code
Read lock-off pnpm overrides by release
Test vex over a lock-off pnpm tree by release
Ask every pnpm the project names; count real keys
Count only an exact version as a pnpm release
refactor: #2441 opened for #2403, ready; #2427 and #2428 merged