Repository navigation
Fix yarn classic revert of merged lock keys (#692) - #1728
Mikola Lysenko (mikolalysenko) merged 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Vendored yarn classic remembered each wired lock block by its exact key line. When yarn later merged another range into that block (a workspace member adding left-pad@^1.3.0 next to ^1.1.0) or dropped one, the key line changed while the block still installed our patched tarball. rollback, remove and vendor --revert then reported the block as gone, kept the lock wired and failed on every re-run, so the patch could not be undone. The revert now finds the live block that shares a range with the recorded key and still resolves through this patch, and restores the pre-vendor resolution under the block's current key. A re-keyed block that someone re-resolved elsewhere is still left alone. Fixes #692 Assisted-by: Claude Code:claude-opus-5-5
Only a block yarn re-keyed takes the live key line on restore: the berry revert needs the recorded key line, which undoes the locator key vendoring wrote. Adds a real-yarn leg for #692: a workspace member adds a second range of the vendored package, yarn merges it into the wired block, and rollback must restore the registry block under the merged key and remove the tarball. Assisted-by: Claude Code:claude-opus-5-5
A re-keyed block that someone re-resolved away from the vendored tarball no longer needs it, just like a removed block. Following it anyway reported drift and kept the tarball and ledger entry forever, even after a legitimate upgrade. The revert now finishes there, and its warnings name the block as it is in the lock today. Assisted-by: Claude Code:claude-opus-5-5
|
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 cb1eec0. Configure here.
|
Burn-down agent: labeled Ready for review at head
Generated by Claude Code |
Final review briefWhat it does: Vendored yarn classic Risk: low. The new path runs only when the recorded key no longer exists, and only for classic (berry passes Look here:
Verified:
Changes I made: none. Open questions: none. Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #692
Summary
Vendored yarn classic
rollback,removeandvendor --revertnow undo a lock block that yarn re-keyed after vendoring. That happens when a workspace member addsleft-pad@^1.3.0next to^1.1.0and yarn dedupes it into the wired block (left-pad@^1.1.0, left-pad@^1.3.0:), or when it drops one range of a merged key. Before this change, those commands reported the block as gone, kept the lock wired to the patched tarball and exited 1 on every run, so the patch could not be undone.Root cause
The vendor ledger records each wired block by its exact key line.
revert_recorded_blocklooked the block up withb.key == key. A re-keyed block keeps ourresolved/integrity, so it is still ours, but the exact lookup missed it and the revert treated it as removed (vendor_lock_entry_removed). The CLI then kept the artifact because the lock still mentioned the uuid.Fix
resolvedstill points into this entry's uuid (rekeyed_block). It restores the recorded pre-vendor body under the block's live key line, so the ranges merged in since vendoring stay locked.yarn upgrade) is not followed. It is treated like a removed block, so the revert finishes once nothing resolves through the artifact, and the drift keep isn't stuck forever.Noneand keeps its existing lookup. Its revert restores the recorded key line (vendoring rewrote its locator key), so the key-line swap applies only to re-keyed classic blocks.already_vendored). With the fixed revert, the ledger it keeps now reverts.npm/,pypi/andgem/only dispatch to the binary.Tests (red → green)
e2e_vendor_yarn_classic_dev_flow::yarn_classic_rollback_after_member_add_merges_the_vendored_keyyarn_classic_lock::tests::issue_692_revert_restores_a_block_yarn_merged_after_vendoringvendor_lock_entry_removed+vendor_artifact_kept)issue_692_revert_restores_a_block_whose_key_lost_a_rangeissue_692_revendor_after_merge_then_revert_convergesissue_692_merged_block_resolved_elsewhere_is_left_aloneCommands run locally (all green unless noted):
cargo fmt --all -- --checkcargo clippy --workspace --all-features -- -D warningscargo test -p socket-patch-core --all-features --lib: all yarn tests (390) pass. Two pypi wire-failure tests fail locally only because the container runs as root, which defeats their chmod-based failure injection; CI runs them unprivileged.cargo test -p socket-patch-cli --all-features --test e2e_vendor_yarn_classic_dev_flow(withSOCKET_PATCH_YARN_E2E_REQUIRED=1),--test e2e_vendor_yarn_classic_build,--test in_process_vendor: all pass.cargo test --workspace --all-features --no-fail-fast: the only other failures are environmental and in code this PR doesn't touch.e2e_bun_lockbcan't reach patches-api.socket.dev through the sandbox proxy, and a vlt heal-failure test also depends on non-root permissions./code-review high
yarn addstep of the e2e a soft skip. The suite's convention is that every assertion after the fixture install is hard, and--prefer-offlineserves the add from the warmed cache.#[allow(clippy::too_many_arguments)]is the repo's existing convention (80+ uses).rekeyed_block. It runs only for records whose exact key is gone, once per record.https://claude.ai/code/session_012b8PuECQR7xpwuQ48Xm2Wd
Generated by Claude Code