← Back to Pull requests

fix(real-hoist): dedupe transitive peer bindings #18176

Closed
unknown closed this pull request without merging on Nov 17, 2026 11:17 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 08:53 UTC
Author

Summary

With nodeLinker: hoisted and autoInstallPeers: false, a package can be duplicated beneath a parent with conflicting dependencies even when both copies have identical transitive peer bindings. Follow descendant snapshot edges, including dependencies already hoisted away, when comparing those bindings. This covers the transitive case missing from pnpm/pnpm#18004.

Validation: 48 hoister tests (including 20,000 generated graphs), 67 hoisted-linker CLI tests, 23 CLI smoke tests, and an unchanged application's full Jest suite (116 suites, 1,249 tests). The original reproduction failed before the fix; the v11 hoister deduplicates it correctly. Workspace Rust check, lint, formatting, and spelling checks pass.

Squash Commit Body

Resolve transitive peer providers from descendant snapshots before falling
back to the candidate's ancestor directories. A conflicting dependency of
an ancestor does not replace the provider recorded by those snapshots.

Compare inherited bindings separately from recorded providers, including
when a package moves into a free root slot. Follow dependencies already
hoisted out of a node. Distinguish cycles with recorded providers from
cycles that need an inherited provider. Cover traversal orders, peer
contexts, distinct and missing bindings, cycles, and Node.js resolution
after both fresh and frozen-lockfile installs.

Follow-up to pnpm/pnpm#18004.

Checklist

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes are implemented in every affected version.

  • Added a changeset for the published CLI.

  • Added regression tests.
  • Code Owner Approvals

    Pending maintainer review.

    ---
    Written by an agent (Codex, GPT-6).

    <!-- codesmith:footer -->
    ---
    <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1797497623&installation_model_id=426870&pr_number=18176&ref=codesmith_pr_footer&repository=pnpm%2Fpnpm&return_to=https%3A%2F%2Fgithub.com%2Fpnpm%2Fpnpm%2Fpull%2F18176&signature=c95f1d25a5d1c2c1d369f06104dff0dba5c6a1a3173f1dd568056dab69970021"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a>
    <sup><a href="https://app.blacksmith.sh/pnpm/codesmith/pnpm/pr/18176?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    <!-- codesmith:autofix:disabled -->
    <!-- /codesmith:footer -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Fixed duplicate package handling with the hoisted linker when peer auto-installation is disabled and identical transitive peer bindings occur under parents with conflicting dependencies.
    Improved peer resolution when packages have multiple transitive providers, including inherited bindings and dependency cycles.
    Preserved peer resolution when packages are hoisted or deduplicated.

    Tests
    Added coverage for peer resolution and deduplication across fresh installs and frozen-lockfile installs.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 442 lines (+331 / -111) across 5 files Reviewer: zkochan Review duration: 144m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 442 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #18176"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.3% (MEDIUM) · Higher = larger blast radius
    45.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.9% · Safe to merge
    17.9%
    Repository