Skip to content

fix: approve git-hosted tarball builds by repository url - #12985

Merged
zkochan merged 4 commits into
pnpm:mainfrom
n3dst4:allow-git-builds-by-codeload-url
Jul 30, 2026
Merged

zkochan merged 4 commits into
pnpm:mainfrom
n3dst4:allow-git-builds-by-codeload-url

Conversation

@n3dst4

@n3dst4 n3dst4 commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #13429

pnpm 11.11 (#12856) let an allowBuilds entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like name@git+https://host/org/repo.git#<commit>.

The common github: case isn't cloned, pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form name@https://codeload.github.com/org/repo/tar.gz/<commit>. That form has neither the git+ prefix nor the # separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash.

This PR normalizes a git-hosted tarball dep path back to the canonical name@git+https://host/org/repo.git key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball.

GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered. The host is part of each derived key, and the GitHub and Bitbucket download hosts are matched against a literal value (GitLab's is captured generically to allow self-hosted instances), so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work.

The change is mirrored in both stacks, @pnpm/building.policy and pacquet-package-manager, with unit tests on each side.

Manually validated against this minimal reproduction: https://github.com/n3dst4/pnpm-allowbuilds-repro

Validation:

  • pnpm --filter @pnpm/building.policy test — TS policy suite, 17/17 pass, including the new should allow git-hosted tarball builds by hashless repository key
  • pnpm exec eslint pnpm11/building/policy/src/index.ts pnpm11/building/policy/test/index.ts — clean
  • cargo test -p pacquet-package-manager --lib build_modules — 58 pass, including the new explicit_allow_by_git_hosted_tarball_repo_url
  • cargo fmt -p pacquet-package-manager -- --check — clean
  • cargo clippy -p pacquet-package-manager --all-targets --locked -- -D warnings — clean
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps -p pacquet-package-manager --all-features — clean
  • typos pnpm11/building/policy pnpm/crates/package-manager/src/build_modules.rs pnpm/crates/package-manager/src/build_modules/tests.rs .changeset/allow-git-tarball-builds-by-repo-url.md — clean
  • End-to-end policy check: fed the exact codeload dep path and hashless allowBuilds key from the minimal repro through the compiled createAllowBuildFunction, which returns true (stock pnpm returns undefined for the same input, so the build is ignored)
  • Bug reproduction: stock pnpm 11.12 on the minimal repro fails with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED and never runs the build, confirming the gap this PR closes

Squash Commit Body

Normalizes git-hosted tarball dep paths back to the canonical
`name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one
hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub
(codeload), GitLab archive, and Bitbucket download URLs are covered. The host is part of each
derived key, and the GitHub and Bitbucket download hosts are matched against a literal value
(GitLab's is captured generically to allow self-hosted instances), so a look-alike host cannot
be rewritten into an unrelated repository key. Approving or denying a specific resolved commit
by its full tarball dep path continues to work.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • 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.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Build approvals now support Git-hosted dependencies fetched as tarballs (GitHub, GitLab, Bitbucket) using repository-URL–based allow keys, including “hashless” entries.
  • Bug Fixes
    • Improved canonical matching so tarball origins are evaluated consistently with existing git+... allow lists.
    • Added validation to prevent approvals for look-alike hosts, mismatched repositories, and tarball URLs with unexpected extra path segments.
  • Tests
    • Added coverage for hashless tarball allow/deny behavior across common hosting patterns.
  • Chores
    • Updated spell-check terms for “hashless.”

@n3dst4
n3dst4 requested a review from zkochan as a code owner July 13, 2026 19:27
@welcome

welcome Bot commented Jul 13, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Git-hosted tarball dependencies now match allowBuilds entries by normalized repository URL without requiring a commit hash. Rust and TypeScript policies support GitHub, Bitbucket, and GitLab tarball formats, with tests covering approvals, denials, mismatches, and invalid URL forms.

Changes

Git tarball allow-build matching

Layer / File(s) Summary
Rust repository-key normalization and policy checks
pnpm/crates/package-manager/src/build_modules.rs, pnpm/crates/package-manager/src/build_modules/tests.rs, .changeset/...
Normalizes hosted tarball URLs into canonical hashless git repository keys, evaluates allow and deny sets, and tests supported hosts, mismatched repositories, look-alike hosts, and invalid paths.
TypeScript repository-key normalization and policy checks
pnpm11/building/policy/src/index.ts, pnpm11/building/policy/test/index.ts, cspell.json
Adds GitHub, Bitbucket, and GitLab tarball matchers and tests hashless approvals, explicit denials, repository mismatches, look-alike hosts, and extra path segments.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PackageManager
  participant AllowBuildPolicy
  participant RepositoryKeyNormalizer
  participant PolicyTests
  PackageManager->>AllowBuildPolicy: check git clone or tarball depPath
  AllowBuildPolicy->>RepositoryKeyNormalizer: derive canonical repository key
  RepositoryKeyNormalizer-->>AllowBuildPolicy: return hashless git repository URL
  AllowBuildPolicy-->>PackageManager: return allow or deny decision
  PolicyTests->>AllowBuildPolicy: verify supported and rejected URL forms
Loading

Possibly related PRs

  • pnpm/pnpm#12856: Establishes the hashless git repository-key matching approach extended here to tarball dependencies.

Suggested labels: product: pacquet, product: pnpm@11

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge. The change is purely additive — it extends the key-matching logic, not the allow/deny decision logic itself — and both stacks have been updated in parity with comprehensive tests.

The URL normalisation is narrowly scoped: known hosts are matched by exact prefix and every unrecognised pattern returns undefined/None rather than a spurious key. The Rust Cow refactor is idiomatic and the as_deref() call site is correct. No correctness or security issues were identified.

Files Needing Attention: No files require special attention.

Reviews (7): Last reviewed commit: "fix: align git-hosted tarball repo key n..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/allow-git-tarball-builds-by-repo-url.md:
- Around line 1-4: Add "pacquet": patch to the changeset frontmatter alongside
"`@pnpm/building.policy`" and "pnpm", preserving the existing package release
entries.

In `@pnpm/crates/package-manager/src/build_modules.rs`:
- Around line 339-357: Update git_hosted_tarball_repo_url so GitHub and
Bitbucket parsing accepts exactly one non-empty repository path component before
the tarball suffix, matching the TypeScript normalization behavior. Reject
repository values containing additional slashes, while preserving the existing
owner validation and canonical git URL output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9dda7dff-893a-4f62-991e-3523e5dc2931

📥 Commits

Reviewing files that changed from the base of the PR and between 45f682f and 65c91fb.

📒 Files selected for processing (6)
  • .changeset/allow-git-tarball-builds-by-repo-url.md
  • cspell.json
  • pnpm/crates/package-manager/src/build_modules.rs
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm11/building/policy/src/index.ts
  • pnpm11/building/policy/test/index.ts

@codecov-commenter

codecov-commenter commented Jul 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.87%. Comparing base (0f1c467) to head (5930e1f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/package-manager/src/build_modules.rs 95.65% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12985   +/-   ##
=======================================
  Coverage   87.86%   87.87%           
=======================================
  Files         549      549           
  Lines       96091    96131   +40     
=======================================
+ Hits        84429    84473   +44     
+ Misses      11662    11658    -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 13, 2026
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 5930e1f7d51e

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.743 ± 0.168 2.550 3.020 1.64 ± 0.17
pacquet@main 2.749 ± 0.138 2.490 2.935 1.65 ± 0.16
pnpr@HEAD 1.687 ± 0.144 1.481 1.885 1.01 ± 0.12
pnpr@main 1.667 ± 0.137 1.496 1.877 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.74280870984,
      "stddev": 0.16776965332961952,
      "median": 2.68812635974,
      "user": 2.0901761199999997,
      "system": 1.6329789999999995,
      "min": 2.55004130424,
      "max": 3.02003899224,
      "times": [
        2.55004130424,
        2.98542061124,
        2.67445098024,
        2.70180173924,
        2.5698411232400002,
        2.76675365024,
        2.88300252124,
        3.02003899224,
        2.67098697624,
        2.60574920024
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.74949447854,
      "stddev": 0.1377443192617426,
      "median": 2.80098153624,
      "user": 2.1745468199999998,
      "system": 1.7528808999999999,
      "min": 2.48970181724,
      "max": 2.93454627424,
      "times": [
        2.48970181724,
        2.67118456724,
        2.59313102224,
        2.80520649724,
        2.83567195524,
        2.87569446524,
        2.93454627424,
        2.67675849324,
        2.81629311824,
        2.7967565752400003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.68740854644,
      "stddev": 0.14351699422276123,
      "median": 1.6730416187400001,
      "user": 1.6938131200000002,
      "system": 1.7970207999999999,
      "min": 1.48106495024,
      "max": 1.88518890624,
      "times": [
        1.88518890624,
        1.64463962924,
        1.81794211224,
        1.48106495024,
        1.5433994282399999,
        1.81384710524,
        1.59772524124,
        1.5534428662400002,
        1.70144360824,
        1.83539161724
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.66743349704,
      "stddev": 0.13726697616892367,
      "median": 1.66416404824,
      "user": 1.4696118200000001,
      "system": 1.4964551999999998,
      "min": 1.49602262724,
      "max": 1.8765942982400001,
      "times": [
        1.8765942982400001,
        1.49602262724,
        1.54830443724,
        1.72593199724,
        1.54286117524,
        1.62174576524,
        1.70658233124,
        1.82386705324,
        1.79892204024,
        1.53350324524
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 290.0 ± 9.9 273.9 308.5 1.01 ± 0.05
pacquet@main 286.0 ± 9.6 277.4 304.9 1.00
pnpr@HEAD 295.6 ± 12.0 275.4 307.0 1.03 ± 0.05
pnpr@main 344.0 ± 45.4 306.1 465.1 1.20 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.28997597750000004,
      "stddev": 0.009850416440498921,
      "median": 0.2897585387,
      "user": 0.232966,
      "system": 0.5704575399999999,
      "min": 0.2738565947,
      "max": 0.3084981127,
      "times": [
        0.2892953707,
        0.2813300017,
        0.2895021277,
        0.2738565947,
        0.2813282897,
        0.2907685417,
        0.2989593327,
        0.2900149497,
        0.2962064537,
        0.3084981127
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.2860349772,
      "stddev": 0.009627449560701721,
      "median": 0.2817759027,
      "user": 0.23113529999999996,
      "system": 0.57170744,
      "min": 0.2774062677,
      "max": 0.3049266577,
      "times": [
        0.28392217070000003,
        0.27837237870000003,
        0.3049266577,
        0.2929038137,
        0.27958600370000003,
        0.2796296347,
        0.2774062677,
        0.2989151407,
        0.2794529637,
        0.2852347407
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29555804760000004,
      "stddev": 0.011969367970897635,
      "median": 0.29988951220000004,
      "user": 0.2461106,
      "system": 0.56896494,
      "min": 0.2754313157,
      "max": 0.3070496267,
      "times": [
        0.2813906247,
        0.2754313157,
        0.2799425417,
        0.3054046637,
        0.2994384317,
        0.2979469147,
        0.3017074947,
        0.30692826970000003,
        0.3003405927,
        0.3070496267
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3439955471,
      "stddev": 0.04537677687322384,
      "median": 0.3293916467,
      "user": 0.27401810000000004,
      "system": 0.6464814399999999,
      "min": 0.3061361937,
      "max": 0.46506157270000004,
      "times": [
        0.33979975970000004,
        0.3238352477,
        0.3541467987,
        0.3061361937,
        0.3297385627,
        0.3179879077,
        0.3181835047,
        0.3290447307,
        0.3560211927,
        0.46506157270000004
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.762 ± 0.056 2.687 2.882 1.59 ± 0.11
pacquet@main 2.836 ± 0.084 2.724 2.971 1.64 ± 0.12
pnpr@HEAD 1.769 ± 0.143 1.536 2.010 1.02 ± 0.11
pnpr@main 1.733 ± 0.115 1.626 1.936 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7616817062999997,
      "stddev": 0.056436024000355314,
      "median": 2.7568621121000003,
      "user": 1.92517492,
      "system": 1.6242518799999999,
      "min": 2.6867230131,
      "max": 2.8822990641,
      "times": [
        2.7094224681,
        2.7882263471,
        2.7364972931000002,
        2.8822990641,
        2.7203721801,
        2.7340841801,
        2.7917271581,
        2.7902384281000003,
        2.6867230131,
        2.7772269311000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.8363315964,
      "stddev": 0.08381767546368434,
      "median": 2.8351708786,
      "user": 2.09213842,
      "system": 1.6483340800000001,
      "min": 2.7243926381000003,
      "max": 2.9707337691,
      "times": [
        2.8497051651,
        2.8206365921,
        2.9524184461000003,
        2.9707337691,
        2.7943228771,
        2.7243926381000003,
        2.7592208701,
        2.7472163991,
        2.8567099461,
        2.8879592611000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7691342339000002,
      "stddev": 0.14330476615222265,
      "median": 1.7565393341000002,
      "user": 1.4852388199999997,
      "system": 1.6806078799999997,
      "min": 1.5359531401000002,
      "max": 2.0102840901000003,
      "times": [
        1.7352677221000001,
        1.7850460671000001,
        1.7030049281000001,
        1.5359531401000002,
        1.7006371881000002,
        1.9950051411,
        1.6662984531,
        1.7778109461000002,
        1.7820346631000001,
        2.0102840901000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7333229032000002,
      "stddev": 0.11537882253146985,
      "median": 1.7024736811,
      "user": 1.4827804199999999,
      "system": 1.57197028,
      "min": 1.6256046761,
      "max": 1.9361298941,
      "times": [
        1.9330158471,
        1.6983523461,
        1.9361298941,
        1.6348367901,
        1.7093399721,
        1.6581941631000001,
        1.6495750961000002,
        1.7815852311000002,
        1.7065950161,
        1.6256046761
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 670.5 ± 56.3 600.9 764.1 1.65 ± 0.23
pacquet@main 631.3 ± 59.6 549.0 709.3 1.55 ± 0.23
pnpr@HEAD 413.3 ± 31.1 361.4 449.1 1.02 ± 0.14
pnpr@main 406.8 ± 45.1 352.2 514.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6704669230400001,
      "stddev": 0.056250295914207694,
      "median": 0.66451237374,
      "user": 0.9211086199999998,
      "system": 0.9378908600000001,
      "min": 0.6009143637400001,
      "max": 0.7641284167400001,
      "times": [
        0.61490070974,
        0.61956218774,
        0.74302249474,
        0.71319560674,
        0.7641284167400001,
        0.6853683167400001,
        0.6009143637400001,
        0.68056014474,
        0.6484646027400001,
        0.63455238674
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.63126203424,
      "stddev": 0.05955487106532331,
      "median": 0.62304465574,
      "user": 0.86611292,
      "system": 0.88460076,
      "min": 0.5490468017400001,
      "max": 0.7092718117400001,
      "times": [
        0.5858435147400001,
        0.59851889374,
        0.5913602557400001,
        0.56886764374,
        0.5490468017400001,
        0.64757041774,
        0.7021344137400001,
        0.66558579474,
        0.6944207947400001,
        0.7092718117400001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.41334578084,
      "stddev": 0.03111109546761106,
      "median": 0.41532262974,
      "user": 0.30948152,
      "system": 0.6902481600000001,
      "min": 0.36135963574,
      "max": 0.44905176774000005,
      "times": [
        0.44899085474000006,
        0.44442120874,
        0.44905176774000005,
        0.43046530874000005,
        0.40256641474000004,
        0.42807884474,
        0.38994756174,
        0.38017723874000003,
        0.36135963574,
        0.39839897274
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.40677709024,
      "stddev": 0.04513866297758024,
      "median": 0.40204716524000006,
      "user": 0.29502772,
      "system": 0.6615758599999999,
      "min": 0.35216198974,
      "max": 0.51440816374,
      "times": [
        0.40209431874,
        0.40200001174000005,
        0.51440816374,
        0.43694492374000005,
        0.41017193974000005,
        0.37645480074000004,
        0.39768282074000005,
        0.36457019474,
        0.35216198974,
        0.41128173874
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.919 ± 0.038 1.876 2.007 3.40 ± 0.38
pacquet@main 2.002 ± 0.120 1.865 2.289 3.55 ± 0.45
pnpr@HEAD 0.569 ± 0.121 0.476 0.890 1.01 ± 0.24
pnpr@main 0.565 ± 0.062 0.460 0.645 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9188338120999997,
      "stddev": 0.03831983522852821,
      "median": 1.9090978013,
      "user": 1.0685812199999998,
      "system": 0.9335015200000001,
      "min": 1.8761623803,
      "max": 2.0068297413000002,
      "times": [
        1.9494580683,
        1.9360580443,
        1.9210889093,
        1.8961251333,
        2.0068297413000002,
        1.9028661473,
        1.9146629163,
        1.8815540943,
        1.8761623803,
        1.9035326863
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.0019900621,
      "stddev": 0.12030528837617324,
      "median": 1.9752509723,
      "user": 1.2329960199999999,
      "system": 0.97761852,
      "min": 1.8652583833,
      "max": 2.2889928413000002,
      "times": [
        1.9734120813,
        1.8652583833,
        1.9001912843000002,
        1.9225932393,
        1.9507983693,
        1.9770898633,
        2.0779862303,
        2.0532200643,
        2.0103582643,
        2.2889928413000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.5692462781,
      "stddev": 0.1207751362327473,
      "median": 0.5357505328000001,
      "user": 0.44344901999999997,
      "system": 0.85297302,
      "min": 0.4756290253,
      "max": 0.8904543743000001,
      "times": [
        0.4756290253,
        0.5644073303,
        0.8904543743000001,
        0.5213620163,
        0.6309472163000001,
        0.49302729230000003,
        0.5399817633,
        0.5315193023,
        0.5421964133,
        0.5029380473
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.5645472954999999,
      "stddev": 0.0622185504339968,
      "median": 0.5904935203,
      "user": 0.42683302,
      "system": 0.8592138199999999,
      "min": 0.45973141030000003,
      "max": 0.6445154063,
      "times": [
        0.5559290413,
        0.6445154063,
        0.5972858503,
        0.6021346573,
        0.6159289293,
        0.6019143133,
        0.5837011903,
        0.4952358813,
        0.45973141030000003,
        0.4890962753
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 447.2 ± 87.3 332.0 583.3 4.02 ± 0.86
pacquet@main 449.1 ± 51.9 366.2 543.0 4.03 ± 0.58
pnpr@HEAD 126.6 ± 12.7 107.6 152.3 1.14 ± 0.15
pnpr@main 111.3 ± 9.6 101.1 139.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.44723522226000006,
      "stddev": 0.08731766097159434,
      "median": 0.42227891986,
      "user": 0.44791554,
      "system": 0.12479016000000001,
      "min": 0.33203908136,
      "max": 0.58326822536,
      "times": [
        0.33203908136,
        0.35691701636,
        0.39153913436,
        0.38146223836,
        0.43634182136,
        0.58326822536,
        0.53913235736,
        0.52792514236,
        0.51551118736,
        0.40821601836
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.44910719016000006,
      "stddev": 0.0519134931553953,
      "median": 0.45514226036,
      "user": 0.45088394000000004,
      "system": 0.12776936,
      "min": 0.36615702336,
      "max": 0.54297784336,
      "times": [
        0.38372380636,
        0.54297784336,
        0.47199780636,
        0.45601236636,
        0.47404955036,
        0.44211032236,
        0.45427215436,
        0.41104576236,
        0.36615702336,
        0.48872526636
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.12664755636000002,
      "stddev": 0.012716883499431116,
      "median": 0.12535703086,
      "user": 0.03954145818181818,
      "system": 0.02218145090909091,
      "min": 0.10758383536,
      "max": 0.15227516336000002,
      "times": [
        0.12429953336,
        0.11004074036000001,
        0.11568212336000001,
        0.13381893436,
        0.15082097936000002,
        0.14399042736,
        0.12921441436,
        0.12515040836000002,
        0.13635009936,
        0.12732328136,
        0.12473981936,
        0.11296058236,
        0.12798167436000002,
        0.15227516336000002,
        0.13624639436000002,
        0.12262425336,
        0.13770318336,
        0.11108206136000001,
        0.11808796136000001,
        0.12556365336,
        0.11270671636000001,
        0.10758383536
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.11133768355047621,
      "stddev": 0.00959861148427977,
      "median": 0.10723596436,
      "user": 0.030816949523809523,
      "system": 0.019324193333333337,
      "min": 0.10108433436000001,
      "max": 0.13977276236,
      "times": [
        0.12995612536,
        0.10491274036,
        0.11956245536000001,
        0.13977276236,
        0.10487750436000001,
        0.10108433436000001,
        0.10407900736,
        0.10434449436000001,
        0.11787388036,
        0.10499305036,
        0.11363575836,
        0.11417056036,
        0.10952821036,
        0.10723596436,
        0.11707029436000001,
        0.10466474536,
        0.10345333436000001,
        0.10448417636000001,
        0.10700598336,
        0.11115363636,
        0.11423233636
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 5.533 ± 0.399 5.083 6.245 1.44 ± 0.11
pacquet@main 5.099 ± 0.300 4.777 5.735 1.32 ± 0.09
pnpr@HEAD 3.868 ± 0.118 3.746 4.143 1.00 ± 0.05
pnpr@main 3.850 ± 0.129 3.634 4.024 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 5.532584566300001,
      "stddev": 0.3986439444696944,
      "median": 5.381717528799999,
      "user": 4.129966519999999,
      "system": 2.91849242,
      "min": 5.0834603343,
      "max": 6.2447315413,
      "times": [
        5.7263745453,
        6.1822678162999996,
        5.3912177123,
        5.2978097713,
        5.5251915993,
        6.2447315413,
        5.0834603343,
        5.2874261583,
        5.3722173453,
        5.2151488393
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 5.098975363699999,
      "stddev": 0.3002463426821468,
      "median": 5.0367929238,
      "user": 3.2024504199999995,
      "system": 2.39515142,
      "min": 4.7774043683,
      "max": 5.7353225543,
      "times": [
        4.9717905052999996,
        4.8552879873,
        4.9940922493,
        4.7967259053,
        4.7774043683,
        5.3227160483,
        5.3718100133,
        5.0794935983,
        5.0851104073,
        5.7353225543
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.8680518943999993,
      "stddev": 0.11847749700424309,
      "median": 3.8567499613,
      "user": 2.1230016199999997,
      "system": 2.20795292,
      "min": 3.7459054082999996,
      "max": 4.1425539733,
      "times": [
        3.8604810303,
        3.9340691903,
        3.8564944973,
        3.7739133293,
        4.1425539733,
        3.9506137933,
        3.8570054252999997,
        3.7721983142999997,
        3.7872839823,
        3.7459054082999996
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.8500028795999994,
      "stddev": 0.12923497243853088,
      "median": 3.8433167008,
      "user": 1.9665950199999997,
      "system": 2.06022822,
      "min": 3.6341936663,
      "max": 4.0244540453,
      "times": [
        4.0244540453,
        3.9969096143,
        3.7900650252999997,
        4.0020980393,
        3.8231774652999997,
        3.7102661733,
        3.8700117833,
        3.7853970473,
        3.8634559363,
        3.6341936663
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12985
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
4,440.25 ms
(+3.87%)Baseline: 4,274.98 ms
5,129.98 ms
(86.56%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,166.16 ms
(+4.94%)Baseline: 3,017.08 ms
3,620.49 ms
(87.45%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,431.63 ms
(+6.91%)Baseline: 1,339.04 ms
1,606.84 ms
(89.10%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
652.78 ms
(+3.47%)Baseline: 630.90 ms
757.08 ms
(86.22%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
3,948.11 ms
(+2.30%)Baseline: 3,859.49 ms
4,631.38 ms
(85.25%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,734.70 ms
(-4.32%)Baseline: 7,038.76 ms
8,446.51 ms
(79.73%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
662.81 ms
(+2.29%)Baseline: 648.00 ms
777.59 ms
(85.24%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12985
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,246.57 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
703.93 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
712.82 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
109.65 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,161.79 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
4,963.46 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
740.55 ms
🐰 View full continuous benchmarking report in Bencher

@n3dst4
n3dst4 force-pushed the allow-git-builds-by-codeload-url branch from e5048df to a6fd249 Compare July 14, 2026 08:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pnpm11/building/policy/src/index.ts (1)

171-179: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use a verb for the function name.

As per coding guidelines, functions should use verb names. Consider renaming gitHostedTarballRepoKey to getGitHostedTarballRepoKey to maintain consistent naming conventions across the repository.

— CodeRabbit (state-of-the-art model)

♻️ Proposed refactor
-function gitHostedTarballRepoKey (pkgIdWithPatchHash: string): string | undefined {
+function getGitHostedTarballRepoKey (pkgIdWithPatchHash: string): string | undefined {

If applied, also update the call site at line 136:

-  return gitHostedTarballRepoKey(depPath)
+  return getGitHostedTarballRepoKey(depPath)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/building/policy/src/index.ts` around lines 171 - 179, Rename the
function gitHostedTarballRepoKey to getGitHostedTarballRepoKey to use the
verb-based naming convention, and update its call site in the surrounding policy
logic so all references use the new name.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pnpm11/building/policy/src/index.ts`:
- Around line 171-179: Rename the function gitHostedTarballRepoKey to
getGitHostedTarballRepoKey to use the verb-based naming convention, and update
its call site in the surrounding policy logic so all references use the new
name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 298e0d87-9598-4f94-a5ab-06cab15bc426

📥 Commits

Reviewing files that changed from the base of the PR and between e5048df and a6fd249.

📒 Files selected for processing (6)
  • .changeset/allow-git-tarball-builds-by-repo-url.md
  • cspell.json
  • pnpm/crates/package-manager/src/build_modules.rs
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm11/building/policy/src/index.ts
  • pnpm11/building/policy/test/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • cspell.json
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm11/building/policy/test/index.ts
  • pnpm/crates/package-manager/src/build_modules.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm11/building/policy/src/index.ts`:
- Around line 171-180: Update gitHostedTarballRepoKey to parse the tarball URL
and reject any path containing dot segments before applying
GIT_HOSTED_TARBALL_REPO_URL_MATCHERS, or match only its normalized path. Apply
the same dot-segment guard or normalization in the Rust build-policy matcher so
pnpm and pacquet derive identical repository keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5baf3562-f9af-40ac-b10c-9131d884aa22

📥 Commits

Reviewing files that changed from the base of the PR and between a6fd249 and d4ab582.

📒 Files selected for processing (6)
  • .changeset/allow-git-tarball-builds-by-repo-url.md
  • cspell.json
  • pnpm/crates/package-manager/src/build_modules.rs
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm11/building/policy/src/index.ts
  • pnpm11/building/policy/test/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • cspell.json
  • pnpm/crates/package-manager/src/build_modules/tests.rs
  • pnpm11/building/policy/test/index.ts
  • pnpm/crates/package-manager/src/build_modules.rs

Comment thread pnpm11/building/policy/src/index.ts Resolved
@n3dst4 n3dst4 changed the title feat: approve git-hosted tarball builds by repository url fix: approve git-hosted tarball builds by repository url Jul 21, 2026
@n3dst4
n3dst4 force-pushed the allow-git-builds-by-codeload-url branch from d4ab582 to 121a0fa Compare July 21, 2026 14:40
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/12985
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,686.72 ms
(-4.64%)Baseline: 2,817.60 ms
3,381.11 ms
(79.46%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,876.16 ms
(-4.24%)Baseline: 1,959.31 ms
2,351.17 ms
(79.80%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
600.91 ms
(-5.82%)Baseline: 638.02 ms
765.62 ms
(78.49%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
332.04 ms
(-13.32%)Baseline: 383.05 ms
459.66 ms
(72.24%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,550.04 ms
(+5.03%)Baseline: 2,427.85 ms
2,913.42 ms
(87.53%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
5,083.46 ms
(+12.46%)Baseline: 4,520.18 ms
5,424.22 ms
(93.72%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
273.86 ms
(-2.42%)Baseline: 280.64 ms
336.76 ms
(81.32%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/12985
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,535.95 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
475.63 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
361.36 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
107.58 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,481.06 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,745.91 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
275.43 ms
🐰 View full continuous benchmarking report in Bencher

@n3dst4

n3dst4 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@zkochan Sorry, I know you're busy, but any chance I could get your eyeballs on this PR please?

n3dst4 added 2 commits July 30, 2026 10:59
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build
scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm
clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common
`github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a
dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has
neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was
ignored and the build stayed unapproved unless it pinned the exact commit hash.

Normalize a git-hosted tarball dep path back to the canonical
`name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one
hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub
(codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of
each is anchored so a look-alike host cannot be rewritten into an unrelated repository key.
Approving or denying a specific resolved commit by its full tarball dep path continues to work.

The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`,
with unit tests on each side.
n3dst4 and others added 2 commits July 30, 2026 10:59
The TypeScript matcher tried its three host patterns in sequence, so a
malformed URL on a claimed download host could fall through to the
generic GitLab archive pattern and still derive that host's trusted
repo key (e.g. a bitbucket.org URL with a /-/archive/ path). The Rust
matcher claims codeload.github.com and bitbucket.org exclusively, which
is the stricter and safer behavior, so the TypeScript side now does the
same via per-host early returns.

Conversely, the Rust GitLab branch accepted any URL containing
/-/archive/ regardless of what follows, while the TypeScript regex
requires a non-empty ref segment followed by a slash. The Rust branch
now enforces the same anchor, iterating the archive markers to mirror
the regex's lazy project capture exactly.

Both suites pin the newly aligned behavior, including the Bitbucket
fall-through case that previously approved a build in TypeScript only.

Co-Authored-By: Claude Fable 5 <[email protected]>
@zkochan
zkochan force-pushed the allow-git-builds-by-codeload-url branch from 121a0fa to 5930e1f Compare July 30, 2026 09:27
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Unconditional tarball normalization 🐞 Bug ➹ Performance
Description
The allow-build check now attempts git-hosted tarball normalization for every non-git depPath, which
means normal registry name@semver deps pay extra parsing/regex/string-scanning work on a hot path.
This is avoidable overhead because the depPath is already parsed later in the same flow, and the
check is invoked frequently (e.g., during global-virtual-store slot rebuild detection).
Code

pnpm11/building/policy/src/index.ts[R125-137]

+  if (isGitRepoDepPath(depPath)) {
+    const refStart = depPath.indexOf('#')
+    return refStart === -1 ? depPath : depPath.slice(0, refStart)
+  }
+  // Packages installed from a git host as a downloaded tarball (e.g. the
+  // `github:` shortcut, which pnpm fetches from codeload.github.com rather
+  // than cloning) have a depPath built from the tarball URL, not a `git+`
+  // clone URL, so the check above misses them. Normalize the tarball URL back
+  // to the same `git+https://<host>/<repo>.git` repo key that a clone of the
+  // same repository would produce, so a single hashless `allowBuilds` entry
+  // approves the package however pnpm happened to fetch it.
+  return gitHostedTarballRepoKey(depPath)
}
Relevance

●●● Strong

Team often accepts gating expensive work to avoid redundant hot-path parsing/IO when not needed.

PR-#12436
PR-#12817
PR-#13170

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The cited code paths compute a git repo key for every depPath during allow-build evaluation, and for
any non-git depPath they fall through into hosted-tarball normalization (gitHostedTarballRepoKey /
git_hosted_tarball_repo_key), which performs an additional dp.parse() plus URL/pattern matching
and string slicing. In the TypeScript implementation, the allow-build closure then calls
dp.parse(depPath) again afterward, making the extra parse/matching redundant for the common
non-tarball registry case; in the Rust implementation, AllowBuildPolicy::check() likewise calls
the repo-key computation before parsing name/version and is used in frequently executed flows like
GVS slot linking/rebuild detection, so the per-call overhead can accumulate across many packages.

pnpm11/building/policy/src/index.ts[43-55]
pnpm11/building/policy/src/index.ts[124-148]
pnpm/crates/package-manager/src/build_modules.rs[211-241]
pnpm/crates/package-manager/src/build_modules.rs[305-333]
pnpm/crates/package-manager/src/create_virtual_store.rs[1089-1099]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The allow-build policy currently attempts git-hosted tarball normalization for all non-git depPaths, causing ordinary registry depPaths (e.g., `name@semver`) to incur extra parsing and URL-pattern scanning work. This adds avoidable per-package CPU overhead in frequently-invoked paths, and in the TS flow it is additionally redundant because `depPath` is parsed again later in the same closure.

## Issue Context
- The git repo key is computed for every allow-build check.
- For non-git depPaths, the implementation falls back to hosted-tarball normalization (`gitHostedTarballRepoKey` / `git_hosted_tarball_repo_key`), which performs depPath parsing and pattern/URL matching.
- In `createAllowBuildFunction()`, `dp.parse(depPath)` is already performed later in the closure, so the additional parse during tarball normalization is extra work on the common path.
- `AllowBuildPolicy::check()` is used in hot, cumulative code paths such as global-virtual-store slot linking/rebuild detection, so even small per-call overhead can add up across many packages.

## Fix Focus Areas
- pnpm11/building/policy/src/index.ts[124-177]
- pnpm/crates/package-manager/src/build_modules.rs[211-332]
- pnpm/crates/package-manager/src/create_virtual_store.rs[1089-1099]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan
zkochan merged commit 3729d83 into pnpm:main Jul 30, 2026
36 checks passed
@welcome

welcome Bot commented Jul 30, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allowBuilds for git-hosted dependencies on GitHub still requires pinning exact hash

3 participants