Skip to content

Fix yarn portal copies read as no package (#1579) - #1586

Merged
Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
agent/fix-yarn-portal-copy-unknown
Oct 15, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
agent/fix-yarn-portal-copy-unknown

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #1579

Summary

A yarn berry portal: / link: copy is locked at the placeholder version 0.0.0-use.local, so only its package.json says what it installs. Two shapes from #1579 were dropped as "no package copy". Hosted and vendored scans reported a clean success, and in-run and lock-only vex attested not_affected, while yarn linked unpatched left-pad as node_modules/lp2. Both shapes are now treated as possible unpatched copies: hosted warns redirect_copy_unpatched, vendored warns vendor_copy_unpatched, and vex withholds the contested refs.

Root cause

  • linked_copy_unknown (vendor/yarn_copies.rs) exempted any non-empty directory with no package.json, for both protocols. That exemption only holds for link: (plain assets). Yarn refuses to install a manifest-less portal:, so a placeholder target (a .gitkeep that a fetch step fills) is not what gets installed. CopyRef::Linked didn't record its protocol, so the two couldn't be told apart.
  • A manifest that parsed but had no name or version made CopyRef::identity return None. The manifest_parsed short-circuit then said "not unknown". The file: directory twin already failed closed.

Hosted (through vex discovery), vendored (other_name_copies) and vex (record_copies) share this decision, so the fix sits in that shared code.

Changes

Test evidence

New regression tests, each run against origin/main with only the tests applied (red) and on this branch (green):

Test main branch
vex::discover::yarn::tests::issue_1579_portal_placeholder_and_versionless_linked_manifests_contest FAILED ok
vex::discover::yarn::tests::issue_1579_versionless_linked_manifest_contests_only_its_name FAILED ok
vendor::yarn_berry_lock::tests::issue_1579_portal_placeholder_and_versionless_linked_manifests_are_named FAILED ok
hosted_memory_engine::issue_1579_berry_portal_placeholder_and_versionless_copies_are_named FAILED ok
formats::yarn::copy::tests::linked_name_reads_a_valid_name_only (new API) ok

Each test covers portal: and link: × {.gitkeep placeholder, manifest without name, manifest naming left-pad without version, manifest naming another package without version (control)}. A link: placeholder remains a control, as the issue's matrix documents.

Per-issue checklist:

Local runs:

  • cargo fmt --all -- --check: ok
  • cargo clippy --workspace --all-features -- -D warnings: ok
  • cargo check --workspace --all-targets --all-features: ok
  • cargo test -p socket-patch-core --all-features --lib: 6532 passed. The 4 failures are permission tests (relax_loop_must_not_traverse_symlinked_root, an_unremovable_hidden_lock_keeps_every_store_entry, wire_write_failure_maps_error_and_leaves_lock_untouched, wire_failure_rolls_back_already_written_files). They can't fail as expected when the sandbox runs as root (uid 0). They're unrelated to this change.
  • cargo test -p socket-patch-cli --all-features --test hosted_memory_engine: 45 passed
  • A full cargo test --workspace ran out of sandbox disk while linking every e2e binary. scripts/yarn-berry-vex-matrix.sh 4.18.0 couldn't fetch yarn through corepack here (corepack yarn@4.18.0 unavailable). Both are left to CI (yarn-berry-e2e).
  • Wrappers (npm/, pypi/, gem/) only dispatch to the binary, so they need no change.

/code-review high: findings not fixed

🤖 Generated with Claude Code

https://claude.ai/code/session_01V7mhLTP7oP5FnNRWsDgkHi


Generated by Claude Code

Assisted-by: Claude Code:claude-opus-5-5
A yarn berry portal: or link: copy is locked at the placeholder
version 0.0.0-use.local, so only its package.json says what it
installs. Two shapes were dropped as "no package copy", so hosted
and vendored scans reported a clean success and every VEX path
attested not_affected while yarn linked unpatched code:

- a portal: target with no package.json (a .gitkeep placeholder a
  fetch step fills): yarn refuses a manifest-less portal, so the
  directory on disk is not what gets installed. Only a link: to a
  plain directory is exempt now.
- a manifest with no name or no version. A nameless one may be any
  package; one naming a package but no version may be any version
  of that package, and contests only that package.

The copy now records whether it is a portal or a link, and the
vendored, hosted and vex paths share the decision.

Fixes #1579

Assisted-by: Claude Code:claude-opus-5-5
A portal:/link: copy whose package.json names a package but no
version now gets a vendoring warning that says so, instead of
"whose package can't be read". An empty or invalid name in that
manifest names no package, so the copy is treated as possibly any
package rather than as a copy of a package called "".

Refs #1579

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 15, 2026 19:09
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 bca69dd. Configure here.

Merged via the queue into main with commit 657fce2 Oct 15, 2026
86 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-yarn-portal-copy-unknown branch October 15, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants