Repository navigation
Stop attesting a hosted pnpm pin whose registry route pnpm-workspace.yaml no longer declares - #2427
Conversation
Assisted-by: Claude Code
Hosted mode's registry route writes a patch into two files: a namedRegistries entry and an overrides entry in pnpm-workspace.yaml, and the lock in the form pnpm writes for them. pnpm installs that lock only while the file declares both. With the override gone a frozen install fails (ERR_PNPM_LOCKFILE_CONFIG_MISMATCH) and a plain install takes the upstream release back; with the registry gone nothing installs (ERR_PNPM_MISSING_NAMED_REGISTRY). Discovery read the hosted reference from the lock alone, so vex attested not_affected for such a tree. A hosted pin the lock routes through a registry of hosted mode's now keeps the lock's pin only while the root pnpm-workspace.yaml routes the release to that registry at an address that serves the lock's tarball: the test the writer applies to a route it keeps. Otherwise the pin is diagnosed (patched_ref_invalid, with the file, what is missing and the remedy) and is attested only from an installed tree whose every copy verifies, as the pins of a lock pnpm does not read are. The reference itself stays, so a hosted re-scan still reads the pin as the project's and declares the route again, and rollback and remove still restore the upstream entry. Not asked for: a Rush lock, a lock that records no override for the release, and a workspace file that cannot be read or that sets either map in a shape the line reader does not follow. Refs #2404. Assisted-by: Claude Code
Runs the binary over the tree a hosted scan routes, then over the same tree with the override gone, the registry gone, both gone and no pnpm-workspace.yaml. vex attests the first from the lock and none of the others, and names what the file lacks. For each, the remedy the message gives (a hosted re-scan) declares the route again without touching the lock, and vex attests once more. rollback still restores the upstream entry of a pin whose route is undeclared. Refs #2404. Assisted-by: Claude Code
Review of the route check found three states it judged wrongly.
A workspace member with a lock of its own, run from its directory,
has no pnpm-workspace.yaml: the route is in the file above it, which
pnpm reads. The check took that for a missing file and stopped
attesting a pin that installs. Such a run is now left as it was.
A workspace file written as one flow-style mapping, or one that holds
pnpm 12's registries map, was read as declaring no route. Both may
declare it, so the pin stands, as it does for the other shapes the
line reader does not follow.
An emptied inline map (overrides: {}, namedRegistries: ~) was taken
for a shape that may hold the route. It declares nothing, so the pin
now loses the lock's basis there too.
Refs #2404.
Assisted-by: Claude Code
A hosted re-scan over a routed lock whose route the workspace file dropped writes the route back and leaves the lock as it is. Its event now carries pinChanged: true, where it used to carry false: the pin read before the run has no lock basis, and the one read after it has. The run did put a reference of the patch back into the project's files, and the file it rewrote has to be committed, so the test holds the value. Refs #2404. Assisted-by: Claude Code
|
bugbot run Generated by Claude Code |
PR SummaryMedium Risk Overview Discovery now runs
New unit and CLI tests cover override/registry/file-missing cases, member workspaces, re-scan restoring attestation, and rollback. Reviewed by Cursor Bugbot for commit ccccbe6. Configure here. |
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 ccccbe6. Configure here.
|
[agent] PR shepherd: review brief for the approver What it does. Hosted mode's pnpm registry route stores one patch across two files: Risk: low. Only Look here
Verified. I read the whole diff against #2404. The check reuses hosted mode's own readers ( Changes I made. None. Open questions
Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed the full diff at ccccbe6: confirm_pnpm_routes drops locked_integrity for a hosted pin only when the root pnpm-workspace.yaml is readable and no longer declares both the override and a registry serving the lock's tarball, matching the writer's kept_route; the ref is kept so list, re-scan and rollback still see it. No defects found.
Non-blocking note
A namedRegistries entry declared only in global pnpm config or the environment reads as missing; the result is an omitted statement with a warning, not a false attestation.
|
[agent] On the non-blocking note: agreed, and left as it is. The check reads the project's root Generated by Claude Code |
LLM Description written by Claude Code
Fixes #2404.
Problem
Hosted mode's registry route writes one patch into two files: a
namedRegistriesentry and anoverridesentry inpnpm-workspace.yaml, and the lock in the form pnpm writes for them (anoverrides:record and thename@socket-<id>:versionkeys). pnpm installs that lock only while the workspace file declares the route:ERR_PNPM_LOCKFILE_CONFIG_MISMATCH) and a plainpnpm installtakes the upstream release back and rewrites the lock, with no word about the patch;ERR_PNPM_MISSING_NAMED_REGISTRY).vexread the hosted reference from the lock alone and attestednot_affectedin each of those states. Who it hurts: anyone who ships the VEX document. A tree gets there when a merge keeps one side'spnpm-workspace.yamland the other side's lock, or when the workspace file (new after the first scan of a project that had none) is left out of the commit. The issue has the rows on real pnpm 11.29.0 and 12.23.0.Evidence on
main(9f2bc04)The test from the issue, added to core
vex/discover/npm.rsand run before the fix:It passes on this branch, and so does the new CLI test, which runs the binary over the same four states.
Fix
One rule, the writer's own. A hosted pin that the lock routes through a registry of hosted mode's keeps the lock's pin only while the root
pnpm-workspace.yamlroutes that release to that registry, at an address that serves the lock's tarball (kept_routein corehosted/engine.rsasks the same of a route it keeps). The check isconfirm_pnpm_routesin corevex/discover/npm.rs, beside the vendored-override check of #2396, and it reads the workspace file with the readers hosted mode already has (routes,declared,Owned).A pin that fails it is not dropped. It loses the lock's basis, as the pins of a lock pnpm does not read do, so
vexattests it only from an installed tree whose every copy verifies. It is diagnosed aspatched_ref_invalidwith the file, what is missing and the remedy:Keeping the reference matters:
liststill shows the pin, a hosted re-scan still reads it as the project's and writes the route back without touching the lock, androllbackandremovestill restore the upstream entry. The CLI test holds each of those.Not asked for, so those pins stand as before: a Rush lock; a lock that records no override for the release; a workspace file that cannot be read, is not a single block mapping, sets either map in a shape the line reader does not follow, or holds pnpm 12's
registriesmap; and a workspace member run from its own directory, whose settings are in the workspace file above it.Deleted
Nothing.
Behavior change
vexomits a routed pnpm pin whose routepnpm-workspace.yamldoes not declare, unless an installed tree verifies, and warns as above. It attestednot_affectedbefore.details.pinChanged: truefor the pin, where it reportedfalse: the pin it reads before the run has no lock basis and the one after has. The run does put a reference of the patch back intopnpm-workspace.yaml, which then has to be committed, and the contract's wording ("the local dependency files show a new or updated hosted reference") covers that, so the CLI test holds the value. Reviewer: say so iffalseis wanted there; the change would be in CLIscan/pin_changes.rs.main.Risk
Low for a tree the scan wrote: the route is found as the writer finds it, with CRLF, a BOM and an address without its final
/covered. The risk is a false omission for a workspace file that declares the route in a way the readers miss; the shapes known to do that leave the pin standing.Review
/code-review highon the diff gave five findings. Three are fixed in 8a41e6d, each with a test: the member run, the flow-style document andregistriesmap, and the emptied inline map (overrides: {}), which was taken for a shape that may hold the route. Two are left:overrides:record is not checked for its registry. That is the issue's rule (a route the lock itself records), nothing unpatched installs in that state, and widening it is a second rule to measure on real pnpm first.pinChanged, above.Not in this PR
CLI_CONTRACT.mdanddocs/ecosystems.mdare changed by the open #2425 and #2402, so this PR leaves both alone. The sentence for the pnpm paragraph ofdocs/ecosystems.md("Commit both files.") and for the contract's pnpm row of the discovery table: "A routed reference is confirmed bypnpm-workspace.yaml:vexattests it from the lock only while the file declares the registry and the override, and otherwise names what is missing (patched_ref_invalid); a hosted re-scan declares the route again."Not run: real pnpm on this branch (the issue's rows are from
main; the fix changes no file pnpm reads), Windows and macOS.Checks
cargo clippy --locked --workspace --all-features -- -D warnings: clean.in_process_pnpm_registry_cleanup(23, one new),in_process_redirect_pnpm,in_process_rollback_hosted,hosted_memory_engine,hosted_memory_parity,e2e_vex_redirect,e2e_vex,vex,scan,cli,in_process_scan,vendor_pnpm_override_e2e,remove,rollback,report_e2e,in_process_vendor_pnpm_takeover,in_process_get_modes,in_process_get_hosted_ecosystems,e2e_hosted_production,user_patches,e2e_embedded_vex,e2e_bazel_build,mode_migration_npm: all passed.in_process_redirect: 135 passed; its 3 chmod tests fail as root in the sandbox, onmaintoo.Diff
4 files, +626 −1: production +208 −1 (core
vex/discover/npm.rs+160 −1,formats/pnpm/named_registries.rs+41,vex/discover/mod.rs+7), tests +416 (unit +224, CLI +192).https://claude.ai/code/session_011f9aePHgySeqcFGZTWRvcU
Generated by Claude Code