← Back to Pull requests

fix(get-pnpm): download the binary from registries without version documents #18145

Closed
unknown closed this pull request without merging on Nov 16, 2026 23:09 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 08:21 UTC
Author

Summary

Behind an Azure Artifacts feed, the pnpm package cannot download its native binary on first run. That is the path Corepack takes, and so does Dependabot, which runs pnpm through Corepack and sets COREPACK_NPM_REGISTRY to the configured feed. Every Dependabot update job in a pnpm 12 repository that uses an Azure feed fails:

GET https://pkgs.dev.azure.com/<org>/<project>/_packaging/<feed>/npm/registry/@pnpm/exe.linux-x64/12.20.0
404 Not Found

Azure Artifacts differs from npm in two ways:

| Request | npm | Azure Artifacts |
| --- | --- | --- |
| Version document /<name>/<version> | 200 | 404, for every package, e.g. lodash/4.17.21 |
| Package document /<name> | 200 | 200, with dist.tarball and dist.integrity |
| dist.signatures | present | stripped everywhere; no /-/npm/v1/keys either |

The integrity the feed serves is identical to npm's, because the feed mirrors the tarball unchanged.

Changes in get-pnpm:

  • fetchVersionMeta: when the version document is a 404, the version is read from the package document. If it is not there either, the original 404 is thrown.

  • fetchSignatures: when neither document carries signatures, downloadPnpmExecutable takes npm's signatures for <name>@<version> from registry.npmjs.org.

  • - No credentials are sent there.
    - The signatures still have to cover the checksum the mirror served, and the tarball is still checked against that checksum. So only the signature, never the binary, comes from npm. This is the same reasoning as the existing Artifactory fallback.
    - If npm cannot be reached, for example on an air-gapped network, the package is refused as unsigned, exactly as before.
    - downloadPnpm (the installer) is unchanged; it gets only the 404 fallback.

    Tested against a real Azure Artifacts feed, with npm's pinned signing keys:

  • Before: Could not download …/@pnpm/exe.darwin-arm64/12.18.0: 404 Not Found

  • After: the binary is placed and --version prints 12.18.0.
  • No existing issue covers this. pnpm/pnpm#16655 / pnpm/pnpm#16657 made the first-run download use the configured registry; this makes it work against one that is Azure Artifacts.

    Squash Commit Body

    Azure Artifacts answers 404 for every version document
    (`/<name>/<version>`) and strips npm's signatures from the package
    document. The first-run download of the native binary therefore failed
    behind an Azure feed, which breaks Corepack users and every Dependabot
    update job in such repositories.
    
    A 404 for the version document now falls back to the version entry in
    the package document. When neither document carries signatures,
    `downloadPnpmExecutable` takes npm's signatures from registry.npmjs.org,
    without the mirror's credentials. They must still cover the checksum the mirror served, and the tarball is still checked
    against that checksum, so the binary itself keeps coming from the mirror.
    If npm is unreachable, the package is refused as unsigned, as before.
    

    Checklist

  • I checked the referenced issue and verified that none of the PRs

  • already linked to it solves it.
  • Added a changeset (pnpm changeset) if this PR changes any published

  • package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

  • Updated the documentation if needed.
  • ---
    Written by an agent (Claude Code, claude-opus-5-5).

    <!-- codesmith:footer -->
    ---
    <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1797409272&installation_model_id=426870&pr_number=18145&ref=codesmith_pr_footer&repository=pnpm%2Fpnpm&return_to=https%3A%2F%2Fgithub.com%2Fpnpm%2Fpnpm%2Fpull%2F18145&signature=a6170ef3de5612d79dd088b02b6aed48e2a9e9bfe4481f9b956a9a4a709eb01d"><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/18145?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

    New Features
    First-run downloads can use version information from a package document when a registry returns 404 for a separate version document.
    If the configured registry has no npm signatures, signature lookup can use registry.npmjs.org or a specified npm registry. Registry credentials are not sent to that signature source.
    Bug Fixes
    Downloads are refused when the executable’s checksum cannot be verified against an available npm signature.
    Documentation
    * Documented version-document fallback and signature lookup behavior.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: MikaelEdebro Review duration: 888m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #18145"
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%
    Repository