Repository navigation
Fix yarn mirror set in a workspace member (#1115) - #1694
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits intoOct 23, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A hosted scan of a yarn 1 workspace pinned the root yarn.lock and reported success when only a member's .yarnrc or .npmrc set yarn-offline-mirror. Installs run from that member read the member's config, take the upstream tarball from the mirror and fail the integrity check, while VEX said not_affected (#1115). The mirror resolver now also resolves the mirror yarn 1 would use when run in each declared workspace member, and the yarn classic rewriter refuses with redirect_yarn_classic_offline_mirror when any member has one. The hosted scan, its tarball prefetch and the vendored-to-hosted takeover all read the same resolver, so each now refuses. Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups for the workspace-member mirror refusal: - follow directory links when looking for members, as yarn's globber does, and search literal patterns as deep as they go (a ** pattern stops at 32 levels, and the search at 20,000 directories); - resolve the yarn mirror config once per hosted scan instead of on every rewrite pass, since it now walks the workspace; - say in the refusal which member's yarn run uses the mirror, and document that a member run reads the root .yarnrc below the user's. Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 23, 2026 13:32
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 1f3fc57. Configure here.
Collaborator
Author
|
Labeled Ready for review (burn-down agent).
Slack announcement not sent: this run had no Slack send tool. Generated by Claude Code |
Tanmay Singla (Tanmay182003)
approved these changes
Oct 23, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-yarn-classic-member-mirror
branch
October 23, 2026 14:57
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 #1115
Summary
A hosted scan of a yarn 1 workspace now refuses with
redirect_yarn_classic_offline_mirror(and writes nothing, attests nothing) when yarn run in any workspace member would use ayarn-offline-mirror, e.g. one set only inpackages/a/.yarnrcorpackages/a/.npmrc. Before, it pinned the rootyarn.lock, exited 0, VEX saidnot_affected, and every install run from that member failedIntegrity check failed for "left-pad".Root cause
resolve_outer_yarn_mirror_for_process(crates/socket-patch-core/src/patch/redirect/yarnrc.rs) resolved the mirror the way yarn 1 does from the scan root only: root rc files, env, user / global rc, the root's ancestors. Yarn 1 builds its config from the directory it runs in, and a member is a supported install directory (cd packages/a && yarn install,yarn --cwd packages/a install), which still installs into the root lock. A member's own rc files were never read.Fix
yarn_classic_workspace_memberslists the members yarn 1 installs for a classic lock: dirs holding apackage.jsonthat the rootworkspaces(array or object form) list, matched with the sharedworkspaces_include_asmatcher in yarn classic's dialect. It follows dir links like yarn's globber, skipsnode_modules/.git, searches as deep as the deepest pattern (**: 32 levels), and stops after 20,000 dirs. It only runs when the root holds a classicyarn.lockand declares workspaces.resolve_member_yarn_mirrorresolves, per member, the full yarn 1 layering with the member as the project (its rc files as the project layer, the root's as an ancestor's) and returns the first member mirror. It lands in a newOuterYarnMirror::memberfield, whichyarn_classic_offline_mirrorfalls back to. The refusal detail names the file and the member (…/packages/a/.yarnrc, as read by yarn run in the workspace member …/packages/a).OnceLock) instead of on every rewrite pass.docs/ecosystems.mddocuments the member layer.No wrapper (
npm/,pypi/,gem/) change: they only dispatch to the binary.Tests (per issue)
.yarnrc(issue repro) and member.npmrc(follow-up comment): e2eclassic_offline_mirror_in_workspace_member_rc_refuses_hostedine2e_redirect_yarn_classic_builddoes a real yarn 1.22 install from membera(filling the mirror), scans from the root, and asserts the refusal, no applied redirect, a byte-identical lock and nonot_affectedin the VEX.member_layers_read_the_members_own_rc_files,yarn_classic_workspace_members_follow_the_root_globs(object/array forms, non-members,node_modules, deep literal, symlinked member,**, berry lock, no workspaces), and a member case added toyarn_classic_outer_offline_mirror_refuses_rewrite(incl. a root.yarnrc falsenot hiding a member mirror).Red → green. With the fallback in
yarn_classic_offline_mirrorremoved, the new e2e fails with the issue's exact symptom ("status":"success","applied":1,rewrittenFiles: ["yarn.lock"], one VEX statement) andyarn_classic_outer_offline_mirror_refuses_rewritefails on the member case; with it, both pass.Local runs on
1f3fc57:cargo fmt --all -- --check: clean.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --all-features --test e2e_redirect_yarn_classic_build: 41 passed.cargo test --workspace --all-features --no-fail-fast: 14,834 passed, 10 failed, all environmental in this sandbox and outside the diff: 9 tests that make a write fail withchmod(the sandbox runs as uid 0, which bypasses it) ande2e_bun_lockb::binary_shared_bundled_record_hosted_pin_is_managed(needspatches-api.socket.dev, blocked by the sandbox proxy). CI is the reference for those./code-review high
Fixed: symlinked members were skipped; members deeper than 8 levels were missed; the resolver (now a tree walk) ran on every rewrite pass; the refusal didn't say which member. Not changed:
falseno longer hides a user-level mirror in a workspace: that is yarn 1's precedence. A member run reads the user rc above the root's (an ancestor's), so that install really does use the mirror and would fail integrity. The docs now say to setfalsein the member too.npm_crawler::expand_workspace_pattern_syncandUserPatchIndex::workspace_membersdon't read yarn classic's full pattern grammar (braces, extglob, ignored negation) thatworkspaces_include_asdoes, so this walk drives that matcher instead.https://claude.ai/code/session_01RJ6ze68VotuyevvN6kqX6r
Note
Medium Risk
Changes when yarn classic hosted redirect is allowed vs refused, which affects lockfile integrity and install behavior for workspace monorepos; bounded by new workspace walk limits and tests.
Overview
Yarn 1 hosted scans now treat
yarn-offline-mirrorset only on a workspace member (e.g.packages/a/.yarnrcor.npmrc) the same as a root-level mirror: hosted redirect is refused withredirect_yarn_classic_offline_mirrorinstead of rewriting the rootyarn.lock.Member discovery walks classic workspace globs (
yarn_classic_workspace_members), resolves each member’s mirror with yarn 1’s full config layering (resolve_member_yarn_mirror→OuterYarnMirror::member), andyarn_classic_offline_mirrorconsults that fallback. The hosted scan resolves outer/member mirror once per run viaOnceLock.E2E and unit tests cover member rc files, workspace globbing, and docs in
ecosystems.mddescribe member precedence (rootfalsedoes not disable a user mirror for member installs).Reviewed by Cursor Bugbot for commit 1f3fc57. Configure here.
Generated by Claude Code