Skip to content

fix(install): skip explicitly denied git preparation - #15149

Merged
zkochan merged 3 commits into
mainfrom
fix/git-denied-preparation
Sep 20, 2026
Merged

zkochan merged 3 commits into
mainfrom
fix/git-denied-preparation

Conversation

@zkochan

@zkochan zkochan commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm install now installs git-hosted dependencies without preparation when allowBuilds explicitly denies their builds. An undecided build still fails with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED.

The fix applies to both CLI versions and both cloned repositories and host tarballs. Prepared and unprepared store entries stay separate, including when permissions change or the package name is initially unknown.

Closes #10522.

Validation: 104 selected TypeScript tests and 665 selected Rust tests passed, covering preparation, Git fetching, dependency restoration, Git installs, fresh-requester cache reuse, and patch extraction. Workspace-wide Rust check and lint, TypeScript compilation/lint, and all repository push hooks passed.

Squash Commit Body

Distinguish an explicit denial from an undecided Git dependency build.
Install source files when preparation is denied, while retaining the
approval error for dependencies without a recorded decision.

Carry skipped-preparation state through the fetchers and in-memory cache.
Select the existing unprepared store key for denied builds so subsequent
approvals prepare the dependency and denials do not reuse prepared output.

Apply the behavior to both CLI versions and to cloned Git repositories
and Git-hosted tarballs. Cover explicit denials, policy transitions,
shared-store approval enforcement, and initially unknown package names.

Closes pnpm/pnpm#10522.

Checklist

  • I checked the referenced issue and verified that none of the PRs already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes are implemented in every affected version.
  • Added a 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.

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

Summary by CodeRabbit

  • New Features

    • Explicitly denied preparation for git-hosted dependencies now preserves package source files while skipping lifecycle scripts.
    • Build-specific cached entries are separated and reused according to the configured build policy.
    • Build policies can distinguish explicitly allowed, explicitly denied, and undecided dependencies.
  • Bug Fixes

    • Git-hosted packages can now be installed successfully when preparation is explicitly denied, without incorrectly treating them as unavailable.
    • Improved cache handling across changes to build permissions and script settings.
  • Tests

    • Added coverage for denied preparation, source preservation, lifecycle scripts, and cache reuse.

Install git-hosted dependencies unprepared when their builds are explicitly denied.
Preserve errors for undecided builds and separate prepared and unprepared caches
in both CLI versions.

Closes #10522.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ab4ab55e-7a53-4648-94bc-191cd00d86cd

📥 Commits

Reviewing files that changed from the base of the PR and between 616b043 and c27fc28.

📒 Files selected for processing (30)
  • .changeset/git-dependency-denied-preparation.md
  • pnpm/crates/cli/tests/suite/git_hosted_install/builds.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/cache_keys.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/pipeline.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/warm.rs
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile/materialization.rs
  • pnpm/crates/deps-restorer/src/install_package_by_snapshot/fetch.rs
  • pnpm/crates/deps-restorer/src/install_package_by_snapshot/fetch/sources.rs
  • pnpm/crates/git-fetcher/src/fetcher.rs
  • pnpm/crates/git-fetcher/src/fetcher/tests.rs
  • pnpm/crates/git-fetcher/src/fetcher/tests/behavior.rs
  • pnpm/crates/git-fetcher/src/fetcher/tests/manifests.rs
  • pnpm/crates/git-fetcher/src/lib.rs
  • pnpm/crates/git-fetcher/src/prepare_package.rs
  • pnpm/crates/git-fetcher/src/prepare_package/tests.rs
  • pnpm/crates/git-fetcher/src/tarball_fetcher.rs
  • pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs
  • pnpm/crates/package-manager/src/patch.rs
  • pnpm/crates/package-manager/src/patch/tests.rs
  • pnpm11/exec/prepare-package/src/index.ts
  • pnpm11/exec/prepare-package/test/index.ts
  • pnpm11/fetching/fetcher-base/src/index.ts
  • pnpm11/fetching/git-fetcher/src/index.ts
  • pnpm11/fetching/git-fetcher/test/index.ts
  • pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts
  • pnpm11/fetching/tarball-fetcher/test/fetch.ts
  • pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts
  • pnpm11/installing/package-requester/src/packageRequester.ts
  • pnpm11/installing/package-requester/test/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Git-hosted package preparation now treats allowBuilds: false as an explicit skip. Source files remain available, lifecycle scripts do not run, and built and unbuilt packages use separate store-index keys. Unspecified permissions still require a decision.

Changes

Git-hosted preparation contract

Layer / File(s) Summary
Tri-state build permission and preparation results
pnpm/crates/git-fetcher/..., pnpm11/exec/prepare-package/..., pnpm11/fetching/fetcher-base/src/index.ts
Build callbacks now return Option<bool> or equivalent values. Explicit denial skips preparation and reports ignoredBuild; an undecided result still raises the preparation error.
Fetcher and store-index handling
pnpm/crates/git-fetcher/..., pnpm11/fetching/git-fetcher/..., pnpm11/fetching/tarball-fetcher/...
Git fetchers propagate ignored-build state and use build-state-specific store-index keys. Fast and slow paths now retain source files and write the appropriate index entry.

Policy propagation and cache reuse

Layer / File(s) Summary
Policy-aware fetching and prefetching
pnpm/crates/deps-restorer/..., pnpm/crates/package-manager/src/patch.rs
Build-policy results flow through snapshot fetching, git preparation, CAS prefetching, and cache-key derivation. Explicit denials select the not-built key.
Package requester cache selection
pnpm11/installing/package-requester/src/packageRequester.ts
Store lookup and reuse now consider allowBuild, ignoredBuild, and filesIndexFile, including fallback to the git-hosted not-built entry.
Regression coverage and release metadata
pnpm/crates/cli/tests/..., pnpm/crates/git-fetcher/.../tests, pnpm11/.../test, .changeset/git-dependency-denied-preparation.md
Tests cover denied preparation, preserved source files, lifecycle output, policy transitions, and reuse of built and unbuilt entries. The changeset documents the patch release.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Install
  participant PackageRequester
  participant GitFetcher
  participant StoreIndex
  Install->>PackageRequester: resolve git-hosted dependency
  PackageRequester->>GitFetcher: fetch with allowBuild policy
  GitFetcher->>StoreIndex: select built or not-built key
  StoreIndex-->>PackageRequester: return reusable package source
  PackageRequester-->>Install: materialize dependency
Loading

Assessment against linked issues

Objective Addressed Explanation
Skip prepare for git-hosted packages when ignoredBuiltDependencies or allowBuilds: false is set [#10522] ✅
Allow installation to succeed while preserving the package source [#10522] ✅
Require a decision when preparation is not explicitly allowed or denied [#10522] ✅

Possibly related PRs

  • pnpm/pnpm#14160: Both changes update build-permission handling and git-hosted store-entry reuse.

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

Merge Risk: ⚪ Minimal · up to c27fc

The release metadata is compatible with the repository’s pending changeset history, and no actionable merge risk remains.

✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

pnpm11/exec/prepare-package/src/index.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

pnpm11/exec/prepare-package/test/index.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

pnpm11/fetching/fetcher-base/src/index.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

  • 7 others

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.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.04     12.1±0.11ms    30.9 MB/sec    1.00     11.6±0.03ms    32.2 MB/sec
packument/parse                                  1.09     41.9±0.10µs  1582.7 MB/sec    1.00     38.5±0.19µs  1721.2 MB/sec
tarball/download_dependency                      1.00      4.0±0.09ms  1084.9 KB/sec    1.00      4.0±0.08ms  1085.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    182.9±2.41ms 87.5 KElem/sec    1.00    182.8±1.57ms 87.5 KElem/sec
workspace_resolution/hoist_heavy                 1.00    237.0±1.09ms        ? ?/sec    1.01    239.7±0.99ms        ? ?/sec
workspace_sort/chained_projects                  1.00     14.0±0.92ms        ? ?/sec    1.03     14.4±0.48ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.69027% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.31%. Comparing base (616b043) to head (c27fc28).

Files with missing lines Patch % Lines
...r/src/install_package_by_snapshot/fetch/sources.rs 40.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15149   +/-   ##
=======================================
  Coverage   91.31%   91.31%           
=======================================
  Files        1352     1352           
  Lines      181589   181648   +59     
=======================================
+ Hits       165812   165877   +65     
+ Misses      15777    15771    -6     

☔ 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 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: c27fc28e4696

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. 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.453 ± 0.153 2.249 2.721 1.73 ± 0.19
pacquet@main 2.398 ± 0.145 2.233 2.634 1.69 ± 0.19
pnpr@HEAD 1.422 ± 0.131 1.301 1.663 1.00
pnpr@main 1.499 ± 0.101 1.337 1.636 1.05 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4534946275200005,
      "stddev": 0.15251114154143203,
      "median": 2.44048982202,
      "user": 1.2935811,
      "system": 1.4788670400000001,
      "min": 2.24925851902,
      "max": 2.72086542702
    },
    {
      "command": "pacquet@main",
      "mean": 2.3981021172199997,
      "stddev": 0.1449865839021529,
      "median": 2.39249696052,
      "user": 1.221187,
      "system": 1.49716174,
      "min": 2.23270857402,
      "max": 2.6339134000200004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.42186405162,
      "stddev": 0.13064256791224513,
      "median": 1.36438064152,
      "user": 1.1586335,
      "system": 1.3213464400000001,
      "min": 1.30078552702,
      "max": 1.66259787402
    },
    {
      "command": "pnpr@main",
      "mean": 1.4990377934199999,
      "stddev": 0.10138485487620023,
      "median": 1.51930113252,
      "user": 1.1562338999999997,
      "system": 1.3644715399999998,
      "min": 1.33703447302,
      "max": 1.63552322502
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 211.7 ± 3.8 203.1 215.4 1.00
pacquet@main 213.3 ± 5.7 204.9 222.2 1.01 ± 0.03
pnpr@HEAD 226.8 ± 6.4 217.3 240.5 1.07 ± 0.04
pnpr@main 224.1 ± 10.8 211.8 249.1 1.06 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21167950388000004,
      "stddev": 0.0038152804212823054,
      "median": 0.21272794678,
      "user": 0.22668110000000002,
      "system": 0.54074212,
      "min": 0.20312444978000002,
      "max": 0.21543883178
    },
    {
      "command": "pacquet@main",
      "mean": 0.21334749108,
      "stddev": 0.005725692262002859,
      "median": 0.21367630128,
      "user": 0.22794829999999994,
      "system": 0.55697952,
      "min": 0.20491519278,
      "max": 0.22217531878000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.22675382198,
      "stddev": 0.006401284998605785,
      "median": 0.22696537728000002,
      "user": 0.22748819999999995,
      "system": 0.54862332,
      "min": 0.21729986478000002,
      "max": 0.24048264178
    },
    {
      "command": "pnpr@main",
      "mean": 0.22410251367999998,
      "stddev": 0.01078627086170544,
      "median": 0.22261828778000003,
      "user": 0.23053199999999996,
      "system": 0.5268876199999999,
      "min": 0.21175426078,
      "max": 0.24911833378
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 6.4 ± 0.3 5.9 7.5 1.00
pacquet@main 6.5 ± 0.3 5.9 8.3 1.01 ± 0.06
pnpr@HEAD 6.5 ± 0.3 5.9 8.2 1.01 ± 0.06
pnpr@main 6.6 ± 0.3 5.8 7.6 1.03 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.006406841775078533,
      "stddev": 0.00026896227317542724,
      "median": 0.00640771594,
      "user": 0.0038721769633507856,
      "system": 0.002890762460732986,
      "min": 0.00585389144,
      "max": 0.00751037244
    },
    {
      "command": "pacquet@main",
      "mean": 0.00649272918365482,
      "stddev": 0.00029516422110407,
      "median": 0.00646808494,
      "user": 0.004071566497461925,
      "system": 0.0028197626395939086,
      "min": 0.00588187344,
      "max": 0.008348125440000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.006476687632399054,
      "stddev": 0.0002855537033839337,
      "median": 0.00646835444,
      "user": 0.003996906888361044,
      "system": 0.002838466650831355,
      "min": 0.00587436944,
      "max": 0.008179088440000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.0065785259975000045,
      "stddev": 0.00025350536511013083,
      "median": 0.00657467994,
      "user": 0.004290257499999999,
      "system": 0.0027198275500000015,
      "min": 0.00581473744,
      "max": 0.00761377644
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 6.5 ± 0.3 5.7 7.8 1.00
pacquet@main 6.8 ± 0.3 5.8 8.0 1.03 ± 0.07
pnpr@HEAD 6.6 ± 0.4 5.8 9.1 1.02 ± 0.07
pnpr@main 6.6 ± 0.3 5.8 7.4 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0065473810309289535,
      "stddev": 0.0003076497392508594,
      "median": 0.00654690502,
      "user": 0.0038457753005464485,
      "system": 0.0031083504918032797,
      "min": 0.00569721052,
      "max": 0.00783628552
    },
    {
      "command": "pacquet@main",
      "mean": 0.006764843749813664,
      "stddev": 0.00032251394850986464,
      "median": 0.0067411350200000004,
      "user": 0.004131822732919254,
      "system": 0.003055501987577641,
      "min": 0.00583342552,
      "max": 0.00795305652
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.006649853463620182,
      "stddev": 0.0003506409416358387,
      "median": 0.00666406552,
      "user": 0.004030931216617209,
      "system": 0.0030430608902077133,
      "min": 0.00584332452,
      "max": 0.00906687752
    },
    {
      "command": "pnpr@main",
      "mean": 0.006582305857175792,
      "stddev": 0.00025792032605293646,
      "median": 0.006599344520000001,
      "user": 0.0041202576945244965,
      "system": 0.002894625129682997,
      "min": 0.00577763152,
      "max": 0.00740719152
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.426 ± 0.013 2.400 2.443 1.67 ± 0.11
pacquet@main 2.424 ± 0.010 2.407 2.441 1.67 ± 0.11
pnpr@HEAD 1.496 ± 0.138 1.351 1.689 1.03 ± 0.12
pnpr@main 1.454 ± 0.094 1.371 1.628 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.42649671576,
      "stddev": 0.013313920388351093,
      "median": 2.42832338266,
      "user": 1.7033896199999998,
      "system": 1.40830672,
      "min": 2.39954122566,
      "max": 2.44288316566
    },
    {
      "command": "pacquet@main",
      "mean": 2.42432600936,
      "stddev": 0.010480575412355869,
      "median": 2.42233864466,
      "user": 1.63741532,
      "system": 1.4278174199999998,
      "min": 2.40711460466,
      "max": 2.44118585566
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4961758271599996,
      "stddev": 0.13842464071986207,
      "median": 1.45650449516,
      "user": 1.0738063199999999,
      "system": 1.1803334200000004,
      "min": 1.35125537066,
      "max": 1.68924881566
    },
    {
      "command": "pnpr@main",
      "mean": 1.45361926536,
      "stddev": 0.09414043480808007,
      "median": 1.3959671946599999,
      "user": 1.1238438199999998,
      "system": 1.13413772,
      "min": 1.37146798666,
      "max": 1.62759569466
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 342.7 ± 20.0 303.0 369.6 1.29 ± 0.08
pacquet@main 351.2 ± 15.4 331.0 369.7 1.32 ± 0.07
pnpr@HEAD 278.7 ± 11.9 253.1 289.7 1.05 ± 0.05
pnpr@main 266.2 ± 6.2 259.7 278.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.34272292928,
      "stddev": 0.02002892037677826,
      "median": 0.34658580898,
      "user": 0.53729494,
      "system": 0.78088936,
      "min": 0.30302954098,
      "max": 0.36955708898
    },
    {
      "command": "pacquet@main",
      "mean": 0.35117187167999997,
      "stddev": 0.01538527520856,
      "median": 0.34955661848,
      "user": 0.5485925400000001,
      "system": 0.77670806,
      "min": 0.33102980298,
      "max": 0.36971271198
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27865219158,
      "stddev": 0.011881260837519454,
      "median": 0.28451617598,
      "user": 0.22768753999999997,
      "system": 0.49739526000000006,
      "min": 0.25309850497999997,
      "max": 0.28966506197999997
    },
    {
      "command": "pnpr@main",
      "mean": 0.26624188528000003,
      "stddev": 0.0061824990637474545,
      "median": 0.26420400048000003,
      "user": 0.21963603999999998,
      "system": 0.52246106,
      "min": 0.25965949698,
      "max": 0.27875713298
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.542 ± 0.029 1.499 1.595 6.05 ± 0.20
pacquet@main 1.549 ± 0.076 1.498 1.731 6.08 ± 0.34
pnpr@HEAD 0.282 ± 0.009 0.270 0.296 1.11 ± 0.05
pnpr@main 0.255 ± 0.007 0.246 0.266 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.54156708582,
      "stddev": 0.028525900791995077,
      "median": 1.54337475732,
      "user": 0.8277882,
      "system": 0.9027678199999999,
      "min": 1.49863051132,
      "max": 1.59503809632
    },
    {
      "command": "pacquet@main",
      "mean": 1.5494670575199998,
      "stddev": 0.07643064104038429,
      "median": 1.51935175382,
      "user": 0.8206994999999999,
      "system": 0.9772285199999999,
      "min": 1.49842933832,
      "max": 1.7311825523200002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28193981772,
      "stddev": 0.009178997997052792,
      "median": 0.28168578382000004,
      "user": 0.20764280000000004,
      "system": 0.47198132,
      "min": 0.26970583732000003,
      "max": 0.29584028432000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.25494080302,
      "stddev": 0.006938770444618718,
      "median": 0.25399503432000003,
      "user": 0.2083063,
      "system": 0.4537409199999999,
      "min": 0.24576274232,
      "max": 0.26649000932
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 198.5 ± 13.7 181.0 228.0 2.16 ± 0.17
pacquet@main 209.8 ± 12.5 191.0 226.0 2.28 ± 0.16
pnpr@HEAD 92.0 ± 3.2 86.9 98.4 1.00
pnpr@main 92.8 ± 2.1 89.3 98.6 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.19849516764000003,
      "stddev": 0.013712251743672098,
      "median": 0.19486748664,
      "user": 0.19582264,
      "system": 0.08605553333333334,
      "min": 0.18104855864000002,
      "max": 0.22803250364000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.2097711584971429,
      "stddev": 0.012500208658354354,
      "median": 0.21104238164,
      "user": 0.19623285428571427,
      "system": 0.08871282857142856,
      "min": 0.19096806664000002,
      "max": 0.22600708164000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09198680641419354,
      "stddev": 0.0031504448764700286,
      "median": 0.09181933864000001,
      "user": 0.030982994838709678,
      "system": 0.016228483870967744,
      "min": 0.08690628064000001,
      "max": 0.09844035764000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.09281539147870968,
      "stddev": 0.002058382556397523,
      "median": 0.09298772264,
      "user": 0.031183930322580634,
      "system": 0.016489432258064516,
      "min": 0.08925899864000002,
      "max": 0.09856898264000001
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 591.7 ± 65.4 482.3 695.8 1.02 ± 0.17
pacquet@main 580.1 ± 73.4 423.3 677.1 1.00
pnpm@HEAD 2837.3 ± 109.9 2729.4 3026.4 4.89 ± 0.65
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5916819647733333,
      "stddev": 0.06535847934691931,
      "median": 0.56748840844,
      "user": 0.6178681311111112,
      "system": 0.11534863999999999,
      "min": 0.48232294044,
      "max": 0.69580801144
    },
    {
      "command": "pacquet@main",
      "mean": 0.5801000092177778,
      "stddev": 0.07344939721519868,
      "median": 0.59565830844,
      "user": 0.6047266866666666,
      "system": 0.14411508444444443,
      "min": 0.42326062144000004,
      "max": 0.67705693144
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.837259888995556,
      "stddev": 0.10994364929433388,
      "median": 2.7920336694400003,
      "user": 4.477795353333334,
      "system": 0.21638308444444443,
      "min": 2.72940108444,
      "max": 3.0264407064400003
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 154.8 ± 3.3 152.2 163.7 1.00
pacquet@main 160.9 ± 5.9 153.6 176.1 1.04 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.15482933123894738,
      "stddev": 0.003261694241023849,
      "median": 0.15320660666000002,
      "user": 0.1077934294736842,
      "system": 0.07998349684210525,
      "min": 0.15221930466000003,
      "max": 0.16372460466000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.16090767716000004,
      "stddev": 0.005857010267436626,
      "median": 0.16116193066,
      "user": 0.11871652888888888,
      "system": 0.07862370444444444,
      "min": 0.15363986966,
      "max": 0.17613232666000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.388 ± 0.088 4.287 4.574 1.28 ± 0.04
pacquet@main 4.421 ± 0.142 4.301 4.735 1.29 ± 0.05
pnpr@HEAD 3.516 ± 0.140 3.371 3.738 1.03 ± 0.05
pnpr@main 3.426 ± 0.078 3.361 3.576 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.38755645482,
      "stddev": 0.08794968422723703,
      "median": 4.38517186302,
      "user": 1.4285691999999999,
      "system": 1.6231096600000001,
      "min": 4.28675858502,
      "max": 4.5742977080200005
    },
    {
      "command": "pacquet@main",
      "mean": 4.421129093319999,
      "stddev": 0.14217477814614246,
      "median": 4.38574344952,
      "user": 1.4093124,
      "system": 1.49892246,
      "min": 4.30051143602,
      "max": 4.7352810210200005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5155205234199998,
      "stddev": 0.1401565796030178,
      "median": 3.46581337252,
      "user": 1.3285560000000003,
      "system": 1.43820986,
      "min": 3.3712568000200003,
      "max": 3.73815347802
    },
    {
      "command": "pnpr@main",
      "mean": 3.4259038839200002,
      "stddev": 0.07773734883448805,
      "median": 3.3879910330200005,
      "user": 1.3081242,
      "system": 1.42658716,
      "min": 3.36086586502,
      "max": 3.57598549302
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 101.5 ± 4.7 91.4 111.3 1.00
pacquet@main 104.2 ± 10.6 94.0 127.9 1.03 ± 0.11
pnpr@HEAD 111.8 ± 5.5 103.1 122.2 1.10 ± 0.07
pnpr@main 180.6 ± 25.5 116.1 224.4 1.78 ± 0.26
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.10152276025629633,
      "stddev": 0.0046809967652231745,
      "median": 0.10065556796000001,
      "user": 0.12603367259259257,
      "system": 0.1269825637037037,
      "min": 0.09138238196000001,
      "max": 0.11128255196
    },
    {
      "command": "pacquet@main",
      "mean": 0.10415873268000002,
      "stddev": 0.010561874717578853,
      "median": 0.09945982796000001,
      "user": 0.12964467999999998,
      "system": 0.12465794,
      "min": 0.09395207096000001,
      "max": 0.12785068596
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11176044096000001,
      "stddev": 0.005481741137276186,
      "median": 0.11121111946000001,
      "user": 0.1304894436363636,
      "system": 0.12215831454545456,
      "min": 0.10310878596,
      "max": 0.12222839496000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.1805555240054545,
      "stddev": 0.02546960067656977,
      "median": 0.18408468146,
      "user": 0.19719103454545453,
      "system": 0.21500995090909084,
      "min": 0.11605373296,
      "max": 0.22436520896
    }
  ]
}

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/15149
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
91.38 ms
(-9.54%)Baseline: 101.02 ms
121.22 ms
(75.39%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,399.54 ms
(-1.17%)Baseline: 2,428.04 ms
2,913.65 ms
(82.36%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,498.63 ms
(-2.19%)Baseline: 1,532.25 ms
1,838.70 ms
(81.51%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
303.03 ms
(-9.66%)Baseline: 335.44 ms
402.53 ms
(75.28%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
181.05 ms
(-0.16%)Baseline: 181.34 ms
217.61 ms
(83.20%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,249.26 ms
(+0.59%)Baseline: 2,236.07 ms
2,683.28 ms
(83.82%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,286.76 ms
(-0.05%)Baseline: 4,288.78 ms
5,146.54 ms
(83.29%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
203.12 ms
(+2.34%)Baseline: 198.48 ms
238.17 ms
(85.29%)
isolated-linker.linked-workspace-resolve.hot-cache.offline📈 view plot
🚷 view threshold
152.22 ms
(-8.93%)Baseline: 167.14 ms
200.57 ms
(75.89%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
482.32 ms
(-7.41%)Baseline: 520.95 ms
625.14 ms
(77.15%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
5.70 ms
(-6.06%)Baseline: 6.06 ms
7.28 ms
(78.28%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
5.85 ms
(-3.92%)Baseline: 6.09 ms
7.31 ms
(80.06%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/15149
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)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
103.11 ms
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,351.26 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
269.71 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
253.10 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
86.91 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,300.79 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,371.26 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
217.30 ms
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
5.84 ms
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
5.87 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan marked this pull request as ready for review September 20, 2026 01:02
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Skip preparation for explicitly denied Git dependency builds

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Installs explicitly denied Git dependencies from source without running preparation scripts.
• Keeps undecided dependencies blocked until allowBuilds records an explicit decision.
• Separates prepared and unprepared caches across Rust and TypeScript CLIs.
Diagram

graph TD
  A["allowBuilds policy"] --> B{"Build decision"}
  B -- Denied --> C["Skip preparation"] --> D["Unprepared cache"] --> H["Install package"]
  B -- Allowed --> E["Run preparation"] --> F["Prepared cache"] --> H
  B -- Undecided --> G["Approval error"]
Loading
High-Level Assessment

The tri-state permission model is the appropriate approach because approval, explicit denial, and no decision have distinct required outcomes. Propagating skipped-preparation state and separating built and not-built store keys prevents policy changes from reusing incompatible artifacts; treating denial as an error or sharing one cache entry would preserve the original bug or introduce stale prepared output.

Files changed (29) +426 / -169

Bug fix (17) +196 / -103
create_virtual_store.rsPass build policy into CAS prefetch +3/-1

Pass build policy into CAS prefetch

• Extends virtual-store prefetch initialization with the active build policy so cache-key derivation can distinguish denied Git builds.

pnpm/crates/deps-restorer/src/create_virtual_store.rs

cache_keys.rsSelect unprepared cache keys for denied Git builds +16/-3

Select unprepared cache keys for denied Git builds

• Derives not-built Git store keys when the package build is explicitly denied. This keeps prefetch lookup aligned with fetcher writes.

pnpm/crates/deps-restorer/src/create_virtual_store/cache_keys.rs

pipeline.rsWire build policy into virtual-store prefetch +1/-0

Wire build policy into virtual-store prefetch

• Supplies the install context's build policy when starting CAS prefetch.

pnpm/crates/deps-restorer/src/create_virtual_store/pipeline.rs

warm.rsValidate cached Git entries against tri-state permissions +7/-5

Validate cached Git entries against tri-state permissions

• Reuses unprepared entries only for explicit denials and prepared entries only for approvals. Undecided packages requiring preparation continue through the approval error path.

pnpm/crates/deps-restorer/src/create_virtual_store/warm.rs

materialization.rsPrefetch frozen installs with build policy +15/-7

Prefetch frozen installs with build policy

• Extracts store prefetch into a helper and passes the frozen install's build policy into cache-key derivation.

pnpm/crates/deps-restorer/src/install_frozen_lockfile/materialization.rs

fetch.rsPreserve tri-state build decisions during fetching +3/-7

Preserve tri-state build decisions during fetching

• Changes the build callback from a boolean to 'Option<bool>', preserving the distinction between explicit denial and no decision.

pnpm/crates/deps-restorer/src/install_package_by_snapshot/fetch.rs

sources.rsRoute denied Git sources to not-built store entries +11/-13

Route denied Git sources to not-built store entries

• Selects unprepared store keys for explicitly denied cloned repositories and Git-hosted tarballs. Both source paths now pass tri-state permissions to their fetchers.

pnpm/crates/deps-restorer/src/install_package_by_snapshot/fetch/sources.rs

fetcher.rsStore skipped Git preparation under the correct key +13/-10

Store skipped Git preparation under the correct key

• Consumes the richer preparation result, warns for skipped builds, and writes files under a prepared or unprepared key matching the resolved permission.

pnpm/crates/git-fetcher/src/fetcher.rs

lib.rsExport tri-state build permission resolver +1/-1

Export tri-state build permission resolver

• Replaces the assertion helper export with the resolver that returns approval or denial and errors when undecided.

pnpm/crates/git-fetcher/src/lib.rs

prepare_package.rsDistinguish denied and undecided Git preparation +40/-16

Distinguish denied and undecided Git preparation

• Introduces tri-state build callbacks and records whether preparation was skipped. Explicit denials retain source files, undecided builds error, and cache keys reflect prepared versus unprepared output.

pnpm/crates/git-fetcher/src/prepare_package.rs

tarball_fetcher.rsHandle skipped preparation in Git tarball fetching +27/-11

Handle skipped preparation in Git tarball fetching

• Propagates ignored-build state through fast and slow tarball paths. Prepared and unprepared results are indexed separately while source-identical skipped builds avoid unnecessary re-imports.

pnpm/crates/git-fetcher/src/tarball_fetcher.rs

patch.rsMark patch-time Git preparation as undecided +1/-1

Mark patch-time Git preparation as undecided

• Updates the package patching callback to the tri-state permission contract without implicitly granting or explicitly denying preparation.

pnpm/crates/package-manager/src/patch.rs

index.tsResolve Git preparation permissions in pnpm 11 +9/-6

Resolve Git preparation permissions in pnpm 11

• Adds ignored-build state and distinguishes explicit denial from an absent decision. Denied packages keep their source tree, while undecided packages retain the existing approval error.

pnpm11/exec/prepare-package/src/index.ts

index.tsExpose skipped-build state from fetchers +2/-0

Expose skipped-build state from fetchers

• Adds optional 'ignoredBuild' metadata to generic and Git fetch results so requesters and caches can retain the preparation outcome.

pnpm11/fetching/fetcher-base/src/index.ts

index.tsSeparate prepared and denied Git clone cache entries +19/-13

Separate prepared and denied Git clone cache entries

• Propagates ignored-build state from preparation and selects the matching Git store key. Fetch results now expose skipped preparation to the package requester.

pnpm11/fetching/git-fetcher/src/index.ts

gitHostedTarballFetcher.tsSeparate prepared and denied Git tarball entries +8/-4

Separate prepared and denied Git tarball entries

• Carries ignored-build state through Git-hosted tarball preparation and rewrites mismatched store keys. Fast paths now distinguish skipped preparation from ordinary prepared output.

pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts

packageRequester.tsMake package reuse respect Git build decisions +20/-5

Make package reuse respect Git build decisions

• Selects initial store keys using explicit denial, propagates ignored-build state through in-memory fetch locks, and validates cached entries against current policy. This prevents approvals and denials from sharing incompatible Git output.

pnpm11/installing/package-requester/src/packageRequester.ts

Tests (11) +219 / -66
builds.rsTest denied Git builds across policy transitions +46/-0

Test denied Git builds across policy transitions

• Adds an end-to-end Rust CLI test confirming source installation under denial and lifecycle execution under approval. Repeated deny, allow, and deny installs verify cache separation.

pnpm/crates/cli/tests/suite/git_hosted_install/builds.rs

tests.rsAdapt Git fetcher fixtures to tri-state permissions +2/-2

Adapt Git fetcher fixtures to tri-state permissions

• Updates shared test callbacks to represent explicit approval and undecided status with 'Option<bool>'.

pnpm/crates/git-fetcher/src/fetcher/tests.rs

behavior.rsUpdate selective Git approval behavior test +1/-1

Update selective Git approval behavior test

• Adapts the dependency-specific approval callback to return an explicit tri-state decision.

pnpm/crates/git-fetcher/src/fetcher/tests/behavior.rs

manifests.rsUpdate manifest identity permission tests +3/-2

Update manifest identity permission tests

• Migrates manifest identity and dependency-path approval callbacks to the tri-state build policy contract.

pnpm/crates/git-fetcher/src/fetcher/tests/manifests.rs

tests.rsTest explicit denial preserves Git source +26/-6

Test explicit denial preserves Git source

• Updates permission fixtures for tri-state semantics and renames the undecided rejection test. Adds coverage proving explicit denial skips failing lifecycle scripts while preserving source files.

pnpm/crates/git-fetcher/src/prepare_package/tests.rs

tests.rsCover denied and ignored tarball preparation +55/-50

Cover denied and ignored tarball preparation

• Migrates tarball permission fixtures to tri-state callbacks. Expands fast-path coverage to verify both 'ignoreScripts' and explicit denial return source files without indexing them under a prepared key.

pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs

index.tsTest denied preparation in pnpm 11 +15/-1

Test denied preparation in pnpm 11

• Updates selective approval semantics and adds a test proving explicit denial preserves source without executing lifecycle scripts.

pnpm11/exec/prepare-package/test/index.ts

index.tsKeep undecided Git preparation rejection coverage +1/-1

Keep undecided Git preparation rejection coverage

• Changes the blocked-build fixture from explicit denial to an undefined decision, preserving validation of the approval error.

pnpm11/fetching/git-fetcher/test/index.ts

fetch.tsTest denied Git tarball preparation +3/-2

Test denied Git tarball preparation

• Expands skipped-preparation coverage across both ignored scripts and explicit build denial.

pnpm11/fetching/tarball-fetcher/test/fetch.ts

lifecycleScripts.tsTest pnpm 11 Git policy and cache transitions +19/-0

Test pnpm 11 Git policy and cache transitions

• Adds installation coverage for package, artifact, and repository denial rules. Repeated policy transitions verify source availability and isolation of prepared artifacts.

pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts

index.tsTest unknown-name Git cache transitions +48/-1

Test unknown-name Git cache transitions

• Adds coverage ensuring a Git dependency whose name is discovered during fetching does not reuse unprepared files after approval. Existing rejection coverage is updated to model an undecided build.

pnpm11/installing/package-requester/test/index.ts

Documentation (1) +11 / -0
git-dependency-denied-preparation.mdDocument denied Git preparation behavior +11/-0

Document denied Git preparation behavior

• Adds patch releases for the affected pnpm, pacquet, fetching, preparation, and installation packages. The release note explains that explicit denials install source while undecided builds still require a decision.

.changeset/git-dependency-denied-preparation.md

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness or repository-rule violations remain.

Reviews (3) · Last reviewed commit: "fix(install): keep ignored git scripts o..."

@qodo-code-review

qodo-code-review Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Ignored scripts install built output ✓ Resolved 📜 Skill insight ⛨ Security ⭐ New
Description
doFetchToStore probes the opposite Git store key for unknown-name packages, while
cachedPackageCanBeReused immediately accepts that candidate when ignoreScripts is set without
checking its build state. When only a previously prepared entry exists, an --ignore-scripts
install can consume those mutated files and record the built variant as its fetched result instead
of fetching and storing unprepared source under the not-built key.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R623-626]

+        const candidateKeys = [filesIndexFile]
+        if (!opts.pkg.name && (resolutionKind === 'git' || resolutionKind === 'gitHostedTarball')) {
+          candidateKeys.push(gitHostedStoreIndexKey(opts.pkg.id, { built: filesIndexFile.endsWith('\tnot-built') }))
+        }
Relevance

●● Moderate

Potential cache-policy bug, but current reuse logic checks candidate build state; no close rejection
precedent found.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The citations show that ignoreScripts deliberately selects the not-built store key, but the
unnamed Git dependency fallback derives and probes the opposite built key as well. They also show
that cachedPackageCanBeReused returns true for ignored scripts before evaluating the candidate's
build state, despite the store-key documentation requiring built and not-built content to remain
distinct because package preparation mutates cached content.

pnpm11/installing/package-requester/src/packageRequester.ts[623-648]
pnpm11/installing/package-requester/src/packageRequester.ts[731-751]
pnpm11/installing/package-requester/src/packageRequester.ts[420-423]
pnpm11/installing/package-requester/src/packageRequester.ts[732-756]
pnpm11/store/index/src/index.ts[69-80]
pnpm11/fetching/git-fetcher/src/index.ts[71-93]
Skill: review-code

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

## Issue description
Unknown-name Git dependencies probe both prepared and unprepared store keys, but `cachedPackageCanBeReused` treats either verified entry as reusable when scripts are ignored. This allows an `--ignore-scripts` install to consume output created by a previously approved build instead of the unprepared source.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[623-648]
- pnpm11/installing/package-requester/src/packageRequester.ts[731-751]
- pnpm11/installing/package-requester/test/index.ts[745-812]

## Recommended Fix
When `opts.ignoreScripts` is true, do not add, probe, consider, or accept the opposite built Git cache key. Keep the alternate-key fallback limited to cases that require manifest-derived policy resolution, and add a regression test that first leaves an unnamed Git dependency with only a prepared cache entry, then installs with ignored scripts and verifies that the prepared entry is rejected and the unprepared source is fetched and stored under the not-built key.

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


2. Patching hosted repositories now fails ✓ Resolved 📜 Skill insight ⛨ Security
Description
git_hosted_cas_paths returns None from allow_build_closure, which the new tri-state policy
interprets as undecided rather than denied. When pnpm patch opens a Git-hosted tarball containing
preparation scripts, prepare_package raises the approval error before importing its source for
editing.
Code

pnpm/crates/package-manager/src/patch.rs[335]

+    let allow_build_closure = |_dep_path: &str| None;
Relevance

●●● Strong

Patch explicitly forbids builds, so returning undecided preserves the approval error and breaks
Git-hosted patching.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The lifecycle-gate rule requires every dependency source and phase to preserve approval and denial
semantics. The patch path states that nothing may build but supplies None, while
resolve_package_build_permission treats only Some(false) as an explicit denial and rejects
None.

pnpm/crates/package-manager/src/patch.rs[328-363]
pnpm/crates/git-fetcher/src/prepare_package.rs[394-413]
Skill: review-code

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 patch-import path supplies an undecided build decision, so Git-hosted packages requiring preparation fail instead of being imported without running scripts.

## Fix Focus Areas
- pnpm/crates/package-manager/src/patch.rs[335-335]

## Recommended Fix
Return `Some(false)` from `allow_build_closure` so the path explicitly denies and skips preparation while preserving the source for patching.

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



Remediation recommended

3. Cache-key helper precedes its only use 📘 Rule violation ⚙ Maintainability ⭐ New
Description
getFilesIndexFilePath is declared at line 404, but its sole same-file call is later in
fetchToStore at line 476. The newly added policy-sensitive branch extends this top-level helper in
place, leaving readers to encounter its implementation before the only workflow that explains why it
is needed.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R420-423]

+  const resolutionKind = classifyResolution(resolution)
+  const denied = opts.pkg.name != null && (resolutionKind === 'git' || resolutionKind === 'gitHostedTarball') &&
+    opts.allowBuild?.(`${opts.pkg.name}@${opts.pkg.id}` as DepPath) === false
+  const built = !opts.ignoreScripts && !denied
Relevance

●●● Strong

A deterministic local ordering/style rule; accepted same-file helper reordering is likely despite
limited exact precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires a used top-level TypeScript function declaration to follow at least one
same-file call. The modified helper is declared at lines 404-429, while repository search shows its
only call at line 476.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/installing/package-requester/src/packageRequester.ts[404-429]
pnpm11/installing/package-requester/src/packageRequester.ts[476-476]

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 modified top-level cache-key helper is declared before its only same-file usage, contrary to the required TypeScript declaration order.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[404-429]
- pnpm11/installing/package-requester/src/packageRequester.ts[476-476]

## Recommended Fix
Move `getFilesIndexFilePath` below `fetchToStore`, retaining `findResolution` after the helper so both declarations remain after their first usages.

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


4. Warm Git installs verify twice ✓ Resolved 🐞 Bug ➹ Performance ⭐ New
Description
doFetchToStore reads all candidate cache keys concurrently with Promise.all, so an unnamed Git
dependency verifies both prepared and unprepared entries even when the preferred entry is reusable.
Once both variants exist after a policy transition, every warm install dispatches two worker jobs
and performs integrity checks over both packages' complete file maps.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R627-630]

+        const candidates = await Promise.all(candidateKeys.map(async (candidateKey) => {
+          const { verified, files, bundledManifest } = await ctx.readPkgFromCafs(candidateKey, {
+            readManifest: opts.fetchRawManifest,
+            expectedPkg: opts.pkg,
Relevance

●●● Strong

Recent same-file precedents accept findings targeting unnecessary cache reads and duplicated
verification work.

PR-#12491

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed branch creates an alternate key whenever a Git package name is unavailable, then
Promise.all invokes readPkgFromCafs for every candidate before selecting the first reusable
result. readPkgFromCafs checks out a worker, and with integrity verification enabled that worker
runs package-wide file integrity checking, making the second read substantial rather than a cheap
index probe.

pnpm11/installing/package-requester/src/packageRequester.ts[623-648]
pnpm11/worker/src/index.ts[279-307]
pnpm11/worker/src/start.ts[103-145]

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

## Issue description
Warm installs of unnamed Git dependencies read and verify both prepared and unprepared cache variants concurrently, even when the preferred variant is valid and reusable.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[623-648]

## Recommended Fix
Read and validate the preferred `filesIndexFile` first. Only read the alternate Git-hosted key when the preferred candidate is absent, fails verification, or does not match the active build policy, while preserving the selected key update and corrupted-entry refetch behavior.

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


5. Denied tarballs redownload every install ✓ Resolved 🐞 Bug ➹ Performance
Description
The ignoredBuild fast paths in both Git-hosted tarball fetchers return the raw CAS files after
removing the temporary store-index entry but before persisting the selected final unprepared
filesIndexFile row. When preparation is explicitly denied and the archive packlist matches its raw
files, a fresh install looks up the policy-separated not-built key, finds no entry, and repeats
the download, extraction, materialization, and packlist work.
Code

pnpm/crates/git-fetcher/src/tarball_fetcher.rs[R134-141]

+        if fast_path_eligible && prepared.ignored_build {
+            // `should_be_built && ignored_build`: prepare skipped the
            // scripts (warning already logged above), so the
            // materialized tree is still byte-identical to the source.
            // Return the raw filesMap *without* writing a final-key
            // row, so subsequent installs re-check the build gate. This
            // keeps `--ignore-scripts` installs idempotent.
-            return Ok(GitFetchOutput { cas_paths: self.cas_paths, built: should_be_built });
+            return Ok(GitFetchOutput {
Relevance

●●● Strong

Fast paths discard the raw index entry without persisting the policy-specific unprepared key,
causing repeated expensive fetch work.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both changed fast paths return before their normal index-writing code, and the TypeScript path
deletes the temporary raw entry without setting the final key or invoking the normal store-writing
path. The package requester derives and reads a distinct not-built key for explicit preparation
denials, so retained CAS files cannot be recovered after that deletion; the remote tarball path has
no alternative persistent lookup before downloading and extracting again, while cloned Git
dependencies do persist their unprepared row.

pnpm/crates/git-fetcher/src/tarball_fetcher.rs[134-147]
pnpm/crates/git-fetcher/src/tarball_fetcher.rs[150-177]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[101-114]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[115-136]
pnpm11/installing/package-requester/src/packageRequester.ts[618-656]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[27-34]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[91-116]
pnpm11/installing/package-requester/src/packageRequester.ts[420-427]
pnpm11/installing/package-requester/src/packageRequester.ts[600-637]
pnpm11/store/index/src/index.ts[69-70]

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

## Issue description
Explicitly denied Git-hosted tarballs take a byte-identical fast path that removes the raw store-index entry without creating the final unprepared entry. This prevents later installs from reusing the retained CAS files even though the unprepared cache key is already separated from the prepared key by policy.

## Fix Focus Areas
- pnpm/crates/git-fetcher/src/tarball_fetcher.rs[134-147]
- pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[91-116]
- pnpm11/installing/package-requester/src/packageRequester.ts[420-427]

## Recommended Fix
Before returning from the explicitly denied `ignoredBuild` fast path in both Git-hosted tarball fetchers, promote the raw index data to the computed final `filesIndexFile` or `not-built` key before deleting the raw key, retaining `requiresPrepare: true`. This allows later explicit denials to reuse the unprepared artifact while a later approval selects the distinct built key and reruns preparation; continue avoiding a final row for the separate global ignore-scripts case if its recheck semantics require that behavior.

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


View medium (3)
6. A cache test describes only one case ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
The comment in fast_path_skipped_preparation_returns_input_without_queueing_row says
ignore_scripts: true suppresses execution even though the enclosing loop also runs with ignore
set to false. For that second iteration preparation is skipped because of the explicit denial, so
a later reader can misidentify which branch the test covers.
Code

pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs[R708-710]

+        // `prepare` script triggers `should_be_built = true`, but
+        // `ignore_scripts: true` skips the actual execution. With no
+        // `files` field, packlist returns every input file — fast-path
Relevance

●●● Strong

The comment inaccurately describes only ignore-scripts behavior while the test also covers explicit
denial; this is a trivial clarity fix.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The current-behavior rule requires comments to match every path they describe. The loop executes
with both boolean values while the adjacent comment names only the true condition.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs[702-744]

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 test comment describes only the `ignore_scripts` iteration and is inaccurate for the explicit-denial iteration added by the loop.

## Fix Focus Areas
- pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs[708-711]

## Recommended Fix
Rewrite the comment to state that preparation is skipped either by `ignore_scripts` or by an explicit `Some(false)` build decision, depending on the iteration.

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


7. Policy changes misidentify fetched content ✓ Resolved 🐞 Bug ≡ Correctness
Description
fetchToStore recursively refetches Git content when a cached request has the opposite build
policy, but the outer request still returns the original lock's filesIndexFile. A
denied-to-allowed or allowed-to-denied transition within one requester therefore returns files from
one store variant while downstream dependency graphs and side-effects restoration retain the other
variant's key.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R420-423]

+  const resolutionKind = classifyResolution(resolution)
+  const denied = (resolutionKind === 'git' || resolutionKind === 'gitHostedTarball') &&
+    opts.allowBuild?.(`${opts.pkg.name}@${opts.pkg.id}` as DepPath) === false
+  const built = !opts.ignoreScripts && !denied
Relevance

●● Moderate

Policy-transition caching is explicitly targeted, but whether the outer lock metadata becomes stale
requires deeper execution-path confirmation.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new policy-dependent key calculation creates distinct built and unprepared keys. Although an
incompatible cached request is recursively replaced, the outer return value remains
result.filesIndexFile, which downstream resolution and restoration code stores and consumes
independently of the refetched files promise.

pnpm11/installing/package-requester/src/packageRequester.ts[420-426]
pnpm11/installing/package-requester/src/packageRequester.ts[548-577]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2323-2328]
pnpm11/installing/deps-installer/src/install/link.ts[568-578]

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

## Issue description
Policy-sensitive recursive refetching can return content from a different built-state store entry while exposing the stale key selected by the original request.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[548-577]
- pnpm11/installing/package-requester/src/packageRequester.ts[420-426]
- pnpm11/installing/deps-installer/src/install/link.ts[568-578]

## Recommended Fix
Make the policy-sensitive refetch return both its fetching promise and its actual `filesIndexFile`, and expose that replacement key to the caller rather than closing over the original lock's key. Add transition tests that assert both returned files and returned index key.

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


8. Denied installs retain a prepared key ✓ Resolved 📘 Rule violation ≡ Correctness
Description
getFilesIndexFilePath evaluates allowBuild with an undefined@<package-id> identity when the
manifest name is initially unknown, selecting the built-store key even though the resolved manifest
may explicitly deny preparation and cause the fetcher to write unprepared files under the not-built
key. The requester continues exposing and probing the preselected built key for fetch results,
locks, linking, restoration, and cache reuse, so fresh processes miss the written entry and repeat
cloning or tarball download and preparation work.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R420-423]

+  const resolutionKind = classifyResolution(resolution)
+  const denied = (resolutionKind === 'git' || resolutionKind === 'gitHostedTarball') &&
+    opts.allowBuild?.(`${opts.pkg.name}@${opts.pkg.id}` as DepPath) === false
+  const built = !opts.ignoreScripts && !denied
Relevance

●● Moderate

The PR explicitly targets unknown names and key separation, but the requester-key interaction
remains semantically complex.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
An absent package name is explicitly supported by fetching the raw manifest, but the v11
implementation makes the store-key decision policy-sensitive before that manifest is available. The
later preparation gate evaluates the resolved manifest name and redirects explicitly denied output
to the unprepared key while recording only ignoredBuild, leaving requester reads and the returned
key tied to the original built key; the equivalent v12 path instead derives or redirects the key
from the resolved preparation result, demonstrating that the release-line paths are not functionally
aligned for initially unknown names.

Rule 3102961: Keep pnpm v11 and v12 bug-fix code paths functionally aligned
pnpm11/installing/package-requester/src/packageRequester.ts[470-493]
pnpm11/installing/package-requester/src/packageRequester.ts[548-577]
pnpm/crates/git-fetcher/src/prepare_package.rs[69-84]
pnpm11/installing/package-requester/src/packageRequester.ts[312-321]
pnpm11/installing/package-requester/src/packageRequester.ts[477-491]
pnpm11/exec/prepare-package/src/index.ts[72-89]
pnpm11/fetching/git-fetcher/src/index.ts[78-91]
pnpm11/installing/package-requester/src/packageRequester.ts[618-642]

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

## Issue description
Git dependencies whose package name is initially unknown can evaluate build policy against an invalid `undefined@<package-id>` identity, causing the requester to retain the built-entry key while the fetcher writes explicitly denied output to the not-built entry. Subsequent consumers and fresh installs therefore address the wrong entry and repeat fetch or preparation work.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[420-426]
- pnpm11/installing/package-requester/src/packageRequester.ts[558-562]
- pnpm11/installing/package-requester/src/packageRequester.ts[618-642]
- pnpm11/installing/package-requester/src/packageRequester.ts[686-690]
- pnpm11/fetching/git-fetcher/src/index.ts[84-91]

## Recommended Fix
Carry the fetcher's actual final store-index key back to the requester, and ensure the fetch result, lock, linking path, restoration path, and cache-reuse checks all use that final key. When the package name is unavailable, probe both Git built-state index keys and validate any found manifest against the active build policy before reuse. Extend the unknown-name policy-transition test to assert that the returned key identifies the entry that was actually fetched and written.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 64 rules
✅ Skills: review-code
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/pnpm.io (sha: efcdacee)
Review mode: ⚖️ Balanced: This is a behavior-changing cache and Git-preparation decision in runtime package installation code, with meaningful correctness and performance risk but a localized single-path change suitable for one careful review.

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit c27fc28

Results up to commit 339b0d3 🧠 Deep


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Patching hosted repositories now fails ✓ Resolved 📜 Skill insight ⛨ Security
Description
git_hosted_cas_paths returns None from allow_build_closure, which the new tri-state policy
interprets as undecided rather than denied. When pnpm patch opens a Git-hosted tarball containing
preparation scripts, prepare_package raises the approval error before importing its source for
editing.
Code

pnpm/crates/package-manager/src/patch.rs[335]

+    let allow_build_closure = |_dep_path: &str| None;
Relevance

●●● Strong

Patch explicitly forbids builds, so returning undecided preserves the approval error and breaks
Git-hosted patching.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The lifecycle-gate rule requires every dependency source and phase to preserve approval and denial
semantics. The patch path states that nothing may build but supplies None, while
resolve_package_build_permission treats only Some(false) as an explicit denial and rejects
None.

pnpm/crates/package-manager/src/patch.rs[328-363]
pnpm/crates/git-fetcher/src/prepare_package.rs[394-413]
Skill: review-code

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 patch-import path supplies an undecided build decision, so Git-hosted packages requiring preparation fail instead of being imported without running scripts.

## Fix Focus Areas
- pnpm/crates/package-manager/src/patch.rs[335-335]

## Recommended Fix
Return `Some(false)` from `allow_build_closure` so the path explicitly denies and skips preparation while preserving the source for patching.

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



Remediation recommended
2. A cache test describes only one case ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
The comment in fast_path_skipped_preparation_returns_input_without_queueing_row says
ignore_scripts: true suppresses execution even though the enclosing loop also runs with ignore
set to false. For that second iteration preparation is skipped because of the explicit denial, so
a later reader can misidentify which branch the test covers.
Code

pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs[R708-710]

+        // `prepare` script triggers `should_be_built = true`, but
+        // `ignore_scripts: true` skips the actual execution. With no
+        // `files` field, packlist returns every input file — fast-path
Relevance

●●● Strong

The comment inaccurately describes only ignore-scripts behavior while the test also covers explicit
denial; this is a trivial clarity fix.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The current-behavior rule requires comments to match every path they describe. The loop executes
with both boolean values while the adjacent comment names only the true condition.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs[702-744]

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 test comment describes only the `ignore_scripts` iteration and is inaccurate for the explicit-denial iteration added by the loop.

## Fix Focus Areas
- pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs[708-711]

## Recommended Fix
Rewrite the comment to state that preparation is skipped either by `ignore_scripts` or by an explicit `Some(false)` build decision, depending on the iteration.

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


3. Denied tarballs redownload every install ✓ Resolved 🐞 Bug ➹ Performance
Description
The ignoredBuild fast paths in both Git-hosted tarball fetchers return the raw CAS files after
removing the temporary store-index entry but before persisting the selected final unprepared
filesIndexFile row. When preparation is explicitly denied and the archive packlist matches its raw
files, a fresh install looks up the policy-separated not-built key, finds no entry, and repeats
the download, extraction, materialization, and packlist work.
Code

pnpm/crates/git-fetcher/src/tarball_fetcher.rs[R134-141]

+        if fast_path_eligible && prepared.ignored_build {
+            // `should_be_built && ignored_build`: prepare skipped the
            // scripts (warning already logged above), so the
            // materialized tree is still byte-identical to the source.
            // Return the raw filesMap *without* writing a final-key
            // row, so subsequent installs re-check the build gate. This
            // keeps `--ignore-scripts` installs idempotent.
-            return Ok(GitFetchOutput { cas_paths: self.cas_paths, built: should_be_built });
+            return Ok(GitFetchOutput {
Relevance

●●● Strong

Fast paths discard the raw index entry without persisting the policy-specific unprepared key,
causing repeated expensive fetch work.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both changed fast paths return before their normal index-writing code, and the TypeScript path
deletes the temporary raw entry without setting the final key or invoking the normal store-writing
path. The package requester derives and reads a distinct not-built key for explicit preparation
denials, so retained CAS files cannot be recovered after that deletion; the remote tarball path has
no alternative persistent lookup before downloading and extracting again, while cloned Git
dependencies do persist their unprepared row.

pnpm/crates/git-fetcher/src/tarball_fetcher.rs[134-147]
pnpm/crates/git-fetcher/src/tarball_fetcher.rs[150-177]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[101-114]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[115-136]
pnpm11/installing/package-requester/src/packageRequester.ts[618-656]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[27-34]
pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[91-116]
pnpm11/installing/package-requester/src/packageRequester.ts[420-427]
pnpm11/installing/package-requester/src/packageRequester.ts[600-637]
pnpm11/store/index/src/index.ts[69-70]

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

## Issue description
Explicitly denied Git-hosted tarballs take a byte-identical fast path that removes the raw store-index entry without creating the final unprepared entry. This prevents later installs from reusing the retained CAS files even though the unprepared cache key is already separated from the prepared key by policy.

## Fix Focus Areas
- pnpm/crates/git-fetcher/src/tarball_fetcher.rs[134-147]
- pnpm11/fetching/tarball-fetcher/src/gitHostedTarballFetcher.ts[91-116]
- pnpm11/installing/package-requester/src/packageRequester.ts[420-427]

## Recommended Fix
Before returning from the explicitly denied `ignoredBuild` fast path in both Git-hosted tarball fetchers, promote the raw index data to the computed final `filesIndexFile` or `not-built` key before deleting the raw key, retaining `requiresPrepare: true`. This allows later explicit denials to reuse the unprepared artifact while a later approval selects the distinct built key and reruns preparation; continue avoiding a final row for the separate global ignore-scripts case if its recheck semantics require that behavior.

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


4. Policy changes misidentify fetched content ✓ Resolved 🐞 Bug ≡ Correctness
Description
fetchToStore recursively refetches Git content when a cached request has the opposite build
policy, but the outer request still returns the original lock's filesIndexFile. A
denied-to-allowed or allowed-to-denied transition within one requester therefore returns files from
one store variant while downstream dependency graphs and side-effects restoration retain the other
variant's key.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R420-423]

+  const resolutionKind = classifyResolution(resolution)
+  const denied = (resolutionKind === 'git' || resolutionKind === 'gitHostedTarball') &&
+    opts.allowBuild?.(`${opts.pkg.name}@${opts.pkg.id}` as DepPath) === false
+  const built = !opts.ignoreScripts && !denied
Relevance

●● Moderate

Policy-transition caching is explicitly targeted, but whether the outer lock metadata becomes stale
requires deeper execution-path confirmation.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new policy-dependent key calculation creates distinct built and unprepared keys. Although an
incompatible cached request is recursively replaced, the outer return value remains
result.filesIndexFile, which downstream resolution and restoration code stores and consumes
independently of the refetched files promise.

pnpm11/installing/package-requester/src/packageRequester.ts[420-426]
pnpm11/installing/package-requester/src/packageRequester.ts[548-577]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2323-2328]
pnpm11/installing/deps-installer/src/install/link.ts[568-578]

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

## Issue description
Policy-sensitive recursive refetching can return content from a different built-state store entry while exposing the stale key selected by the original request.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[548-577]
- pnpm11/installing/package-requester/src/packageRequester.ts[420-426]
- pnpm11/installing/deps-installer/src/install/link.ts[568-578]

## Recommended Fix
Make the policy-sensitive refetch return both its fetching promise and its actual `filesIndexFile`, and expose that replacement key to the caller rather than closing over the original lock's key. Add transition tests that assert both returned files and returned index key.

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


View medium (1)
5. Denied installs retain a prepared key ✓ Resolved 📘 Rule violation ≡ Correctness
Description
getFilesIndexFilePath evaluates allowBuild with an undefined@<package-id> identity when the
manifest name is initially unknown, selecting the built-store key even though the resolved manifest
may explicitly deny preparation and cause the fetcher to write unprepared files under the not-built
key. The requester continues exposing and probing the preselected built key for fetch results,
locks, linking, restoration, and cache reuse, so fresh processes miss the written entry and repeat
cloning or tarball download and preparation work.
Code

pnpm11/installing/package-requester/src/packageRequester.ts[R420-423]

+  const resolutionKind = classifyResolution(resolution)
+  const denied = (resolutionKind === 'git' || resolutionKind === 'gitHostedTarball') &&
+    opts.allowBuild?.(`${opts.pkg.name}@${opts.pkg.id}` as DepPath) === false
+  const built = !opts.ignoreScripts && !denied
Relevance

●● Moderate

The PR explicitly targets unknown names and key separation, but the requester-key interaction
remains semantically complex.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
An absent package name is explicitly supported by fetching the raw manifest, but the v11
implementation makes the store-key decision policy-sensitive before that manifest is available. The
later preparation gate evaluates the resolved manifest name and redirects explicitly denied output
to the unprepared key while recording only ignoredBuild, leaving requester reads and the returned
key tied to the original built key; the equivalent v12 path instead derives or redirects the key
from the resolved preparation result, demonstrating that the release-line paths are not functionally
aligned for initially unknown names.

Rule 3102961: Keep pnpm v11 and v12 bug-fix code paths functionally aligned
pnpm11/installing/package-requester/src/packageRequester.ts[470-493]
pnpm11/installing/package-requester/src/packageRequester.ts[548-577]
pnpm/crates/git-fetcher/src/prepare_package.rs[69-84]
pnpm11/installing/package-requester/src/packageRequester.ts[312-321]
pnpm11/installing/package-requester/src/packageRequester.ts[477-491]
pnpm11/exec/prepare-package/src/index.ts[72-89]
pnpm11/fetching/git-fetcher/src/index.ts[78-91]
pnpm11/installing/package-requester/src/packageRequester.ts[618-642]

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

## Issue description
Git dependencies whose package name is initially unknown can evaluate build policy against an invalid `undefined@<package-id>` identity, causing the requester to retain the built-entry key while the fetcher writes explicitly denied output to the not-built entry. Subsequent consumers and fresh installs therefore address the wrong entry and repeat fetch or preparation work.

## Fix Focus Areas
- pnpm11/installing/package-requester/src/packageRequester.ts[420-426]
- pnpm11/installing/package-requester/src/packageRequester.ts[558-562]
- pnpm11/installing/package-requester/src/packageRequester.ts[618-642]
- pnpm11/installing/package-requester/src/packageRequester.ts[686-690]
- pnpm11/fetching/git-fetcher/src/index.ts[84-91]

## Recommended Fix
Carry the fetcher's actual final store-index key back to the requester, and ensure the fetch result, lock, linking path, restoration path, and cache-reuse checks all use that final key. When the package name is unavailable, probe both Git built-state index keys and validate any found manifest against the active build policy before reuse. Extend the unknown-name policy-transition test to assert that the returned key identifies the entry that was actually fetched and written.

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


Grey Divider

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 commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

Addressed the first review round in 9141dc9:

  • Inlined the forwarding-only prefetch helper.
  • Made patch extraction explicitly deny preparation and covered it with failing prepare scripts in both hosted-tarball fixtures. The old boolean callback also rejected preparation, so this was an existing limitation rather than a newly introduced regression.
  • Persisted explicitly denied tarballs under the unprepared store key in both implementations. Global ignoreScripts retains its existing fast-path behavior.
  • Removed the outdated test comment and checked that only explicit denial writes the unprepared row.
  • Propagated the actual fetcher-selected store key to the TypeScript requester. In-memory requests distinguish selected store variants, recursive refetches expose the replacement key, and initially unknown names probe both variants with policy validation. Tests cover both known and unknown names, denial/approval transitions, returned keys, and reuse by a fresh requester.

Validation: 104 selected TypeScript tests and 665 selected Rust tests passed. The Rust lint checks also passed.


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

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 20, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 9141dc9

@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.

@greptile-apps
greptile-apps Bot dismissed their stale review September 20, 2026 01:23

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@zkochan

zkochan commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

Addressed the additional cache findings in c27fc28. Ignored-script installs cannot probe the prepared variant, and warm cache reads try the alternate variant only if the preferred entry is unusable. The requester test covers a prepared-only store followed by an ignored-script install. All 30 requester tests, compilation, lint, and the push hooks pass.

The helper-ordering suggestion does not apply: getFilesIndexFilePath is used earlier in this file via getFilesIndexFilePath.bind(...) when createPackageRequester constructs its public API. Its declaration already follows that use, so I left its placement unchanged.


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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit c27fc28

@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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 20, 2026
@zkochan

zkochan commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

Investigated the Bencher alert for isolated-linker.fresh-install.hot-cache.hot-store. The current PR measured a 426.0 ms minimum, while main measured 432.3 ms on the same runner. Their means were 444.0 ms and 575.8 ms respectively. The alert compares the PR against a historical 335.4 ms baseline rather than this run's main measurement.

The same-run comparison does not show a regression from this change. I have rerun the affected scenario and its dependent report to check runner variability.


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

@zkochan

zkochan commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

The targeted benchmark rerun passed. The PR measured a 303.0 ms minimum versus 331.0 ms for main (means: 342.7 ms and 351.2 ms). The Bencher check is now green, supporting runner variability as the cause of the earlier historical-baseline alert. No code change was needed.


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

@zkochan
zkochan merged commit f922cba into main Sep 20, 2026
77 checks passed
@zkochan
zkochan deleted the fix/git-denied-preparation branch September 20, 2026 09:25
u9g pushed a commit to u9g/pnpm that referenced this pull request Sep 25, 2026
Distinguish an explicit denial from an undecided Git dependency build.
Install source files when preparation is denied, while retaining the
approval error for dependencies without a recorded decision.

Carry skipped-preparation state through the fetchers and in-memory cache.
Select the existing unprepared store key for denied builds so subsequent
approvals prepare the dependency and denials do not reuse prepared output.

Apply the behavior to both CLI versions and to cloned Git repositories
and Git-hosted tarballs. Cover explicit denials, policy transitions,
shared-store approval enforcement, and initially unknown package names.

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

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ignoredBuiltDependencies / allowBuilds: false does not work for git-hosted packages

2 participants