Repository navigation
Stop attesting a vendored pnpm package through an override its pnpm 10 release does not read - #2441
Conversation
Refs #2403. Assisted-by: Claude Code
With pnpm's lockfile setting off, vex attests a vendored package only while the override map the governing pnpm reads routes it to its artifact. That reader went by major and took either map for pnpm 10. Real pnpm 10 reads one of them: package.json alone before 10.5.1, and from 10.5.1 package.json when it declares any override, else pnpm-workspace.yaml. With the override in the other file pnpm installs the registry release, exits 0, and vex said not_affected. The lock-off reader now asks OverrideSource, the rule the lock-on reader has had since #2396, for the release of the pnpm that installed the checkout, else the packageManager pin. When neither names a release of pnpm 10 or older, the override has to be in package.json, where every such pnpm reads it. The detail of vex_lock_not_read names the map that pnpm reads. Refs #2403. Assisted-by: Claude Code
A CLI test runs vex over a vendored pnpm project with the lock off and the override in pnpm-workspace.yaml: attested for pnpm 10.5.1 and 10.28.0, omitted with vex_lock_not_read for 10.4.1 and 10.5.0, and for 10.28.0 once package.json declares overrides of its own. An install record that names no version now leaves the packageManager pin to say which pnpm governs, as it does for the major. When no release is named the detail says why the workspace file was not counted. Refs #2403. Assisted-by: Claude Code
Review findings on the lock-off reader, each run with real pnpm.
A tree pnpm 10.28.0 installed whose packageManager pin then moves
to 10.4.1 was still attested from the workspace file: the install
record outranked the pin. pnpm switches to the pinned release at
the next install, which reads package.json alone and installs the
registry release. The reader now takes the record and the pin, and
the override has to be where each of them reads it. A pin of pnpm
11 is such a release too: it reads the workspace file alone.
"resolutions": null or [], and "pnpm": {"overrides": null}, were
read as declaring overrides, so a workspace override beside them
was no longer attested. pnpm 10.28.0 reads them as declaring none.
A table now declares when it has keys as pnpm counts them: an
object's entries, a string's characters, an array's items.
The detail names the map that has to route the package and what
each named pnpm reads. The docs sentence about package.json is
scoped to the .npmrc setting.
Refs #2403.
Assisted-by: Claude Code
A second review pass ran a packageManager of "pnpm@10" beside an
install record of 10.28.0. pnpm does not switch to such a pin
("not a valid version") and installs with the pnpm at hand, so the
workspace override is read and the artifact installs. The reader
took the pin for an unknown pnpm 10 and asked for the override in
package.json, where main attested.
Only one exact version names a release now, in the record and in
the pin. With no release of pnpm 10 or older named, the override
still has to be in package.json; the second reader the fallback
added there changed no answer and is gone. The detail says that
package.json's overrides are pnpm.overrides or resolutions.
Refs #2403.
Assisted-by: Claude Code
PR SummaryMedium Risk Overview What changes: VEX discovery now uses the same release-aware override routing as the lock-on path ( Code: Reviewed by Cursor Bugbot for commit 85b90a8. Configure here. |
|
bugbot run Generated by Claude Code |
There was a problem hiding this comment.
✅ 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 85b90a8. Configure here.
|
[agent] CI on 85b90a8: one check is red, and it is red on
The same job fails with the same assertion on the push runs of Cursor Bugbot reviewed 85b90a8 and found no issues. Generated by Claude Code |
|
[agent] PR shepherd: review brief for the approver What it does Risk: low. Only VEX attestation changes, and almost entirely in the fail-closed direction: some rows that were attested before are now left out. Install, vendor and hosted writes are untouched. The reader list can't end up empty, which would make Look here
Verified
Changes I made Open questions
Generated by Claude Code |
|
[agent] On the review brief's two open questions, what ran. Neither is decided here. 1. So the VEX differs between machines because the install does: the commit names no release, and pnpm installs with whichever pnpm runs. The CI runner on 10.4.1 is not attested, before or after its install. Three rows of the unit test pin this ( 2. A record of pnpm 11 beside a pin of Generated by Claude Code |
LLM Description written by Claude Code
Fixes #2403.
Problem
With pnpm's
lockfilesetting off, pnpm never readspnpm-lock.yaml, so a vendored package installs from its committed artifact only through an override.vexattests such a package "only while the override map the governing pnpm reads without a lock routes the package" to the artifact (CLI_CONTRACT.md, pnpm with its lockfile off).The reader that applies the rule went by pnpm major and took either file for pnpm 10. Real pnpm 10 reads one of them, by release:
package.jsonalone;pnpm-workspace.yamlonly whilepackage.jsondeclares no override of its own (pnpm.overrides, or the top-levelresolutions).With the vendored override in the file that release does not read,
pnpm installinstalls the upstream release and exits 0. There is no frozen install to fail.vexexits 0 and attestsnot_affected.A project gets there without editing a wiring line:
vendorwrites the override topnpm-workspace.yamlalone when that file already holds overrides (the issue's step 2), and the project later adds aresolutionsentry for another package.The same rule was fixed for the lock-on reader in #2396 (
OverrideSource, with the 10.5.1 boundary). The lock-off reader kept its ownpnpm10flag.Evidence on
main(7d78f2f)Real pnpm,
lockfile=falsein.npmrc, a patchedleft-pad1.3.0 tarball under.socket/vendor/npm/,packageManagerpinning the pnpm that runs:The binary and real pnpm 10.28.0 on one tree. The vendored tree of a project whose
pnpm-workspace.yamlhas an override of its own, then aresolutionsentry for another package added topackage.json:Two tests, red on
mainand green here. The unit test from the issue, beside the existing lock-off test:and a CLI test in
e2e_vex_vendor, run against the binary built frommain's sources:The fix
One answer to "which file does this pnpm read overrides from":
OverrideSource, for both lock states.formats/pnpm/version.rsgainsgoverning_override_sources: theOverrideSourceof each pnpm that governs the project's settings. Those are the releasenode_modules/.modules.yamlrecords and the onepackageManagerpins, the two files the contract reads the major from. Only one exact version names a release.utils/pnpm_workspace.rs:lockfile_off_override_sourcesreturns where each pnpm that installs the project with its lock off reads its overrides. First the named releases. Then, for the settings file that turns the lock off: the workspace file for pnpm 11 and newer; for pnpm 10 and older with no release named,package.json, where every such pnpm reads an override.vex/discover/npm.rs:PnpmLockOff::routesis "every one of those readers reads the override" (OverrideSource::reads, the function the lock-on check calls). "Declares any override" is counted as pnpm counts it: a table with keys.vex_lock_not_readnames the map that has to route the package and what each named pnpm reads.The unit test has 30 rows, each with what real pnpm installs: the four from the issue, controls that must still attest, the install record against the pin, override tables that are not objects, and no release named.
What the review found
An independent review ran
/code-review highon the first cut and checked each finding with real pnpm.mainattests it too.package.jsonalone, patched with it in both files)."resolutions": nullor[]and"pnpm": {"overrides": null}were read as declaring overrides, so a workspace override beside them stopped attesting. pnpm 10.28.0 reads them as declaring none (ran)."pnpm": {"overrides": "x"}has keys, and pnpm installs the upstream release beside it (ran); it is omitted.docs/ecosystems.mdheld only when.npmrcis what turns the lock off.package.yaml, with overrides of its own there, is attested from the workspace file (ran; the same onmain, in both lock states).socket-patch vendorrefuses a pnpm project with nopackage.json(ran: "cannot read package.json"), so the tree needs a manifest converted after vendoring. Recorded as a lead in the routine's ledger.A second, shorter pass on the reworked diff, again with real pnpm:
packageManagerthat is not one exact version (pnpm@10), beside an install record of 10.28.0, was taken for an unknown pnpm 10 and the tree was omitted. pnpm does not switch to such a pin ("not a valid version") and installs the artifact with the pnpm at hand (ran, also forpnpm@^10.6.0).main."pnpm": {"overrides": "x"}or a non-empty array there, where a frozen install fails and a plain one installs the upstream release (ran; the same onmain).resolutionscounts.The fixes for the second pass were not reviewed again.
Deleted
lockfile_off_sourcesand its(bool, bool, Option<u32>)answer, andPnpmLockOff'sneeds_workspace,needs_manifestandpnpm10fields.Behavior change
vexonly. No JSON shape, flag, exit code or file format changes:vex_lock_not_readand its exit code are the ones this state already had for a package no override routes.vex_lock_not_read), where pnpm installs the upstream release:packageManagerpin name pnpm releases that read different files, with the override in only one of them;"pnpm": {"overrides": "<text>"}or a non-empty array there, beside a workspace-only override."packageManager": "pnpm@10"and no install record) with the override in the workspace file alone.mainattested it;package.jsonthat cannot be read or is not JSON, beside a workspace-only override on pnpm 10.5.1 and newer. pnpm cannot install such a project either.nullor empty override tables.CLI_CONTRACT.mdanddocs/ecosystems.mdstate the release rule in the paragraphs that described the old one.Left out
resolutionstreesocket-patch vendorstill says "1 package is already vendored; nothing to do", andvendor --checkexits 0, which the contract allows for a lock pnpm does not read. The issue names this as outside its plan; it is the writer gap onvendor --checkandvexcall a vendored pnpm package patched when no file the project's pnpm reads declares its override: after a move from pnpm 9 to 11 or 12 every frozen install fails and a plainpnpm installputs the upstream package back #2382.vex_lock_not_readstill says to drop the setting. That works in two steps: with the lock on, Stop attesting a vendored pnpm package whose override no settings file declares #2396's check names the missing declaration and the entry to add. The detail before it now names the map that has to hold the override.package.yamlandpackage.json5root manifests, and the lock-on reader beside an override table that is a string or an array (the review tables).Risk
A missed attestation in the "files do not say" states above, and in the window between a pin change and the next install. A wrong
OverrideSourceboundary would show in both lock states at once; its measurements are inversion.rs.No
cfg(windows)orcfg(unix)code changed.Verification
Local, on 85b90a8:
cargo clippy --locked --workspace --all-features -- -D warnings: clean.e2e_vex_vendor,vendor_pnpm_override_e2e,e2e_vex_lockfile,vex,e2e_vex,e2e_vex_redirect,cli,in_process_vendor_pnpm_takeover,in_process_vendor_pnpm_parent_child,in_process_redirect_pnpm,hosted_memory_parityande2e_vendor_pnpm_build.CI on 85b90a8: 58 checks pass and one fails (73 are skipped by path). The failure is
main's:install-proof (node 24.11.1), on its pnpm 11.0.0 leg (e2e_vendor_pnpm_build.rs:1263,vendor_unwiredafter a reinstall, with the lock on). The same job fails the same assertion on the push runs ofmainat 7d78f2f, 545ea83 and 6280589, and passes on #2434, the open fix for it. Nothing was re-run or changed here for it.Cursor Bugbot reviewed 85b90a8 and found no issues.
git diff --stat: 7 files, +490 −44. Production +158 −38 (vex/discover/npm.rs,utils/pnpm_workspace.rs,formats/pnpm/version.rs,formats/pnpm/mod.rs). Tests +324 −5. Contract and docs +8 −1.Generated by Claude Code