GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — Fix berry hosted pin beside a later registry entry (#1082) by mikolalysenko · Pull Request #1397 · SocketDev/socket-patch Conversation
|
| Case | Test | Without fix |
|---|---|---|
| Re-scan folds a later range, with the same and with a superseding uuid. The folded pin is stable, and two plain registry entries stay ambiguous | core redirect::tests::yarn_berry_rerun_folds_a_descriptor_added_after_pinning |
redirect_yarn_berry_ambiguous_entry |
Hosted rollback and remove merge into a later plain entry and into an alias entry |
cli in_process_redirect::yarn_berry_unwind_merges_into_a_registry_entry_added_after_pinning |
two entries with one resolution |
| Vendored revert merges into an alias entry, byte-exact | core yarn_berry_lock::tests::revert_merges_into_an_alias_entry_added_after_vendoring |
two entries |
Merge helper: sorted keys, yarn's body, moved bookkeeping |
core stanzas::tests::restored_entries_merge_into_a_sibling_with_their_resolution |
n/a (new helper) |
Real yarn 4.12 workspace with a member added after the pin. Steps: (1) roll back the drifted lock; (2) re-scan, then a fresh offline --immutable install gets only the patched bytes; (3) roll back, then a fresh --immutable install passes |
cli e2e_yarn4_workspaces_build::yarn4_hosted_pin_folds_a_member_added_later_and_rolls_back |
With restore_berry from main, rollback leaves two entries. With the rewriter from main, the re-scan refuses (ambiguous_entry, applied 0) |
Per-issue checklist:
yarn install --immutable rejects (YN0028) #1082 point 1 (re-scan dead end): fold test and real-yarn e2eyarn install --immutable rejects (YN0028) #1082 point 2 (rollback/remove → YN0028): in-process test and real-yarn e2e (--immutable passes after rollback)yarn install --immutable rejects (YN0028) #1082 vendored counterpart (comment of 2026-10-09): vendored revert testLocal runs:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test --workspace --all-features --no-fail-fast (with corepack yarn available): 13905 passed, 15 failed. None of the failures is in code this PR changes, and all come from the sandbox:
*_write_failure_*, *unremovable*, relax_loop_must_not_traverse_symlinked_root, and similar).e2e_bun_lockb::binary_shared_bundled_record_hosted_pin_is_managed, which needs patches-api.socket.dev.mode_migration_npm::berry_{hosted_then_vendored,vendored_then_hosted}_takeover_*. They panic in their own fixture setup (mount_hosted_mocks, mode_migration_npm.rs:329), where the test's reqwest client can't verify the sandbox proxy's certificate for registry.npmjs.org. That happens before any socket-patch code runs. Earlier agent runs had no corepack yarn, so these skipped there.cargo test -p socket-patch-cli --test e2e_yarn4_workspaces_build with real yarn 4.12.0 (SOCKET_PATCH_YARN_E2E_REQUIRED=1): passed/code-review highFixed:
moved keys are droppedNot changed:
npm: entries of one version with no URL entry means they have different locators, for example a plain locator and an ::__archiveUrl= one. Yarn does not merge those, so the refusal stays.package.json write fails after the lock was merged, a retry reports vendor_lock_entry_removed (a not-drift warning, After yarn remove of a vendored package, rollback fails forever (exit 1) and no command can clean up the orphaned yarn classic artifact; the remedies it prints don't work #665) instead of staying silent. The retry still completes the revert.🤖 Generated with Claude Code
https://claude.ai/code/session_01TY1qeZG6YhbTSVfdgf4hhG
Note
Medium Risk
Changes hosted redirect, rollback, and vendored revert paths for yarn.lock and root resolutions; mistakes could break installs or leave packages unpatched, but behavior is heavily tested including real Yarn e2e.
Overview
Fixes #1082: when Yarn Berry adds a second yarn.lock entry for the same package after a hosted pin (e.g. a new workspace member range or npm: alias with no matching resolutions selector), re-scan no longer bails with redirect_yarn_berry_ambiguous_entry, and rollback/remove/revert no longer leave two stanzas sharing one resolution: (which breaks yarn install --immutable with YN0028).
Re-scan (hosted redirect) treats the URL-keyed pin plus one extra plain registry entry as foldable: it adds selectors for the new ranges, drops the duplicate stanza, and records redirect_yarn_berry_entry_folded edits.
Shared merge_same_resolution in yarn stanza handling combines restored stanzas into an existing sibling with the same resolution: (sorted union of keys, Yarn’s body kept). Hosted restore and vendored revert call this after unwinding.
Tests cover unit merge/rewrite behavior, in-process rollback/remove, vendored revert with a post-vendor alias, and a real Yarn 4 workspace e2e (late member, re-scan fold, rollback). Docs in ecosystems.md describe the fold/merge behavior.
Reviewed by Cursor Bugbot for commit f3d85e3. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
A hosted yarn berry pin routes each descriptor that existed at scan time to the Socket tarball. A descriptor added later (a workspace member's exact range, an npm: alias) gets its own registry entry, so that copy installs unpatched. A re-scan used to refuse with a "run yarn install to dedupe" remedy that never works, since the pin keeps the entries apart. It now adds a selector for the new descriptor and drops its registry entry, which is the lock yarn writes once that selector exists. rollback and remove restored the hosted entry next to that registry entry with the same resolution. Yarn merges such entries, so every fresh yarn install --immutable failed with YN0028 while the unwind reported success. The restored entry is now merged into it. Fixes #1082 Assisted-by: Claude Code:claude-opus-5-5
Adds a real-yarn workspace e2e: a member added after the hosted pin gets its own registry entry; rollback of that lock, and a re-scan followed by rollback, each leave a lock a fresh yarn install --immutable accepts. The hosted API mocks move into a helper shared with the existing capstone. Assisted-by: Claude Code:claude-opus-5-5
vendor --revert (and rollback, remove, the hosted takeover) put the pre-vendor yarn.lock entry back verbatim. When an npm: alias or a member range of the same package was added after vendoring, yarn had locked it as its own registry entry with the same resolution, so the reverted lock held two entries yarn merges and every fresh yarn install --immutable failed with YN0028. The restored entry is now merged into that entry, as yarn writes it. The merge helper moves to formats::yarn::stanzas, shared with the hosted restore. Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
The vendored berry revert also merges a restored pruned entry into a sibling with its resolution. The hosted restore drops its node-gyp advisory for an entry merged into yarn's own, and skips the catalog lookup when nothing is folded. Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 f3d85e3. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[final reviewer] Review brief for What it does. Fixes #1082. When a new range of an already-pinned yarn berry package shows up later (for example a workspace member's Risk: medium. It changes how lockfiles are rewritten on the hosted pin, hosted restore and vendored revert paths. The fold is narrow: it only applies when exactly one target is our own URL-keyed entry. Two plain registry entries still get Look here
Verified
Changes I made: none. Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Yarn berry hosted pin can't cover a descriptor added after pinning: re-scan refuses with an impossible "dedupe" remedy, and rollback reports success but leaves a lock everyyarn install --immutable rejects (YN0028)
There was an error while loading. Please reload this page.