Repository navigation
Fix yarn berry absolute portal:/link: copies (#1540) - #1551
Merged
Mikola Lysenko (mikolalysenko) merged 4 commits intoOct 15, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A yarn berry portal: or link: dependency with an absolute path (e.g. "lp2": "portal:/home/me/left-pad") links an unread directory into node_modules. Its lock version is a placeholder, so it may be any version of any package. Socket-patch dropped it, so hosted and vendored scans reported success with no copy warning and `vex` attested not_affected while that copy installed unpatched. Such a copy is now recorded as an unidentified copy of any version: hosted scans warn redirect_copy_unpatched, vendored scans warn vendor_copy_unpatched, and `vex` withholds every package the lock wires, as it already does for an unread file: copy at its version. Fixes #1540 Assisted-by: Claude Code:claude-opus-5-5
Covers #1540 at the CLI level: a hosted yarn berry scan with an absolute portal: or link: dependency must warn redirect_copy_unpatched instead of reporting a clean success. Assisted-by: Claude Code:claude-opus-5-5
Review follow-up for #1540. Treat a portal:/link: copy as possibly any package only when it is never read (an absolute path). A relative link: to a plain directory with no package.json is read, holds no package, and stays ignored as before, so it no longer blocks VEX for the whole lock. Also keep a Windows drive path (portal:C:/...) intact when parsing berry references, word the vendored warning for an unread portal copy without a made-up version, and simplify the expansion of unidentified copies. Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 14, 2026 23:14
Collaborator
Author
|
BugBot review 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 7a3fb87. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 15, 2026
Collaborator
Author
|
Labeled Ready for review at head
Generated by Claude Code |
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-yarn-berry-abs-linked-copy
branch
October 15, 2026 00:56
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1540
Summary
A yarn berry
portal:orlink:dependency with an absolute path ("lp2": "portal:/home/me/shared/left-pad") links a directory intonode_modules/lp2, and socket-patch can't see what that directory holds. Before this PR, hosted and vendored scans reported success with no copy warning, and every VEX path (in-run, lock-only, post-install) attestednot_affectedwhile that copy installed unpatched. Now:redirect_copy_unpatchednaming the entry.vendor_copy_unpatched.vexattests nothing thatyarn.lockwires while the copy is there. This is the same fail-closed rule an unreadfile:copy already gets at its own version (Yarn classic renamed-copy detection (#1489) misses afile:copy outside the project root and a tarball whose root isn'tpackage/, so scans succeed and VEX attests while that copy installs unpatched #1516).Root cause
A lock is untrusted input, so an absolute copy path is deliberately never read (
CopyRef::read_path, #1516). An unreadfile:copy is kept as an unidentified copy at its lock version. Aportal:/link:copy has no lock version (yarn records0.0.0-use.local), so an unread one was dropped in both lockfile discovery (vex/discover/yarn.rs::record_copies) and the vendored backends (vendor/yarn_copies.rs::other_name_copies).Fix
UnidentifiedCopy.versionis nowOption<String>.Nonemeans any version, and the copy is expanded against every ref its lock wires.CopyRef::is_unread_linkedmarks a never-readportal:/link:copy. Discovery records it as an unidentified copy of any version. The vendored backend names it (unidentified wording, no made-up version) and never takes it as proof the package is installed.portal:/link:that is read and holds no versioned package (for examplelink:./assets, a plain directory, whichlink:allows) is still left alone. That way it doesn't block VEX for the whole lock. A control test pins this.berry_copy_refnow cuts only the::locator=bindings and the#selector, not every:. A Windows drive path (portal:C:/Users/me/lp) was being parsed as the relative pathC.docs/ecosystems.mddocuments the absolute-path behavior and points to using a relative path.Tests (red → green)
vex::discover::yarn::tests::issue_1540_absolute_portal_and_link_copies_contest_every_refvendor::yarn_berry_lock::tests::issue_1540_absolute_portal_and_link_copies_are_namedhosted_memory_engine::issue_1540_berry_absolute_portal_and_link_copies_are_namedredirect_copy_unpatched)issue_1540_relative_link_to_a_plain_directory_contests_nothing,absolute_linked_refs_keep_the_path_and_are_unreadLocal runs:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test --workspace --all-features --no-fail-fast: every yarn, vex and hosted suite passes. 10 tests fail only in this sandbox and are untouched by this diff:e2e_bun_lockbtest that reaches the live patches-api.socket.dev, which the sandbox proxy blocks.npm/,pypi/,gem/) changes are needed. This is core discovery logic only.Review notes
/code-review highwas run. Fixed:Not fixed:
vendor_copy_unpatchedper package. Each warning is accurate for its package, and the per-package plans don't share state. The hosted path already de-duplicates by entry.UnidentifiedCopy.versiontype change. The field's type changes on apubstruct, butDiscovery::unidentified_copiesis always empty once discovery returns, and nothing outside the crate reads it.🤖 Generated with Claude Code
Generated by Claude Code