Repository navigation
Fix yarn berry parent-scoped resolutions (#783) - #1705
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits intoOct 24, 2026
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits into
Mikola Lysenko (mikolalysenko) merged 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A yarn berry project that pins a package for one workspace with a parent-scoped resolutions entry (for example "pkg-a/left-pad") used to get a vendored "success" that broke every `yarn install --immutable` with YN0028, and a plain install silently dropped the patch. The vendored conflict gate now names each resolutions selector the same way hosted mode does, so parent-scoped and glob selectors that override the patched package refuse with vendor_override_conflict and nothing is written. The bare exact-version takeover is unchanged. Fixes #783 Assisted-by: Claude Code:claude-opus-5-5
Vendoring only writes the bare package key, so a parent-scoped resolutions selector that happens to point into .socket/vendor is not ours to skip: it now refuses like any other parent-scoped override. The refusal message now says that only a bare exact-version pin is taken over. The #783 e2e keeps checking the remaining selector when one fixture install is skipped. Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 24, 2026 00:56
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 c5524a1. Configure here.
Collaborator
Author
|
Ready for review (burn-down agent).
Generated by Claude Code |
Collaborator
Author
|
Labeled Ready for review (burn-down agent).
Generated by Claude Code |
Tanmay Singla (Tanmay182003)
approved these changes
Oct 24, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-yarn-berry-parent-scoped-resolutions
branch
October 24, 2026 02:54
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 #783
Summary
When a yarn berry project has a parent-scoped
resolutionsentry for a package (for example"pkg-a/left-pad": "1.3.0"), vendored mode used to add its own bare pin next to it and report success. The lock it left behind failed everyyarn install --immutablewith YN0028, and a plainyarn installquietly dropped the patch. Vendored mode now refuses withvendor_override_conflictand writes nothing, which is what hosted mode already did for these selectors.Root cause
resolutions_gate(vendor/yarn_berry_lock.rs) got each selector's package name fromsplit_pattern, which only understands a barename@rangedescriptor. Forpkg-a/left-pad,pkg-a/left-pad@^1.3.0,<root>/left-pad,@scope/parent/left-padand**/left-padit returned the whole string, which never equalsleft-pad, so the gate skipped the selector. The gate now usesresolution_selector_target, the same helper that hosted mode and the vendored revert and prune paths already use. The bare exact-version takeover ("left-pad": "1.3.0") works as before.Review follow-up: the gate also treated any selector whose value pointed into
.socket/vendoras our own entry. Vendoring only ever writes the bare key, so a parent-scoped selector with a vendor path now refuses too. The refusal message now says that only a bare exact-version pin is taken over.Tests (red → green)
vendor::yarn_berry_lock::tests::parent_scoped_resolutions_selector_is_refused(5 selector shapes refuse and write nothing; a parent-scoped vendor-path selector refuses;left-pad/is-oddstill vendors)expected Refused vendor_override_conflict, got Done (success=true)e2e_vendor_yarn_berry_build::issue_783_parent_scoped_resolution_refuses_vendoring(real yarn 4.18.0,pkg-a/left-padandpkg-a/left-pad@^1.3.0: vendor exits 1, package.json and yarn.lock are byte-identical, andyarn install --immutablestill passes)pkg-a/left-pad: vendor must refuseCommands run locally:
cargo fmt --all -- --checkpassed.cargo clippy --workspace --all-features -- -D warningspassed.cargo test -p socket-patch-core --all-features --lib: 6721 passed, 4 failed. The 4 failures (copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouched,pypi_requirements::wire_failure_rolls_back_already_written_files) are only in this sandbox. They inject write failures withchmod 0o555, and the sandbox runs as root, which ignores that. None of them touch yarn.cargo test -p socket-patch-cli --all-features --lib: 933 passed.SOCKET_PATCH_YARN_BERRY_VERSION=4.18.0andSOCKET_PATCH_YARN_E2E_REQUIRED=1:e2e_vendor_yarn_berry_build45 passed,e2e_redirect_yarn_berry_build37 passed.cargo test --workspaceall the way here: linking every integration-test binary used up the sandbox's disk allowance. CI runs the full suite.The npm, pypi and gem wrappers only dispatch to the binary, so none of them needed a change.
Review notes (/code-review high)
Fixed:
returninside the e2e selector loop is nowcontinue.Not fixed:
left-pad@npm:1.3.0/is-odd): this overrides a different package beneath the vendored one. Once vendoring rewires left-pad to afile:locator, yarn may stop applying it. That behaviour predates this PR and is a different selector shape from Vendored yarn berry misses a parent-scoped userresolutionsentry (pkg-a/left-pad), reports success, and everyyarn install --immutablefails YN0028 #783, so it is left for a follow-up." left-pad"): yarn never applies these. Refusing one is harmless and very unlikely to happen in practice.https://claude.ai/code/session_0159LsG26iAJ1u2wK477EeVu
Generated by Claude Code