Skip to content

fix(pacquet): honor workspace install filters - #13030

Merged
zkochan merged 10 commits into
pnpm:mainfrom
YESHYUNGSEOK:fix/pacquet-install-filters
Jul 18, 2026
Merged

zkochan merged 10 commits into
pnpm:mainfrom
YESHYUNGSEOK:fix/pacquet-install-filters

Conversation

@YESHYUNGSEOK

@YESHYUNGSEOK YESHYUNGSEOK commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Important

This branch must incorporate #13066 before this PR can merge. The intended sequence is to merge #13066 into main, then rebase or update this branch onto the latest main so the zizmor security check runs with the shared fix.

  • Make Pacquet's workspace-aware install, add, update, remove, prune, deploy, audit, fetch, outdated, why, and SBOM paths honor the selected project set instead of processing the workspace as an unscoped install.
  • Batch selected manifest mutations into one install pass, keep the wanted lockfile complete, and materialize only the selected dependency closure in the current lockfile and node_modules state.
  • Preserve the normal unfiltered fast and frozen paths when a recursive selection covers every importer, including autoInstallPeers, excluded explicit links, and workspace self-link serialization.
  • Send and merge multi-importer pnpr resolution requests with strict response validation. The TypeScript CLI already has the filtered-workspace behavior; this brings Pacquet into parity.

This Draft PR is stacked on #13016, which supplies the workspace project identity metadata used by pnpr. It must be rebased after that PR lands; the five commits after the dependency commit contain this PR's implementation.

Verification included the repository pre-push hook, workspace cargo check, strict Clippy and rustdoc, targeted library and integration suites, self-hosted regular and recursive lockfile-only installs with no pnpm-lock.yaml changes, and the Windows-equivalent workspace path regression.

Squash Commit Body

Pacquet's recursive command pipeline previously dispatched selected projects independently or lost the selection before package-manager execution. This could overwrite earlier manifest mutations, truncate workspace lockfile state, or materialize projects outside the requested filter.

Thread one workspace selection through command dispatch and package-manager execution, batch manifest mutations into a single install, retain the complete wanted lockfile, and derive current-lockfile and node_modules state from the selected dependency closure. Apply the same workspace root and selection semantics to query, state, global, deploy, and pnpr-backed paths.

Keep full-workspace recursive installs on the ordinary unfiltered fast and frozen paths, and add regression coverage for filtering, lockfile preservation, dependency closure materialization, pnpr multi-importer responses, and TypeScript parity edge cases.

Depends on pnpm/pnpm#13016.

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.

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


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

    • Filtered workspace installs can now install only a selected projects’ dependency closure, including pnpr-server resolution.
    • Selection scope is applied consistently across add/update/remove/install/why/outdated/recursive operations.
  • Bug Fixes

    • Improved lockfile sourcing consistency by using state-derived lockfile paths across commands (add/update/remove/install/audit/fetch/link/prune/rebuild/unlink/etc.).
    • Strengthened lockfile filtering/merge/materialization to keep unselected importers consistent.
    • SBOM generation now safely confines importer paths to the lockfile root.
  • Tests

    • Added extensive e2e/unit coverage for filtered installs, pnpr multi-project resolution/identity forwarding, importer-scoped outdated/why/sbom behavior, and recursive shared-lockfile failures.

@coderabbitai

coderabbitai Bot commented Jul 15, 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

Pacquet adds filtered workspace operations, dependency-closure materialization, importer-aware lockfile paths and resolution, normalized workspace links, and PNPR multi-project identity forwarding across CLI, package-manager, resolver, and integration-test layers.

Changes

Workspace install and PNPR integration

Layer / File(s) Summary
Workspace selection and CLI orchestration
pnpm/crates/cli/src/cli_args/*, pnpm/crates/cli/src/state.rs
Recursive install-family selection routes install, add, update, and remove operations through selected-project entry points and shared-workspace lockfile helpers.
Selected package operations
pnpm/crates/package-manager/src/{add,update,remove}.rs
Selected manifests, catalogs, dependency mutations, persistence, and install requests are handled without applying changes to unselected projects.
Lockfile closure and materialization
pnpm/crates/package-manager/src/{current_lockfile,install,install_frozen_lockfile,install_with_fresh_lockfile}.rs
Reachable importer and snapshot closures, wanted/current lockfile merging, filtered workspace metadata, freshness checks, hoisted linking, and lifecycle inputs follow the selected project scope.
Resolver link and reuse behavior
pnpm/crates/resolving-deps-resolver/src/*
Importer-specific update reuse scopes are threaded through workspace resolution, and link: identifiers are normalized relative to lockfile and project directories.
PNPR project identity
pnpm/crates/pnpr-client/src/*, pnpr/crates/pnpr/src/*, pnpr/client/src/*, pnpm11/installing/deps-installer/src/*
Multi-project PNPR requests preserve project names and versions, reconstructed manifests use those identities, and cache keys include them.
Regression coverage and release metadata
pnpm/crates/cli/tests/*, pnpm/crates/package-manager/src/*/tests.rs, pnpr/*/test*, .changeset/*
Tests cover filtered operations, lockfile merging, workspace commands, PNPR protocol behavior, workspace links, identity handling, and patch releases.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#12151 — Relates to PNPR multi-project request and lockfile forwarding.
  • pnpm/pnpm#12994 — Touches fresh-lockfile install behavior in the same package-manager path.
  • pnpm/pnpm#13016 — Directly relates to PNPR project identity forwarding and cache-key changes.

Suggested labels: product: pacquet, product: pnpr

Suggested reviewers: zkochan, qodo-code-review

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

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: e0e361ce21ec

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.432 ± 0.130 2.329 2.735 1.59 ± 0.17
pacquet@main 2.490 ± 0.145 2.336 2.713 1.63 ± 0.18
pnpr@HEAD 1.588 ± 0.123 1.339 1.733 1.04 ± 0.13
pnpr@main 1.527 ± 0.142 1.354 1.752 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4319811011200003,
      "stddev": 0.1301004822255659,
      "median": 2.39278903872,
      "user": 1.4793047199999996,
      "system": 1.29467402,
      "min": 2.32876251872,
      "max": 2.73455404272,
      "times": [
        2.35463213172,
        2.43423813672,
        2.33803386772,
        2.32876251872,
        2.43727532172,
        2.57286102172,
        2.33933557772,
        2.43094594572,
        2.34917244672,
        2.73455404272
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.48966967502,
      "stddev": 0.1452108388058452,
      "median": 2.4362125397199996,
      "user": 1.47064612,
      "system": 1.26524982,
      "min": 2.33619098172,
      "max": 2.71330777272,
      "times": [
        2.67209220972,
        2.37132628072,
        2.35922399272,
        2.38223763772,
        2.33619098172,
        2.49018744172,
        2.37384186472,
        2.5605476997200003,
        2.71330777272,
        2.63774086872
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5881589445200002,
      "stddev": 0.12340784482866306,
      "median": 1.61306159022,
      "user": 1.0240498199999999,
      "system": 1.14504152,
      "min": 1.33909026572,
      "max": 1.73278846872,
      "times": [
        1.46493930172,
        1.62516007572,
        1.51090487572,
        1.70313203572,
        1.73278846872,
        1.5467721867200002,
        1.60096310472,
        1.68220603372,
        1.67563309672,
        1.33909026572
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5268561411200001,
      "stddev": 0.14212610344486123,
      "median": 1.5148188442200001,
      "user": 1.02440602,
      "system": 1.1550183200000002,
      "min": 1.35351133772,
      "max": 1.75235528772,
      "times": [
        1.49261375072,
        1.38587941472,
        1.5842319117199999,
        1.7411387017200002,
        1.49468170372,
        1.75235528772,
        1.5689779697200001,
        1.53495598472,
        1.35351133772,
        1.36021534872
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 240.8 ± 7.1 230.0 253.3 1.00
pacquet@main 252.2 ± 5.8 245.1 262.0 1.05 ± 0.04
pnpr@HEAD 256.8 ± 6.6 245.5 268.5 1.07 ± 0.04
pnpr@main 263.3 ± 5.5 257.7 273.9 1.09 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24078984392000002,
      "stddev": 0.0071266455991570235,
      "median": 0.24119406552,
      "user": 0.18739270000000002,
      "system": 0.5045355999999999,
      "min": 0.22995114452,
      "max": 0.25331504052,
      "times": [
        0.23308519652,
        0.22995114452,
        0.23961567352000002,
        0.24405856752,
        0.24783611652,
        0.25331504052,
        0.23501250752,
        0.24277245752,
        0.23765205352000002,
        0.24459968152
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25216900452,
      "stddev": 0.005786501176277361,
      "median": 0.24959130452,
      "user": 0.1956389,
      "system": 0.5347818,
      "min": 0.24509453852000002,
      "max": 0.26199286952,
      "times": [
        0.24826631052,
        0.24919636452000002,
        0.24509453852000002,
        0.25592101352,
        0.24769124452,
        0.25358296252,
        0.26106372852,
        0.24889476852,
        0.26199286952,
        0.24998624452
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25680221792,
      "stddev": 0.006580534414856833,
      "median": 0.25752509402,
      "user": 0.20820719999999998,
      "system": 0.5106784,
      "min": 0.24548614252,
      "max": 0.26854084952,
      "times": [
        0.26225137552,
        0.25091836052,
        0.25574571552,
        0.25308995852,
        0.24548614252,
        0.25266416152,
        0.25941902852,
        0.25930447252,
        0.26060211452,
        0.26854084952
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26331730391999997,
      "stddev": 0.00548789049900175,
      "median": 0.26153159102,
      "user": 0.20303849999999998,
      "system": 0.5414608,
      "min": 0.25768262452,
      "max": 0.27391954752000003,
      "times": [
        0.25777111952,
        0.26975509452,
        0.26215350152,
        0.26090968052,
        0.27391954752000003,
        0.26296289752,
        0.26817688752,
        0.26052327652,
        0.25931840952,
        0.25768262452
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.680 ± 0.023 2.627 2.710 1.78 ± 0.15
pacquet@main 2.699 ± 0.011 2.688 2.719 1.79 ± 0.15
pnpr@HEAD 1.572 ± 0.149 1.380 1.794 1.04 ± 0.13
pnpr@main 1.508 ± 0.129 1.363 1.756 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6795393653200006,
      "stddev": 0.0232849799923347,
      "median": 2.6837832287200003,
      "user": 1.5604494399999997,
      "system": 1.2658025199999998,
      "min": 2.62671418772,
      "max": 2.70995610072,
      "times": [
        2.66464742072,
        2.69395415272,
        2.6807452407200003,
        2.69755212572,
        2.6868212167200003,
        2.67980561872,
        2.69078852172,
        2.62671418772,
        2.70995610072,
        2.6644090677200003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.69946567762,
      "stddev": 0.011185743383169137,
      "median": 2.69607736672,
      "user": 1.58573144,
      "system": 1.2653804199999998,
      "min": 2.68786532372,
      "max": 2.71930645372,
      "times": [
        2.71213188772,
        2.68786532372,
        2.68901636972,
        2.69468626472,
        2.71930645372,
        2.69138677272,
        2.7040670547200003,
        2.70973106972,
        2.69746846872,
        2.68899711072
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5719290524200003,
      "stddev": 0.14851597108666087,
      "median": 1.5673965012200002,
      "user": 0.95463184,
      "system": 1.1182305199999998,
      "min": 1.3803638337200002,
      "max": 1.79378901772,
      "times": [
        1.3803638337200002,
        1.40094331872,
        1.4988978397200001,
        1.62690874372,
        1.54835837472,
        1.74735899972,
        1.79378901772,
        1.42075656772,
        1.58643462772,
        1.71547920072
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.50806093322,
      "stddev": 0.12871046783668902,
      "median": 1.4619470102199998,
      "user": 0.9444600399999998,
      "system": 1.07826582,
      "min": 1.36343233572,
      "max": 1.75636031872,
      "times": [
        1.43885337972,
        1.36343233572,
        1.47068135272,
        1.6425980337200001,
        1.4069984557200002,
        1.59447733872,
        1.37795052072,
        1.57604492872,
        1.45321266772,
        1.75636031872
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 536.7 ± 9.4 522.9 548.5 1.91 ± 0.07
pacquet@main 526.8 ± 10.6 514.6 545.2 1.88 ± 0.07
pnpr@HEAD 280.4 ± 8.3 270.6 296.5 1.00
pnpr@main 286.3 ± 6.7 275.2 297.2 1.02 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5367072911799999,
      "stddev": 0.009418263149161278,
      "median": 0.5367603439799999,
      "user": 0.6565381599999999,
      "system": 0.65357898,
      "min": 0.52294422348,
      "max": 0.54853697248,
      "times": [
        0.53638300648,
        0.52294422348,
        0.5444457754800001,
        0.54319921848,
        0.54853697248,
        0.53713768148,
        0.54778975148,
        0.52325007648,
        0.52919827248,
        0.53418793348
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5267659690800001,
      "stddev": 0.010586082996906446,
      "median": 0.52419138248,
      "user": 0.6459739599999998,
      "system": 0.6387527800000001,
      "min": 0.51460565448,
      "max": 0.54521051048,
      "times": [
        0.51460565448,
        0.52349789348,
        0.53273220348,
        0.51759500548,
        0.51685262348,
        0.52488487148,
        0.54521051048,
        0.53789460548,
        0.5181348864800001,
        0.53625143648
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28040137338000004,
      "stddev": 0.00825990663487563,
      "median": 0.27973051798,
      "user": 0.17867035999999997,
      "system": 0.47980017999999997,
      "min": 0.27060522648,
      "max": 0.29652843248,
      "times": [
        0.27985514648,
        0.29652843248,
        0.27960588948,
        0.27060522648,
        0.27154414548,
        0.29093629548,
        0.27643150248,
        0.28149085048,
        0.28317214048,
        0.27384410448
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.28625255918,
      "stddev": 0.006681253935243346,
      "median": 0.28725110348,
      "user": 0.17095156,
      "system": 0.51611688,
      "min": 0.27517303548,
      "max": 0.29721496848,
      "times": [
        0.28076427948,
        0.29024808548,
        0.27517303548,
        0.29309065248,
        0.28225808648,
        0.28704681348,
        0.28745539348,
        0.28001520548,
        0.29721496848,
        0.28925907147999996
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.830 ± 0.010 1.809 1.843 6.60 ± 0.14
pacquet@main 1.824 ± 0.009 1.811 1.836 6.58 ± 0.14
pnpr@HEAD 0.289 ± 0.006 0.284 0.300 1.04 ± 0.03
pnpr@main 0.277 ± 0.006 0.266 0.285 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8300382943000002,
      "stddev": 0.010183927975354485,
      "median": 1.8316401129000002,
      "user": 0.8455948,
      "system": 0.7368966399999999,
      "min": 1.8093264759,
      "max": 1.8432722199000002,
      "times": [
        1.8432722199000002,
        1.8308493069000003,
        1.8315948529000001,
        1.8291605839000002,
        1.8316853729,
        1.8093264759,
        1.8161127479,
        1.8389123219,
        1.8330092829,
        1.8364597779
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8241747400000001,
      "stddev": 0.008741125237290417,
      "median": 1.8263433869,
      "user": 0.8565058999999998,
      "system": 0.70147414,
      "min": 1.8114135349000002,
      "max": 1.8363641579,
      "times": [
        1.8196710149,
        1.8115755789,
        1.8363641579,
        1.8300930199,
        1.8299201059,
        1.8255877759,
        1.8326676129000001,
        1.8114135349000002,
        1.8270989979,
        1.8173556009
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28899862239999996,
      "stddev": 0.005621560058750054,
      "median": 0.2872967784,
      "user": 0.18716139999999998,
      "system": 0.5145288399999999,
      "min": 0.2837061039,
      "max": 0.2995081069,
      "times": [
        0.2895480719,
        0.2837061039,
        0.2995081069,
        0.2952777889,
        0.2897094549,
        0.2840541269,
        0.2848133189,
        0.2842589809,
        0.2940647859,
        0.2850454849
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27722453770000005,
      "stddev": 0.005642554427699113,
      "median": 0.2778123899,
      "user": 0.15923190000000004,
      "system": 0.5177737399999999,
      "min": 0.2656671409,
      "max": 0.2850210689,
      "times": [
        0.2656671409,
        0.2734396959,
        0.2808830949,
        0.2850210689,
        0.2836934109,
        0.2740313059,
        0.27744908890000003,
        0.2793214179,
        0.2745634619,
        0.2781756909
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 319.9 ± 6.3 306.0 327.9 4.11 ± 0.12
pacquet@main 317.6 ± 3.5 311.9 322.6 4.08 ± 0.10
pnpr@HEAD 82.7 ± 1.1 81.1 85.7 1.06 ± 0.03
pnpr@main 77.8 ± 1.7 75.2 83.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.31988964042,
      "stddev": 0.006330412382393754,
      "median": 0.32093843182000004,
      "user": 0.31290832,
      "system": 0.05550102,
      "min": 0.30599210932000004,
      "max": 0.32794387432000005,
      "times": [
        0.32445598832000005,
        0.31551085532,
        0.32029457032,
        0.32794387432000005,
        0.30599210932000004,
        0.32412873532,
        0.31930033732,
        0.32158229332000005,
        0.31530073232000005,
        0.32438690832000006
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.31763142362,
      "stddev": 0.003496678094541607,
      "median": 0.31724865732000007,
      "user": 0.30894401999999993,
      "system": 0.053508219999999995,
      "min": 0.31189945832000004,
      "max": 0.32255502632000005,
      "times": [
        0.31511716732000006,
        0.32072691032000006,
        0.31600336832000003,
        0.31789594532000004,
        0.31189945832000004,
        0.32211988132,
        0.31660136932000005,
        0.31431344232,
        0.31908166732000004,
        0.32255502632000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08269227092606059,
      "stddev": 0.0011095122932158622,
      "median": 0.08253157132,
      "user": 0.020528883636363637,
      "system": 0.007220259999999999,
      "min": 0.08108183532,
      "max": 0.08571686032,
      "times": [
        0.08569632332,
        0.08179589332000001,
        0.08348816432,
        0.08571686032,
        0.08309844332,
        0.08226134532,
        0.08253157132,
        0.08214703132000001,
        0.08147569232,
        0.08303104732,
        0.08252473932,
        0.08189351532,
        0.08336491332,
        0.08108183532,
        0.08280905132000001,
        0.08153925332,
        0.08261525832,
        0.08225578432,
        0.08273938132,
        0.08167704032,
        0.08257131632,
        0.08234423032,
        0.08200549532,
        0.08252063132,
        0.08212731432,
        0.08406269032000001,
        0.08495310832,
        0.08269387532,
        0.08190397532,
        0.08288814032,
        0.08114137732,
        0.08315923732,
        0.08273040432
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.07779996374857144,
      "stddev": 0.001676938670651555,
      "median": 0.07732025632,
      "user": 0.015264548571428569,
      "system": 0.007380990285714285,
      "min": 0.07518252032,
      "max": 0.08372375532,
      "times": [
        0.08177349132,
        0.07518252032,
        0.07940952132,
        0.07518490432,
        0.07829584432,
        0.07676955432,
        0.07764462332000001,
        0.07791084232,
        0.07716892232,
        0.07683979532,
        0.07754592932,
        0.07674212332000001,
        0.07763028732,
        0.07672516032,
        0.07839841632,
        0.07783703532,
        0.08372375532,
        0.08000430532,
        0.07883664832000001,
        0.08076285732,
        0.07674709132,
        0.07675211132,
        0.07820580532,
        0.07671511232,
        0.07705435732,
        0.07840771432,
        0.07656180432,
        0.07719665432,
        0.07746011832000001,
        0.07728735332,
        0.07732025632,
        0.07725415232,
        0.07705503832,
        0.07737118032,
        0.07722344432
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.529 ± 0.147 4.422 4.803 1.28 ± 0.05
pacquet@main 4.505 ± 0.135 4.415 4.864 1.27 ± 0.05
pnpr@HEAD 3.569 ± 0.139 3.451 3.830 1.01 ± 0.05
pnpr@main 3.536 ± 0.097 3.436 3.698 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.52879389172,
      "stddev": 0.14673860227399294,
      "median": 4.45415987492,
      "user": 1.6487722599999999,
      "system": 1.36272412,
      "min": 4.42154779192,
      "max": 4.8025724609200005,
      "times": [
        4.43485872592,
        4.42540628292,
        4.43128917692,
        4.46780263992,
        4.75219078992,
        4.8025724609200005,
        4.46611259392,
        4.44220715592,
        4.64395129892,
        4.42154779192
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.50487562082,
      "stddev": 0.13450255198307323,
      "median": 4.4627161184199995,
      "user": 1.62066296,
      "system": 1.40636992,
      "min": 4.41512864292,
      "max": 4.86402331592,
      "times": [
        4.48136480492,
        4.52632036792,
        4.44406743192,
        4.42083784192,
        4.41512864292,
        4.86402331592,
        4.54921100292,
        4.49125324492,
        4.43594445992,
        4.42060509492
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.56889778432,
      "stddev": 0.13902608123774535,
      "median": 3.5011881009200003,
      "user": 1.1477689599999998,
      "system": 1.2305019200000002,
      "min": 3.4506069269200004,
      "max": 3.83015626292,
      "times": [
        3.83015626292,
        3.45478074892,
        3.5788968419200002,
        3.4807398429200003,
        3.6436964459200003,
        3.78160641992,
        3.4506069269200004,
        3.49027064892,
        3.4661181519200004,
        3.5121055529200005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5364666997200005,
      "stddev": 0.09681047043414098,
      "median": 3.5020392684200004,
      "user": 1.1489490599999999,
      "system": 1.2459442200000002,
      "min": 3.4363706619200003,
      "max": 3.6978997269200002,
      "times": [
        3.6230287499200005,
        3.5373452269200003,
        3.46353332892,
        3.58001730492,
        3.65578334492,
        3.44236324992,
        3.4363706619200003,
        3.6978997269200002,
        3.4667333099200004,
        3.46159209292
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13030
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,861.99 ms
(-3.21%)Baseline: 2,956.77 ms
3,548.13 ms
(80.66%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,879.77 ms
(-11.02%)Baseline: 2,112.50 ms
2,534.99 ms
(74.15%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
594.73 ms
(-20.21%)Baseline: 745.35 ms
894.42 ms
(66.49%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
326.09 ms
(-27.14%)Baseline: 447.53 ms
537.04 ms
(60.72%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,564.93 ms
(-4.96%)Baseline: 2,698.73 ms
3,238.48 ms
(79.20%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,485.94 ms
(-6.43%)Baseline: 4,794.33 ms
5,753.19 ms
(77.97%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
277.36 ms
(-8.20%)Baseline: 302.14 ms
362.57 ms
(76.50%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13030
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,609.82 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
301.08 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
306.27 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
86.32 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,563.16 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,534.35 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
332.94 ms
🐰 View full continuous benchmarking report in Bencher

@YESHYUNGSEOK
YESHYUNGSEOK force-pushed the fix/pacquet-install-filters branch 2 times, most recently from 7212a3c to eebbf7d Compare July 16, 2026 00:04
@codecov-commenter

codecov-commenter commented Jul 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.19745% with 245 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.66%. Comparing base (2bc4dd5) to head (e0e361c).

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/install.rs 82.47% 41 Missing ⚠️
pnpm/crates/package-manager/src/install.rs 93.90% 35 Missing ⚠️
pnpm/crates/cli/src/cli_args/update_interactive.rs 50.00% 33 Missing ⚠️
pnpm/crates/package-manager/src/update.rs 92.99% 32 Missing ⚠️
pnpm/crates/cli/src/cli_args/pipelines.rs 82.53% 29 Missing ⚠️
...tes/package-manager/src/install_frozen_lockfile.rs 58.62% 24 Missing ⚠️
pnpm/crates/cli/src/cli_args/update.rs 77.61% 15 Missing ⚠️
pnpm/crates/cli/src/cli_args/sbom.rs 86.74% 11 Missing ⚠️
pnpr/crates/pnpr/src/resolver/resolve.rs 77.14% 8 Missing ⚠️
...package-manager/src/install_with_fresh_lockfile.rs 96.68% 7 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13030      +/-   ##
==========================================
+ Coverage   85.33%   85.66%   +0.32%     
==========================================
  Files         505      505              
  Lines       81225    83555    +2330     
==========================================
+ Hits        69315    71574    +2259     
- Misses      11910    11981      +71     

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

@YESHYUNGSEOK
YESHYUNGSEOK force-pushed the fix/pacquet-install-filters branch from f1e91b7 to d334093 Compare July 16, 2026 00:45
@YESHYUNGSEOK
YESHYUNGSEOK marked this pull request as ready for review July 16, 2026 01:34
@YESHYUNGSEOK
YESHYUNGSEOK requested a review from zkochan as a code owner July 16, 2026 01:34
@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 →

@greptile-apps

greptile-apps Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The core merge logic is well-reasoned and the change is safe to merge pending the stacked prerequisite PR.

No logic bugs or behavioral regressions were found after tracing the merge paths, lockfile reachability walk, freshness-check inputs, and pnpr containment check.

No files require special attention.

Reviews (8): Last reviewed commit: "test(pacquet): cover dependency-free imp..." | 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: 15

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pnpm/crates/cli/src/cli_args/fetch.rs (1)

18-35: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Thread workspace selection through fetch.
dispatch_install::fetch still calls FetchArgs::run() directly, so recursive --filter selection never reaches fetch. A filtered fetch can therefore prefetch the whole shared lockfile instead of the selected closure; route selection through dispatch and use the selected path when present.

🤖 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 `@pnpm/crates/cli/src/cli_args/fetch.rs` around lines 18 - 35, Update
dispatch_install::fetch to resolve workspace selection through the dispatch path
before invoking FetchArgs::run, rather than calling it directly. Thread the
selected path into FetchArgs::run and use it when present so recursive --filter
fetches operate only on the selected dependency closure while preserving the
existing behavior when no selection is provided.

Sources: Coding guidelines, Path instructions

🧹 Nitpick comments (2)
pnpm/crates/cli/src/cli_args/sbom.rs (1)

391-396: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid unnecessary path cloning or Cow boilerplate when reading manifests.

All three locations manually manage a temporary path allocation (via Cow or .clone()) just to pass a reference to safe_read_package_json_from_dir. Because the function accepts &Path and does not retain the reference, you can inline the path construction directly and avoid intermediate variables. As per the CODE_STYLE_GUIDE.md, prefer owned/borrowed parameter choices to avoid extra copying.

  • pnpm/crates/cli/src/cli_args/sbom.rs#L391-L396: Inline the lockfile_dir.join(...) call and remove the Cow wrapping.
  • pnpm/crates/cli/src/cli_args/sbom.rs#L468-L477: Inline the lockfile_dir.join(...) call to avoid the explicit lockfile_dir.clone().
  • pnpm/crates/cli/src/cli_args/sbom.rs#L518-L523: Inline the lockfile_dir.join(...) call to avoid the explicit lockfile_dir.clone().
♻️ Proposed refactors

For pnpm/crates/cli/src/cli_args/sbom.rs#L391-L396:

-            let importer_dir: Cow<'_, Path> = if single_id == "." {
-                Cow::Borrowed(&lockfile_dir)
-            } else {
-                Cow::Owned(lockfile_dir.join(single_id))
-            };
-            safe_read_package_json_from_dir(&importer_dir).ok().flatten().unwrap_or_else(|| {
+            let manifest = if single_id == "." {
+                safe_read_package_json_from_dir(&lockfile_dir)
+            } else {
+                safe_read_package_json_from_dir(&lockfile_dir.join(single_id))
+            };
+            manifest.ok().flatten().unwrap_or_else(|| {

For pnpm/crates/cli/src/cli_args/sbom.rs#L468-L477:

-            let importer_dir = if importer_id == "." {
-                lockfile_dir.clone()
-            } else {
-                lockfile_dir.join(&importer_id)
-            };
-            safe_read_package_json_from_dir(&importer_dir)
-                .ok()
-                .flatten()
-                .map(|m| peer_names_from_manifest(&m))
-                .unwrap_or_default()
+            let manifest = if importer_id == "." {
+                safe_read_package_json_from_dir(&lockfile_dir)
+            } else {
+                safe_read_package_json_from_dir(&lockfile_dir.join(&importer_id))
+            };
+            manifest.ok().flatten().map(|m| peer_names_from_manifest(&m)).unwrap_or_default()

For pnpm/crates/cli/src/cli_args/sbom.rs#L518-L523:

-                        let ws_dir = if target_id == "." {
-                            lockfile_dir.clone()
-                        } else {
-                            lockfile_dir.join(&target_id)
-                        };
-                        if let Ok(Some(ws_manifest)) = safe_read_package_json_from_dir(&ws_dir) {
+                        let manifest = if target_id == "." {
+                            safe_read_package_json_from_dir(&lockfile_dir)
+                        } else {
+                            safe_read_package_json_from_dir(&lockfile_dir.join(&target_id))
+                        };
+                        if let Ok(Some(ws_manifest)) = manifest {
🤖 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 `@pnpm/crates/cli/src/cli_args/sbom.rs` around lines 391 - 396, In
pnpm/crates/cli/src/cli_args/sbom.rs at lines 391-396, update the
manifest-reading flow around safe_read_package_json_from_dir to inline the
borrowed lockfile_dir or joined path and remove the temporary Cow. Apply the
same inline path construction at lines 468-477 and 518-523, eliminating the
explicit lockfile_dir.clone() while preserving the existing path-selection
behavior.

Source: Path instructions

pnpm/crates/pnpr-client/tests/integration.rs (1)

132-161: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid full-buffer UTF-8 conversion when scanning for header boundaries.

Searching for the \r\n\r\n boundary by first converting the entire buffer to a lossy string exposes the code to potential byte-index desyncs. If a network stream contained invalid UTF-8 bytes in the payload, from_utf8_lossy would insert multi-byte replacement characters (U+FFFD), shifting the string indices. This would cause the matched headers_end index to misalign with the underlying raw buffer length check.

Since this is a test utility and HTTP headers are ASCII, you can safely and efficiently search directly on the raw bytes instead.

♻️ Proposed refactor
-        let text = String::from_utf8_lossy(&buffer);
-        if let Some(headers_end) = text.find("\r\n\r\n") {
-            let content_length = text[..headers_end]
+        if let Some(headers_end) = buffer.windows(4).position(|window| window == b"\r\n\r\n") {
+            let headers = String::from_utf8_lossy(&buffer[..headers_end]);
+            let content_length = headers
                 .lines()
                 .find_map(|line| {
                     let (name, value) = line.split_once(':')?;
🤖 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 `@pnpm/crates/pnpr-client/tests/integration.rs` around lines 132 - 161, Update
capture_one_request_with_response to locate the \r\n\r\n header boundary
directly in the raw buffer bytes instead of converting the full buffer with
String::from_utf8_lossy. Keep Content-Length parsing limited to the ASCII header
portion and preserve the existing body-completion condition using byte offsets
aligned with buffer.
🤖 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 `@pnpm/crates/cli/src/cli_args/add.rs`:
- Around line 192-242: Update run_selected to handle self.config before
constructing or invoking the selected-project Add flow, matching run’s existing
add_config_dependency behavior. Ensure filtered and recursive add --config
commands update the workspace configuration dependency instead of performing a
normal project add, while preserving the current path for non-config requests.

In `@pnpm/crates/cli/src/cli_args/install.rs`:
- Around line 1023-1053: Update resolve_projects_for_pnpr and its CLI dispatch
callers so a filtered InstallFamilySelection resolves only the selected projects
or their required workspace closure, rather than every selection.projects entry.
Preserve full workspace identity metadata separately for the later lockfile
merge, and propagate the selection through dispatch without dropping it;
unfiltered requests should retain the existing workspace resolution behavior.

In `@pnpm/crates/cli/src/cli_args/pipelines.rs`:
- Around line 43-47: Replace the ad-hoc miette! diagnostic in the recursive
install validation with the corresponding user-facing diagnostic type from
pacquet-diagnostics. Define the diagnostic there using code
ERR_PNPM_RECURSIVE_SHARED_LOCKFILE_UNSUPPORTED and the existing canonical
message, then return that type from the relevant CLI argument validation path
while preserving the current unsupported-condition check.

In `@pnpm/crates/cli/src/cli_args/update_interactive.rs`:
- Around line 61-65: Normalize each project’s root path before checking
membership in selection.selected_dirs within the interactive update project
filtering flow. Reuse the same path-normalization approach as the sibling
install path so equivalent relative, absolute, or Windows-form paths are matched
while preserving the existing filter and mapping behavior.

In `@pnpm/crates/package-manager/src/current_lockfile.rs`:
- Around line 153-160: Update the freshly_resolved package and snapshot
assignment around overlay_package_maps so previous lockfile entries are overlaid
only when can_reuse_unselected_importers is true. When global inputs changed and
reuse is false, use fresh_packages and fresh_snapshots directly, preventing
stale graph data from being restored alongside new resolutions.

In `@pnpm/crates/package-manager/src/install_frozen_lockfile.rs`:
- Around line 1654-1659: Update link_selected_hoisted_direct_dependencies and
its call sites to honor the relocated modules directory represented by
symlink_workspace_root/config.modules_dir instead of deriving
project_dir/node_modules. Ensure selected dependency and binary links use that
resolved modules path for both referenced locations.

In `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Around line 1651-1657: The hoisted filtered-install flow must retain only the
selected importer dependency closure instead of promoting every lockfile
importer to a root. In
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs:1651-1657, derive
initial_materialization_ids from selected_importer_ids for hoisted installs
while preserving unselected on-disk entries separately; in
pnpm/crates/cli/src/cli_args/install.rs:743-755, make pnpr prefetch use that
same selected closure rather than all lockfile importers.

In `@pnpm/crates/package-manager/src/install.rs`:
- Around line 1236-1238: Update the previous_modules_metadata initialization in
the filtered_install and !resolve_only branch to propagate errors from
pacquet_modules_yaml::read_modules_manifest::<Host> instead of converting them
to None with ok().flatten(). Preserve the absent-manifest case as None while
returning the deserialization error so filtered installs cannot overwrite
unselected metadata.
- Around line 2619-2629: The merge logic around previous.injected_deps must
preserve injected dependency targets per importer rather than deciding retention
solely by source membership. Update the loop to compare and retain only
unaffected target paths for each source, merging them into next.injected_deps
alongside selected targets; do not drop an entire source when selected and
unselected importers share it.

In `@pnpm/crates/package-manager/src/optimistic_repeat_install.rs`:
- Line 291: Update check_optimistic_repeat_install so it does not take the fast
path when the loaded state has state.filtered_install set; preserve the prior
filtered-install marker instead of reclassifying it as a full install at the
false assignment near this branch. If retaining the fast path, fully verify
every importer before writing false.

In `@pnpm/crates/package-manager/src/prune_direct_deps.rs`:
- Around line 70-73: Update the documentation for the pruning contract around
new_included to explicitly state that links present in the current lockfile are
removed when their dependency groups are no longer included. Preserve the
constraint that, when trusted_importer_ids is set, only links belonging to those
importers are eligible for removal.

In `@pnpm/crates/package-manager/src/remove.rs`:
- Around line 238-264: Update prepare_selected_manifests and prepare_manifest to
detect whether any requested package was actually removed, and retain only
matching project indices. Emit manifest events and invoke
persist_selected_manifests only for those indices, leaving untouched projects
unreported and unchanged. Extend the existing “ignores projects” test through
persistence to verify no-op manifests are not persisted or reported.

In `@pnpm/crates/pnpr-client/src/lib.rs`:
- Around line 403-409: Update resolve_projects_streaming to capture the
permitted importer set before constructing the request, combining the requested
workspace projects with importers already present in the input lockfile. When
handling the terminal done frame, validate that every requested importer exists
and no importer outside this permitted set is present; reject the response with
the existing client error path when validation fails.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs`:
- Around line 83-106: Normalize project_dir with pacquet_fs::lexical_normalize
before passing it as the base to pathdiff::diff_paths in
importer_relative_link_dep_path. Preserve the existing target normalization and
link formatting, and add a regression test covering a lexically non-normalized
importer root that verifies the resulting link target.

In `@pnpr/crates/pnpr/src/resolver/resolve.rs`:
- Around line 285-303: Update sanitized_importer_dir and the importer-directory
handling in resolve.rs to deduplicate directories using a host-aware canonical
or collision key, so aliases such as packages/Foo and packages/foo cannot
produce separate writes on case-insensitive filesystems. Preserve rejection of
unsafe components and add regression coverage for Windows-equivalent path
aliases, verifying only one project dependency map is written.

---

Outside diff comments:
In `@pnpm/crates/cli/src/cli_args/fetch.rs`:
- Around line 18-35: Update dispatch_install::fetch to resolve workspace
selection through the dispatch path before invoking FetchArgs::run, rather than
calling it directly. Thread the selected path into FetchArgs::run and use it
when present so recursive --filter fetches operate only on the selected
dependency closure while preserving the existing behavior when no selection is
provided.

---

Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/sbom.rs`:
- Around line 391-396: In pnpm/crates/cli/src/cli_args/sbom.rs at lines 391-396,
update the manifest-reading flow around safe_read_package_json_from_dir to
inline the borrowed lockfile_dir or joined path and remove the temporary Cow.
Apply the same inline path construction at lines 468-477 and 518-523,
eliminating the explicit lockfile_dir.clone() while preserving the existing
path-selection behavior.

In `@pnpm/crates/pnpr-client/tests/integration.rs`:
- Around line 132-161: Update capture_one_request_with_response to locate the
\r\n\r\n header boundary directly in the raw buffer bytes instead of converting
the full buffer with String::from_utf8_lossy. Keep Content-Length parsing
limited to the ASCII header portion and preserve the existing body-completion
condition using byte offsets aligned with buffer.
🪄 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: 6c1475ee-17b2-4f9e-8d9d-9f2b2b660e57

📥 Commits

Reviewing files that changed from the base of the PR and between 566864e and d334093.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (71)
  • .changeset/pacquet-install-filters.md
  • .changeset/pnpr-workspace-identity.md
  • pnpm/crates/cli/src/cli_args/add.rs
  • pnpm/crates/cli/src/cli_args/audit.rs
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/cli/src/cli_args/dispatch_install.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/fetch.rs
  • pnpm/crates/cli/src/cli_args/import.rs
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/cli/src/cli_args/link.rs
  • pnpm/crates/cli/src/cli_args/outdated.rs
  • pnpm/crates/cli/src/cli_args/outdated/tests.rs
  • pnpm/crates/cli/src/cli_args/pipelines.rs
  • pnpm/crates/cli/src/cli_args/prune.rs
  • pnpm/crates/cli/src/cli_args/rebuild.rs
  • pnpm/crates/cli/src/cli_args/remove.rs
  • pnpm/crates/cli/src/cli_args/sbom.rs
  • pnpm/crates/cli/src/cli_args/unlink.rs
  • pnpm/crates/cli/src/cli_args/update.rs
  • pnpm/crates/cli/src/cli_args/update_interactive.rs
  • pnpm/crates/cli/src/cli_args/update_interactive/tests.rs
  • pnpm/crates/cli/src/cli_args/why.rs
  • pnpm/crates/cli/src/state.rs
  • pnpm/crates/cli/src/state/tests.rs
  • pnpm/crates/cli/tests/deploy.rs
  • pnpm/crates/cli/tests/global.rs
  • pnpm/crates/cli/tests/install_filters.rs
  • pnpm/crates/cli/tests/outdated.rs
  • pnpm/crates/cli/tests/pnpr_install.rs
  • pnpm/crates/cli/tests/prune.rs
  • pnpm/crates/cli/tests/sbom.rs
  • pnpm/crates/cli/tests/why.rs
  • pnpm/crates/lockfile-preferred-versions/src/lib.rs
  • pnpm/crates/lockfile-preferred-versions/src/tests.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/current_lockfile.rs
  • pnpm/crates/package-manager/src/current_lockfile/tests.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm/crates/package-manager/src/install_frozen_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/tests.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install.rs
  • pnpm/crates/package-manager/src/prune_direct_deps.rs
  • pnpm/crates/package-manager/src/prune_direct_deps/tests.rs
  • pnpm/crates/package-manager/src/remove.rs
  • pnpm/crates/package-manager/src/remove/tests.rs
  • pnpm/crates/package-manager/src/update.rs
  • pnpm/crates/package-manager/src/update/tests.rs
  • pnpm/crates/pnpr-client/src/lib.rs
  • pnpm/crates/pnpr-client/tests/integration.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts
  • pnpr/client/package.json
  • pnpr/client/src/resolveViaPnprServer.ts
  • pnpr/client/test/resolveViaPnprServer.test.ts
  • pnpr/crates/pnpr/src/resolver.rs
  • pnpr/crates/pnpr/src/resolver/protocol.rs
  • pnpr/crates/pnpr/src/resolver/resolve.rs
  • pnpr/crates/pnpr/src/resolver/resolve/tests.rs
  • pnpr/crates/pnpr/src/resolver/tests.rs

Comment thread pnpm/crates/cli/src/cli_args/add.rs Resolved
Comment thread pnpm/crates/cli/src/cli_args/install.rs Resolved
Comment thread pnpm/crates/pnpr-client/src/lib.rs Resolved
@qodo-code-review

qodo-code-review Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. sbom importer dir symlink escape ✓ Resolved 📘 Rule violation ≡ Correctness
Description
sbom reads <lockfile_dir>/<importer_id>/package.json after validate_importer_id(), but this
only rejects lexical traversal (e.g. ..) and does not prevent a workspace-controlled symlink
importer directory from resolving outside the workspace and being read. pnpm’s TypeScript SBOM
implementation realpaths and rejects out-of-root importer directories, so pacquet can diverge from
pnpm and perform unintended on-disk reads for the same lockfile/workspace layout.
Code

pnpm/crates/cli/src/cli_args/sbom.rs[R391-396]

+            // `single_id` is a raw lockfile importer key; validate it before
+            // it turns into an on-disk path so a crafted `../foo` or absolute
+            // key cannot read a `package.json` outside the workspace.
+            let manifest = validate_importer_id(single_id).ok().and_then(|()| {
+                safe_read_package_json_from_dir(&importer_root_dir(&lockfile_dir, single_id))
+                    .ok()
Evidence
In pacquet, sbom validates the importer ID but then directly reads package.json from
importer_root_dir(lockfile_dir, importer_id), which will follow symlinks and can resolve outside
the workspace. In pnpm’s TypeScript SBOM, importer directories are realpath()’d and rejected if
their resolved path is outside lockfileDir, preventing the same escape.

Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/cli/src/cli_args/sbom.rs[391-396]
pnpm/crates/cli/src/cli_args/sbom.rs[470-472]
pnpm11/deps/compliance/commands/src/sbom/sbom.ts[359-376]

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

## Issue description
Pacquet `sbom` treats lockfile importer keys as untrusted and calls `validate_importer_id()`, but still turns the importer ID into an on-disk path without a realpath/canonicalization boundary check. A repo can place a symlinked importer directory under the lockfile dir that resolves outside the workspace, causing `safe_read_package_json_from_dir()` to read `package.json` outside the project root.

## Issue Context
pnpm’s TypeScript SBOM code uses `realpath()` + `path.relative()` to ensure importer directories resolve within `lockfileDir` before reading manifests. To keep pacquet behavior aligned (and avoid unintended file reads), pacquet should apply the same “resolved path stays under lockfile dir” check anywhere it reads manifests keyed by lockfile importer IDs.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/sbom.rs[391-399]
- pnpm/crates/cli/src/cli_args/sbom.rs[470-472]

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


2. Pnpr deps unvalidated ✗ Dismissed 🐞 Bug ⛨ Security
Description
PnprClient::resolve_projects_streaming treats the pnpr response as untrusted but only validates
that returned importer IDs are in an allowed set, not that each requested importer’s
direct-dependency declarations match the request. A compromised pnpr server can therefore add or
alter direct deps (including link:/file: forms) for a permitted importer and the CLI will treat
the returned lockfile as trusted and materialize it.
Code

pnpm/crates/pnpr-client/src/lib.rs[R408-426]

+        // The server's response is untrusted, and the caller merges the
+        // returned lockfile into `pnpm-lock.yaml`. Constrain it to the
+        // importers this request is about — the requested projects plus
+        // whatever the input lockfile already carried — so a hostile server
+        // cannot introduce dependencies for a project that was never sent.
+        // Only containment is checked, not presence: pnpm omits
+        // dependency-free importers, so a requested project may legitimately
+        // have no entry.
+        let permitted_importers: HashSet<String> = opts
+            .projects
+            .iter()
+            .map(|project| project.dir.clone())
+            .chain(opts.lockfile.iter().flat_map(|lockfile| lockfile.importers.keys().cloned()))
+            .collect();
        let request = serde_json::json!({
-            "projects": [{
-                "dir": ".",
-                "dependencies": opts.dependencies,
-                "devDependencies": opts.dev_dependencies,
-                "optionalDependencies": opts.optional_dependencies,
-            }],
+            "projects": opts.projects,
            "registry": opts.registry,
            "namedRegistries": opts.named_registries,
            "overrides": opts.overrides,
Evidence
The client explicitly calls the server response untrusted but only enforces importer-key containment
before returning the lockfile. Importer dependency rows carry a serialized specifier and may
legally encode link:/file: versions, and the CLI writes and then materializes the
server-produced lockfile with trust_lockfile: true (skipping local verification), so an altered
importer entry would persist and be acted on.

pnpm/crates/pnpr-client/src/lib.rs[408-504]
pnpm/crates/lockfile/src/resolved_dependency.rs[16-86]
pnpm/crates/cli/src/cli_args/install.rs[899-1010]

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

### Issue description
`resolve_projects_streaming()` only checks that the pnpr server returns *permitted importer IDs*, but it does not validate the *contents* of those importer entries. Because the CLI subsequently treats the server-produced lockfile as trusted and uses it for materialization, a compromised pnpr server can inject or alter direct dependencies for a requested importer.

### Issue Context
- The lockfile importer entries include a serialized `specifier` and a `version` that can be `link:` or `file:`.
- The request already contains authoritative per-project dependency maps (alias -> specifier). Those can be used to validate that the returned lockfile’s `importers[dir].{dependencies,devDependencies,optionalDependencies}`:
 - contains no unexpected aliases,
 - preserves the exact `specifier` strings for each alias,
 - (optionally) keeps `link:`/`file:` `version` kinds consistent with the specifier prefix.

### Fix Focus Areas
- pnpm/crates/pnpr-client/src/lib.rs[408-499]

### Suggested fix approach
1. Build an expected map per requested project (by `ResolveProject.dir`) containing the three dependency groups (alias -> specifier).
2. On `Frame::Done { lockfile, .. }`:
  - For each requested project `dir`:
    - If `lockfile.importers.get(dir)` is `None`, only allow it when the project has zero deps across all three groups (pnpm may omit dependency-free importers).
    - If present, compare each group:
      - Ensure the returned alias set is exactly the expected alias set for that group.
      - Ensure `ResolvedDependencySpec.specifier` exactly equals the expected specifier for that alias.
      - If you add a hardening check: when expected specifier is not a local/workspace form, reject returned `ImporterDepVersion::Link`/`File`.
3. If any mismatch is found, return `PnprClientError::Protocol` with a precise message (importer id, group, alias).
4. Add/extend tests in pnpm/crates/pnpr-client/tests/integration.rs to cover:
  - server returns extra alias for a permitted importer -> rejected
  - server changes `specifier` for an existing alias -> rejected
  - server swaps a registry specifier to `link:`/`file:` version while keeping specifier -> rejected (if you add the kind-consistency check)

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


3. Changeset missing pnpm entry ✗ Dismissed 📘 Rule violation § Compliance
Description
The new changeset .changeset/pacquet-install-filters.md omits the required pnpm package entry.
This violates the changeset front-matter requirements and can lead to incorrect release automation
behavior.
Code

.changeset/pacquet-install-filters.md[R1-4]

+---
+"pacquet": patch
+"@pnpm/pnpr": patch
+---
Evidence
PR Compliance ID 713436 requires each changeset to include an explicit pnpm entry with a valid
bump type; the added changeset only lists pacquet and @pnpm/pnpr.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pacquet-install-filters.md[1-4]

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 changeset `.changeset/pacquet-install-filters.md` is missing a required `pnpm` entry in its front-matter.

## Issue Context
Compliance rule requires every added/modified changeset to explicitly include `pnpm` with a valid bump type.

## Fix Focus Areas
- .changeset/pacquet-install-filters.md[1-4]

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


View more (2)
4. Pacquet rejects sharedWorkspaceLockfile=false ✗ Dismissed 📘 Rule violation ≡ Correctness
Description
Pacquet now errors for recursive/filtered install-family commands when
sharedWorkspaceLockfile=false, even though pnpm supports per-project lockfiles. This introduces a
user-visible incompatibility beyond pnpm's behavior.
Code

pnpm/crates/cli/src/cli_args/pipelines.rs[R40-48]

+    if !cfg.recursive {
+        return Ok(None);
+    }
+    if !cfg.shared_workspace_lockfile {
+        return Err(RecursiveSharedLockfileUnsupported::new(
+            "Recursive and filtered install-family commands",
+        )
+        .into());
+    }
Evidence
PR Compliance ID 713429 prohibits Pacquet-only user-visible behavior divergence. The new pipeline
explicitly errors when shared_workspace_lockfile is false, using a new diagnostic type/message;
tests assert this failure and error code, confirming the incompatibility is user-visible.

Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/cli/src/cli_args/pipelines.rs[39-48]
pnpm/crates/cli/src/cli_args/recursive.rs[45-55]
pnpm/crates/cli/tests/install_filters.rs[1274-1289]

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

## Issue description
Pacquet rejects recursive/filtered install-family commands when `sharedWorkspaceLockfile=false` by returning `ERR_PNPM_RECURSIVE_SHARED_LOCKFILE_UNSUPPORTED`.

## Issue Context
Compliance requires Pacquet not to introduce user-visible behavior beyond pnpm. pnpm supports `sharedWorkspaceLockfile=false` (per-project lockfiles), so Pacquet should either implement equivalent semantics or otherwise align behavior.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pipelines.rs[39-48]
- pnpm/crates/cli/src/cli_args/recursive.rs[45-66]
- pnpm/crates/cli/tests/install_filters.rs[1274-1291]
- pnpm/crates/cli/tests/sbom.rs[102-120]
- pnpm/crates/cli/tests/why.rs[46-67]

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


5. Missing trailing commas in params ✗ Dismissed 📘 Rule violation ⚙ Maintainability
Description
New multi-line TypeScript function/parameter lists are missing trailing commas on the last parameter
line. This violates the required trailing-comma style (PR Compliance ID 713434) and can increase
diff churn.
Code

pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts[R112-116]

+function createOptions (
+  workspaceRoot: string,
+  rootDir: ProjectRootDir,
+  overrides: Partial<MutateModulesOptions> = {}
+): MutateModulesOptions {
Evidence
PR Compliance ID 713434 mandates trailing commas for multi-line TypeScript constructs; the cited
sections show multi-line function signatures/parameter lists where the final parameter line is not
followed by a trailing comma. Specifically, the jest.fn callback signature and createOptions
signature in pnprWorkspaceMetadata.ts and the multi-line captureResolveRequest signature in
resolveViaPnprServer.test.ts all omit the required trailing comma, directly evidencing the style
violation.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts[14-16]
pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts[112-116]
pnpr/client/test/resolveViaPnprServer.test.ts[56-58]

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

## Issue description
Multi-line TypeScript function parameter lists are missing a trailing comma after the last parameter, violating PR Compliance ID 713434’s required trailing-comma style for TS multi-line constructs and increasing diff churn.

## Issue Context
Repository compliance requires trailing commas in TypeScript multi-line constructs (including function parameter lists/callback signatures) so formatting changes produce smaller, more stable diffs. Update the affected multi-line signatures to include a trailing comma after the final parameter line.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts[14-16]
- pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts[112-116]
- pnpr/client/test/resolveViaPnprServer.test.ts[56-58]

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



Remediation recommended

6. Link target normalization mismatch 🐞 Bug ⛨ Security ⭐ New
Description
build_pkg_id_with_patch_hash rewrites link: IDs by normalizing paths and rendering them with a
\\→/ substitution, so the lockfile can end up targeting a different path than the original
link: string (notably on POSIX where backslash is a valid filename character). This contradicts
the lockfile parser’s documented “link: keeps the path verbatim” invariant and can cause
subsequent materialization to link the wrong directory.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R2855-2866]

+    if let Some(target) = raw_id.strip_prefix("link:") {
+        let target = std::path::Path::new(target);
+        let absolute_target = if target.is_absolute() {
+            pacquet_fs::lexical_normalize(target)
+        } else {
+            pacquet_fs::lexical_normalize(&ctx.base_opts.project_dir.join(target))
+        };
+        let relative_target =
+            pathdiff::diff_paths(&absolute_target, &ctx.lockfile_dir).unwrap_or(absolute_target);
+        let relative_target = relative_target.display().to_string().replace('\\', "/");
+        let relative_target = if relative_target.is_empty() { "." } else { &relative_target };
+        return Ok(format!("link:{relative_target}"));
Evidence
The resolver now constructs link: ids by path-normalizing and then replacing backslashes, while
the lockfile parsing layer documents that link: payloads are kept verbatim and later treated as
filesystem paths—so rewriting the payload can change what directory is ultimately
linked/materialized.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2854-2866]
pnpm/crates/lockfile/src/resolved_dependency.rs[224-234]
pnpm/crates/package-manager/src/link_manifest_link_deps.rs[158-165]

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

### Issue description
`pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs` rewrites `link:` dependency IDs by stringifying a `PathBuf` and then doing `.replace('\\', "/")`. On non-Windows platforms this can change the meaning of a `link:` target that intentionally contains backslashes as literal characters, violating the codebase’s documented expectation that `link:` targets are preserved verbatim.

### Issue Context
- The lockfile parser explicitly treats `link:` as a verbatim payload.
- The produced `link:<payload>` strings are later interpreted as filesystem paths.

### Fix Focus Areas
- Make the `\\`→`/` substitution **Windows-only** (or otherwise avoid rewriting backslashes on POSIX).
- Ensure any normalization done for stability does not change the byte-level `link:` payload semantics on POSIX.

- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2855-2866]

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


7. captureResolveRequest params lack comma 📘 Rule violation ⚙ Maintainability ⭐ New
Description
In resolveViaPnprServer.test.ts, the new multi-line captureResolveRequest function signature
omits the required trailing comma after the last parameter. This violates the TypeScript
trailing-comma style requirement.
Code

pnpr/client/test/resolveViaPnprServer.test.ts[R56-58]

+async function captureResolveRequest (
+  options: Omit<ResolveViaPnprServerOptions, 'registryUrl'>
+): Promise<CapturedResolveRequest> {
Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript constructs. The added
captureResolveRequest signature spans multiple lines, but the final parameter line does not end
with a comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpr/client/test/resolveViaPnprServer.test.ts[56-58]

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 multi-line TypeScript function parameter list is missing a trailing comma.

## Issue Context
Rule 713434 requires trailing commas in multi-line constructs, including function parameter lists.

## Fix Focus Areas
- pnpr/client/test/resolveViaPnprServer.test.ts[56-58]

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


8. Redundant closure recomputation 🐞 Bug ➹ Performance
Description
Filtered installs compute the same materialization closure multiple times (twice in
Install::run_inner and again inside merge_filtered_current_lockfile), repeating lockfile graph
walks and path normalizations unnecessarily. This scales with workspace size and can measurably slow
pnpm install --filter ... on larger repos.
Code

pnpm/crates/package-manager/src/install.rs[R1800-1842]

+        let materialized_wanted_lockfile = fresh_lockfile.as_ref().or(lockfile);
+        let selected_current_lockfile = materialized_wanted_lockfile.and_then(|wanted| {
+            requested_importer_ids.as_ref().map(|requested| {
+                crate::materialization_closure(
+                    wanted,
+                    &workspace_root,
+                    requested,
+                    included,
+                    &install_skipped,
+                )
+                .lockfile
+            })
+        });
+        let materialized_current_lockfile = materialized_wanted_lockfile.map(|wanted| {
+            if requested_importer_ids.is_some() && matches!(node_linker, NodeLinker::Hoisted) {
+                crate::filter_lockfile_for_current(wanted, included, &install_skipped)
+            } else if let Some(requested_importer_ids) = requested_importer_ids.as_ref() {
+                crate::merge_filtered_current_lockfile(
+                    (!is_inconsistent).then_some(current_lockfile.as_ref()).flatten(),
+                    wanted,
+                    requested_importer_ids,
+                    included,
+                    &install_skipped,
+                    &workspace_root,
+                )
+            } else {
+                crate::filter_lockfile_for_current(wanted, included, &install_skipped)
+            }
+        });
+        let project_anchor_importer_ids = match requested_importer_ids.as_ref() {
+            Some(requested) if matches!(node_linker, NodeLinker::Hoisted) => requested.clone(),
+            Some(requested) => materialized_wanted_lockfile.map_or_else(
+                || requested.clone(),
+                |wanted| {
+                    crate::materialization_closure(
+                        wanted,
+                        &workspace_root,
+                        requested,
+                        included,
+                        &install_skipped,
+                    )
+                    .importer_ids
+                },
Evidence
Install::run_inner invokes materialization_closure twice with identical arguments to get (a) the
selected current lockfile and (b) the selected importer-id closure, then calls
merge_filtered_current_lockfile which recomputes the same closure again from the same
wanted/requested/included/skipped/workspace_root inputs.

pnpm/crates/package-manager/src/install.rs[1800-1842]
pnpm/crates/package-manager/src/current_lockfile.rs[186-235]

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

### Issue description
Filtered installs recompute `materialization_closure(...)` multiple times with the same inputs:
- once to compute `selected_current_lockfile` (used for `.modules.yaml` metadata merge),
- again to compute `project_anchor_importer_ids`,
- and then *again* inside `merge_filtered_current_lockfile`.

This repeats the same traversal/normalization work and adds overhead proportional to lockfile/workspace size.

### Issue Context
- In `Install::run_inner`, both `selected_current_lockfile` and `project_anchor_importer_ids` call `crate::materialization_closure(wanted, &workspace_root, requested, included, &install_skipped)`.
- `merge_filtered_current_lockfile(...)` immediately calls `materialization_closure(wanted, workspace_root, requested_importer_ids, included, skipped)` again, with the same arguments passed from `Install::run_inner`.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[1800-1845]
- pnpm/crates/package-manager/src/current_lockfile.rs[186-235]

### Suggested fix approach
1. Compute `let selected_closure = crate::materialization_closure(wanted, &workspace_root, requested, included, &install_skipped);` once in `Install::run_inner` (only when `requested_importer_ids.is_some()` and non-hoisted).
2. Derive:
  - `selected_current_lockfile` as a reference to `selected_closure.lockfile` (avoid cloning if possible), and
  - `project_anchor_importer_ids` as `selected_closure.importer_ids.clone()`.
3. Refactor `merge_filtered_current_lockfile` to accept either:
  - the precomputed `MaterializationClosure` (or `selected_lockfile` + `selected_importer_ids`) so it does not recompute it, or
  - a new helper that merges using the precomputed selected closure.

This should drop closure computation from 3x to 1x in the filtered/non-hoisted path.

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


View more (5)
9. SBOM repeats canonicalize calls 🐞 Bug ➹ Performance
Description
The new confined_importer_dir() canonicalizes the lockfile root on every invocation, and it is
called inside the importer walk and link: dependency handling, adding avoidable filesystem work on
large workspaces. This can noticeably slow pnpm sbom (especially with --exclude-peers or many
workspace links) compared to computing the canonical lockfile root once and reusing it.
Code

pnpm/crates/cli/src/cli_args/sbom.rs[R160-166]

+fn confined_importer_dir(lockfile_dir: &Path, importer_id: &str) -> Option<PathBuf> {
+    if validate_importer_id(importer_id).is_err() {
+        return None;
+    }
+    let lockfile_root = std::fs::canonicalize(lockfile_dir).ok()?;
+    let importer_dir = std::fs::canonicalize(importer_root_dir(lockfile_dir, importer_id)).ok()?;
+    importer_dir.starts_with(&lockfile_root).then_some(importer_dir)
Evidence
confined_importer_dir() canonicalizes lockfile_dir every call, and SBOM calls it in loop-heavy
places (per importer when excluding peers, and for each link: dep to resolve workspace manifests).
The TS reference implementation canonicalizes the lockfile root once and reuses it, indicating a
cheaper structure is feasible without changing semantics.

pnpm/crates/cli/src/cli_args/sbom.rs[152-167]
pnpm/crates/cli/src/cli_args/sbom.rs[485-490]
pnpm/crates/cli/src/cli_args/sbom.rs[526-530]
pnpm11/deps/compliance/commands/src/sbom/sbom.ts[359-376]

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

### Issue description
`confined_importer_dir()` calls `std::fs::canonicalize(lockfile_dir)` every time it is invoked. In SBOM generation this helper is used in loop contexts (per-importer peer exclusion and per-`link:` dependency handling), so repeatedly re-canonicalizing the same lockfile root adds unnecessary filesystem overhead.

### Issue Context
- This helper was introduced to safely confine lockfile importer IDs to the lockfile root (security win), but it can retain that behavior while avoiding repeated canonicalization of the same root path.
- TypeScript’s SBOM implementation realpaths the lockfile root once and reuses it for containment checks.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/sbom.rs[152-168]
- pnpm/crates/cli/src/cli_args/sbom.rs[485-490]
- pnpm/crates/cli/src/cli_args/sbom.rs[526-530]

### Suggested fix approach
1. Compute `lockfile_root = std::fs::canonicalize(&lockfile_dir)?` once in `collect_components()`.
2. Change `confined_importer_dir` to accept `lockfile_root: &Path` (or close over it) so only the importer directory is canonicalized per call.
3. (Optional) Add a small cache like `HashMap<String, Option<PathBuf>>` for importer IDs encountered to avoid repeated canonicalization for the same importer in the `link:` traversal.

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


10. SBOM hides invalid importer IDs 🐞 Bug ⛨ Security
Description
sbom calls validate_importer_id but converts failures into None/false (.ok()/.is_ok()),
so a lockfile containing unsafe importer keys can change what metadata is read (or skipped) without
any warning/error. This is especially risky for compliance output because a repo-supplied malformed
lockfile (e.g. ../foo, absolute paths) will not be surfaced to the user.
Code

pnpm/crates/cli/src/cli_args/sbom.rs[R391-399]

+            // `single_id` is a raw lockfile importer key; validate it before
+            // it turns into an on-disk path so a crafted `../foo` or absolute
+            // key cannot read a `package.json` outside the workspace.
+            let manifest = validate_importer_id(single_id).ok().and_then(|()| {
+                safe_read_package_json_from_dir(&importer_root_dir(&lockfile_dir, single_id))
+                    .ok()
+                    .flatten()
+            });
+            manifest.unwrap_or_else(|| {
Evidence
sbom explicitly discards validate_importer_id failures (.ok() / .is_ok()) instead of
surfacing them, even though the validator is meant to reject hostile/malformed importer keys from an
untrusted lockfile. The new validator tests show concrete rejected forms (../foo, absolute paths,
backslashes, drive prefixes), demonstrating realistic malformed inputs that would now be silently
ignored by sbom rather than diagnosed.

pnpm/crates/cli/src/cli_args/sbom.rs[389-399]
pnpm/crates/cli/src/cli_args/sbom.rs[470-477]
pnpm/crates/cli/src/cli_args/sbom.rs[513-518]
pnpm/crates/package-manager/src/symlink_direct_dependencies.rs[264-277]
pnpm/crates/package-manager/src/symlink_direct_dependencies/tests.rs[13-30]

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

## Issue description
`pnpm sbom` validates lockfile importer IDs before using them as filesystem paths, but it currently suppresses validation errors via `.ok()` / `.is_ok()`. That means a malicious or malformed `pnpm-lock.yaml` can influence SBOM generation (by skipping manifest reads used for root metadata / peer exclusion / workspace link naming) without producing any diagnostic.

## Issue Context
`validate_importer_id` is documented as a lockfile-safety check for attacker-controlled importer keys. The symlink/linking path treats invalid keys as a typed error; SBOM should either (a) fail with a clear error when encountering unsafe importer IDs from the lockfile, or (b) emit an explicit warning listing the rejected importer IDs so users don’t trust silently-degraded SBOM output.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/sbom.rs[390-405]
- pnpm/crates/cli/src/cli_args/sbom.rs[470-479]
- pnpm/crates/cli/src/cli_args/sbom.rs[513-519]

## Suggested fix approach
- Replace `.ok()` / `.is_ok()` patterns with explicit handling:
 - If an unsafe importer id is encountered from the lockfile, collect it into a `Vec<String>` and after processing return an error like `ERR_PNPM_SBOM_UNSAFE_IMPORTER_ID` (or similar), including the rejected ids.
 - If you intentionally want to continue, emit a structured warning (stderr / reporter) listing the rejected importer ids and what SBOM features were skipped.
- Add/extend tests to assert the chosen behavior for a lockfile that contains importer ids such as `../foo` or `/abs/path` (which `validate_importer_id` rejects).

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


11. Closure builds importer map 🐞 Bug ➹ Performance
Description
collect_reachable() always sorts all importer IDs and lexical-normalizes every importer path to
build a known_importers lookup map, even when filter_lockfile_for_current() seeds the traversal
with *every* importer (the common full-workspace case). This adds avoidable O(n log n) +
normalization/allocation overhead to current-lockfile shaping.
Code

pnpm/crates/package-manager/src/current_lockfile.rs[R374-386]

+    let snapshots = lockfile.snapshots.as_ref();
+    let mut known_importer_ids = lockfile.importers.keys().cloned().collect::<Vec<_>>();
+    known_importer_ids.sort();
+    let known_importers = known_importer_ids
        .into_iter()
-        .flatten()
-        {
-            for (name, spec) in map {
-                let Some(key) = spec.version.resolved_key(name) else { continue };
-                if should_skip(&key) {
-                    continue;
-                }
-                if snapshots.contains_key(&key) {
-                    queue.push_back(key);
+        .map(|id| {
+            (pacquet_fs::lexical_normalize(&crate::importer_root_dir(workspace_root, &id)), id)
+        })
+        .collect::<HashMap<_, _>>();
+    let mut importer_ids = HashSet::new();
+    let mut snapshot_keys = HashSet::new();
+    let mut importer_queue = initial_importer_ids.iter().cloned().collect::<VecDeque<_>>();
+    let mut snapshot_queue = VecDeque::new();
Evidence
The full-workspace helper seeds the closure with all importer IDs, but collect_reachable() still
sorts and normalizes every importer to build known_importers before traversal, making the extra
work unconditional on that common path.

pnpm/crates/package-manager/src/current_lockfile.rs[305-317]
pnpm/crates/package-manager/src/current_lockfile.rs[374-386]

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

### Issue description
`collect_reachable()` unconditionally performs:
- `Vec` collection + sort of all importer IDs
- lexical normalization of each importer path
- construction of a `HashMap<PathBuf, String>`

Even when the caller already seeds traversal with all importers (e.g. `filter_lockfile_for_current()`), importer discovery via `link:` targets cannot widen the importer set, so this preprocessing is unnecessary in that case.

### Issue Context
`filter_lockfile_for_current()` is used to build the current-lockfile shape (and is on the install path). In the full-workspace case it passes all importer IDs; the current implementation still pays to build the importer-path lookup.

### Fix Focus Areas
- pnpm/crates/package-manager/src/current_lockfile.rs[305-317]
- pnpm/crates/package-manager/src/current_lockfile.rs[374-386]

### Suggested fix approach
Implement a fast path in `collect_reachable()`:
1. If `initial_importer_ids.len() == lockfile.importers.len()` (and optionally `initial_importer_ids` is exactly the key set), skip:
  - sorting importer IDs
  - building `known_importers`
  - importer-queue expansion via `enqueue_linked_importer`
2. Instead:
  - set `importer_ids = initial_importer_ids.clone()`
  - seed `snapshot_queue` by iterating over the relevant importer(s) directly (all importers, or the initial set) and pushing resolved snapshot keys.
  - BFS snapshots as today.

Alternative: build `known_importers` lazily only if/when a `link:` target is encountered *and* `initial_importer_ids` is not already the full set.

Add a micro-benchmark or a unit test that asserts the fast path is taken (e.g., via a small hook/counter) if you want to guard against regressions.

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


12. Filtered prune extra work 🐞 Bug ➹ Performance
Description
The direct-dependency pruning step is executed for filtered installs even when no dependency groups
are excluded, causing unnecessary graph traversal (materialization_closure) and per-importer work.
This can add avoidable overhead on common monorepo --filter install runs.
Code

pnpm/crates/package-manager/src/install.rs[R1392-1431]

+        // Remove direct links from dependency groups excluded by this
+        // run. Unfiltered installs can use the global `included` value
+        // recorded in `.modules.yaml`; filtered installs may retain
+        // importers materialized with different group sets, so they
+        // conservatively prune every excluded group from only the
+        // selected workspace-link closure.
        if !resolve_only
            && !is_inconsistent
            && let Some(modules) = modules_manifest
-            && modules.included != included
            && let Some(current) = current_lockfile.as_ref()
+            && (filtered_install || modules.included != included)
        {
+            let selected_prune_importer_ids = requested_importer_ids.as_ref().map(|requested| {
+                crate::materialization_closure(
+                    current,
+                    &workspace_root,
+                    requested,
+                    included,
+                    &crate::SkippedSnapshots::new(),
+                )
+                .importer_ids
+            });
+            let previously_included = if filtered_install {
+                IncludedDependencies {
+                    dependencies: true,
+                    dev_dependencies: true,
+                    optional_dependencies: true,
+                }
+            } else {
+                modules.included
+            };
            crate::prune_direct_deps_excluded_by_groups(
                current,
-                modules.included,
+                previously_included,
                included,
                &workspace_root,
                config,
+                selected_prune_importer_ids.as_ref(),
            )
            .map_err(InstallError::PruneDirectDeps)?;
Evidence
The filtered-install branch forces the prune call; the prune implementation loops importers and
performs canonicalization/name computations without an early return when groups are identical.

pnpm/crates/package-manager/src/install.rs[1392-1431]
pnpm/crates/package-manager/src/prune_direct_deps.rs[108-170]

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

### Issue description
On filtered installs, the prune step is currently entered whenever `filtered_install` is true, even if `included` represents the full set (prod+dev+optional). In that case, the pruning operation cannot remove anything, but still performs non-trivial work (closure computation + per-importer scans).

### Issue Context
`prune_direct_deps_excluded_by_groups()` iterates importers and performs canonicalization and dependency-name computations; calling it when `old_included == new_included` is wasted work.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[1392-1431]
- pnpm/crates/package-manager/src/prune_direct_deps.rs[108-170]

### Suggested change
- In `install.rs`, gate the filtered-install prune block on there being excluded groups, e.g.:
 - only run if `!included.dependencies || !included.dev_dependencies || !included.optional_dependencies`.
 - (Optionally also require `previously_included != included` once you can compute a meaningful `previously_included` for filtered installs.)
- Add a fast-path in `prune_direct_deps_excluded_by_groups()`:
 - if `old_included == new_included`, return `Ok(())` before iterating importers.
This preserves correctness while removing an avoidable pass on the filtered-install hot path.

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


13. Selection asserts can panic 🐞 Bug ☼ Reliability
Description
selected_project_indices() uses assert!/assert_eq!/expect() to enforce selection invariants,
so any mismatch between selected_dirs, ordered_dirs, and discovered projects will crash the CLI
instead of returning a recoverable error. This affects recursive filtered install-family commands
(e.g. add) that call it before doing any work.
Code

pnpm/crates/package-manager/src/install.rs[R102-121]

+pub(crate) fn selected_project_indices(
+    projects: &[pacquet_workspace::Project],
+    ordered_dirs: &[PathBuf],
+    selected_dirs: &HashSet<PathBuf>,
+) -> Vec<usize> {
+    let project_indices = projects
+        .iter()
+        .enumerate()
+        .map(|(index, project)| (project.root_dir.as_path(), index))
+        .collect::<std::collections::HashMap<_, _>>();
+    let mut seen_dirs = HashSet::with_capacity(selected_dirs.len());
+    let indices = ordered_dirs
+        .iter()
+        .filter(|dir| selected_dirs.contains(*dir))
+        .map(|dir| {
+            assert!(seen_dirs.insert(dir.as_path()), "selected project must be ordered once");
+            *project_indices.get(dir.as_path()).expect("every selected project must be discovered")
+        })
+        .collect::<Vec<_>>();
+    assert_eq!(seen_dirs.len(), selected_dirs.len(), "every selected project must be ordered");
Evidence
The new helper panics on mismatches, and it is invoked in recursive filtered command paths, so any
upstream inconsistency becomes an unconditional process abort.

pnpm/crates/package-manager/src/install.rs[102-121]
pnpm/crates/package-manager/src/add.rs[241-326]
pnpm/crates/cli/src/cli_args/pipelines.rs[50-78]

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

### Issue description
`selected_project_indices()` currently hard-panics (`assert!`, `assert_eq!`, `expect()`) if its internal invariants are violated. In production CLI code this turns an invariant violation into a process abort rather than a typed error, which is hard to diagnose and can take down automation.

### Issue Context
This helper is used by install-family operations in recursive/filtered mode (e.g. `Add::run_selected`) and runs before any meaningful work is performed, so a panic aborts the whole command.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[102-121]

### Suggested change
- Change `selected_project_indices(...) -> Vec<usize>` to return `Result<Vec<usize>, SomeError>`.
- Replace:
 - `assert!(...)` with a duplicate-detection error,
 - `expect("every selected project must be discovered")` with a missing-project error,
 - `assert_eq!(seen_dirs.len(), selected_dirs.len(), ...)` with an error listing unmatched selected dirs.
- Update callers (e.g. add/remove/update selected paths) to bubble up the error as a user-facing diagnostic instead of panicking.
- If you still want debug-time enforcement, keep `debug_assert!` alongside the runtime error path.

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



Informational

14. Filtered modules manifest reread 🐞 Bug ➹ Performance ⭐ New
Description
Filtered installs read .modules.yaml twice: first via read_modules_layout, then again via
read_modules_manifest when the layout read succeeded, adding extra disk I/O and YAML
deserialization on the install --filter hot path. This defeats the purpose of ModulesLayout
(skipping large maps) when filtered installs need full metadata anyway.
Code

pnpm/crates/package-manager/src/install.rs[R1279-1284]

+        let previous_modules_metadata = if filtered_install && !resolve_only && !read_failed {
+            pacquet_modules_yaml::read_modules_manifest::<Host>(&config.modules_dir)
+                .map_err(InstallError::ReadModules)?
+        } else {
+            None
+        };
Evidence
install.rs performs read_modules_layout unconditionally for the non-resolve-only path, then
(new) performs a second read_modules_manifest for filtered installs. The modules-yaml crate
provides ModulesLayout specifically to avoid deserializing large maps, so the second full read is
the expensive duplication.

pnpm/crates/package-manager/src/install.rs[1256-1284]
pnpm/crates/modules-yaml/src/lib.rs[214-220]
pnpm/crates/modules-yaml/src/lib.rs[391-462]

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

### Issue description
In filtered installs, `Install::run_inner` reads `.modules.yaml` layout and then performs a second read/parse for the full manifest. This duplicates filesystem work and parsing.

### Issue Context
`ModulesLayout` exists specifically to avoid deserializing large maps during fast-path consistency checks. For filtered installs that also need full metadata, the layout read can be skipped if the full manifest is read once and a lightweight view is derived from it.

### Fix Focus Areas
- Refactor the `.modules.yaml` read so filtered installs either:
 - read the full `Modules` once and derive the needed layout fields for consistency checks, or
 - extend the modules-yaml API to return both layout + required metadata in one parse.

- pnpm/crates/package-manager/src/install.rs[1256-1284]
- pnpm/crates/modules-yaml/src/lib.rs[391-462]

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


15. Misleading lockfile format comment 🐞 Bug ⚙ Maintainability
Description
The new comment in resolve_projects_streaming says a dependency-free importer is recorded as `{
specifiers: {} }, but v9 lockfile serialization skips specifiers`, so this misstates the
serialized format and can mislead future maintenance/debugging of merge semantics.
Code

pnpm/crates/pnpr-client/src/lib.rs[R413-418]

+        // This is a containment check (every returned importer was
+        // requested), which is the injection boundary; it deliberately does
+        // not require every requested importer to be present. A dependency-
+        // free importer is still present-but-empty (pnpm records it as
+        // `{ specifiers: {} }`), and a genuinely missing importer is surfaced
+        // downstream by the lockfile merge, not a way to inject dependencies.
Evidence
The pnpr-client comment explicitly references { specifiers: {} } as the representation of an empty
importer, while the lockfile ProjectSnapshot definition documents that v9 does not serialize
specifiers and marks the field as skip_serializing, so that shape is not what this code
writes/relies on for v9 lockfiles.

pnpm/crates/pnpr-client/src/lib.rs[408-418]
pnpm/crates/lockfile/src/project_snapshot.rs[7-18]

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

### Issue description
A newly added comment claims pnpm records an empty importer as `{ specifiers: {} }`. In the v9 lockfile model used here, `specifiers` is an in-memory/deserialization field and is not serialized, so the comment is misleading.

### Issue Context
`ProjectSnapshot.specifiers` is annotated `skip_serializing` and the docs state v9 lockfiles do not carry a top-level `specifiers` map.

### Fix Focus Areas
- pnpm/crates/pnpr-client/src/lib.rs[413-418]

Suggested edit (example): replace the `{ specifiers: {} }` phrasing with something like “a dependency-free importer is still present as an empty importer entry (no dependency blocks)” (optionally noting v9 doesn’t serialize `specifiers`).

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


Grey Divider

Qodo Logo

Comment thread .changeset/pacquet-install-filters.md Resolved
@qodo-code-review

qodo-code-review Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to e0e361c

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve in-memory manifest mutations

Update build_selected_project_manifests_list to favor the in-memory
active_manifest over the discovered on-disk manifest. This guarantees that
unwritten changes applied by CLI commands are retained during filtered
installations.

pnpm/crates/package-manager/src/install.rs [3071-3089]

 fn build_selected_project_manifests_list<'a>(
     active_manifest: &'a PackageManifest,
     projects: &'a [pacquet_workspace::Project],
     active_manifest_is_standin: bool,
 ) -> Vec<(PathBuf, &'a PackageManifest)> {
-    let mut manifests = projects
-        .iter()
-        .map(|project| (project.root_dir.clone(), &project.manifest))
-        .collect::<Vec<_>>();
     let active_dir =
         active_manifest.path().parent().expect("manifest path always has a parent dir");
     let active_dir_matcher = ProjectDirMatcher::new(active_dir);
-    let active_project_was_discovered =
-        projects.iter().any(|project| active_dir_matcher.matches(&project.root_dir));
+    let mut active_project_was_discovered = false;
+    let mut manifests = projects
+        .iter()
+        .map(|project| {
+            if active_dir_matcher.matches(&project.root_dir) {
+                active_project_was_discovered = true;
+                if !active_manifest_is_standin {
+                    return (active_dir.to_path_buf(), active_manifest);
+                }
+            }
+            (project.root_dir.clone(), &project.manifest)
+        })
+        .collect::<Vec<_>>();
     if !active_manifest_is_standin && !active_project_was_discovered {
         manifests.push((active_dir.to_path_buf(), active_manifest));
     }
     manifests
 }
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion corrects a significant bug where in-memory mutations to active_manifest (e.g., from add or remove commands) are dropped during filtered installs, preventing inconsistent states.

High
  • More

Previous suggestions

Suggestions up to commit 6439feb
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve in-memory manifest mutations

Replace the discovered project's manifest with active_manifest when it
corresponds to the active project. This preserves in-memory manifest mutations.

pnpm/crates/package-manager/src/install.rs [3088-3096]

-let mut manifests = projects
-    .iter()
-    .map(|project| (project.root_dir.clone(), &project.manifest))
-    .collect::<Vec<_>>();
 let active_dir =
     active_manifest.path().parent().expect("manifest path always has a parent dir");
 let active_dir_matcher = ProjectDirMatcher::new(active_dir);
-let active_project_was_discovered =
-    projects.iter().any(|project| active_dir_matcher.matches(&project.root_dir));
+let mut active_project_was_discovered = false;
+let mut manifests = projects
+    .iter()
+    .map(|project| {
+        if active_dir_matcher.matches(&project.root_dir) {
+            active_project_was_discovered = true;
+            if !active_manifest_is_standin {
+                return (active_dir.to_path_buf(), active_manifest);
+            }
+        }
+        (project.root_dir.clone(), &project.manifest)
+    })
+    .collect::<Vec<_>>();
Suggestion importance[1-10]: 9

__

Why: This is a critical fix that prevents stale on-disk manifests from mistakenly overriding in-memory mutations during filtered operations like add or remove.

High
Canonicalize selected freshness matching

Use ProjectDirMatcher for matching selected directories instead of relying only
on lexical normalization. This ensures correct matching across symlinks and
aliases.

pnpm/crates/package-manager/src/install.rs [3139-3145]

-let selected_dirs =
-    selected_dirs.iter().map(|dir| pacquet_fs::lexical_normalize(dir)).collect::<HashSet<_>>();
+let selected_dir_matchers =
+    selected_dirs.iter().map(|dir| ProjectDirMatcher::new(dir)).collect::<Vec<_>>();
 let mut inputs = project_manifests
     .iter()
     .filter(|(project_dir, _)| {
-        selected_dirs.contains(&pacquet_fs::lexical_normalize(project_dir))
+        selected_dir_matchers.iter().any(|matcher| matcher.matches(project_dir))
     })
Suggestion importance[1-10]: 8

__

Why: This addresses a significant edge case by correctly resolving symlinks and macOS aliases (e.g., /tmp), preventing potential bugs in lockfile freshness checks.

Medium
Parse modules manifests as YAML

Use a YAML deserializer instead of serde_json to parse the .modules.yaml file.

pnpm/crates/cli/tests/install_filters.rs [1044-1046]

 let mut raw_modules: Value =
-    serde_json::from_str(&fs::read_to_string(&modules_path).expect("read .modules.yaml"))
-        .expect("parse .modules.yaml as JSON");
+    serde_saphyr::from_str(&fs::read_to_string(&modules_path).expect("read .modules.yaml"))
+        .expect("parse .modules.yaml");
Suggestion importance[1-10]: 7

__

Why: Replacing serde_json::from_str with a YAML parser for a .yaml file ensures robust parsing and prevents potential test failures.

Medium
Suggestions up to commit 88fe3aa
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve in-memory manifest mutations

Update build_selected_project_manifests_list to use active_manifest instead of
the on-disk manifest when a project matches the active directory. This prevents
losing in-memory manifest mutations.

pnpm/crates/package-manager/src/install.rs [3088-3099]

-let mut manifests = projects
-    .iter()
-    .map(|project| (project.root_dir.clone(), &project.manifest))
-    .collect::<Vec<_>>();
 let active_dir =
     active_manifest.path().parent().expect("manifest path always has a parent dir");
 let active_dir_matcher = ProjectDirMatcher::new(active_dir);
-let active_project_was_discovered =
-    projects.iter().any(|project| active_dir_matcher.matches(&project.root_dir));
+let mut active_project_was_discovered = false;
+let mut manifests = projects
+    .iter()
+    .map(|project| {
+        if active_dir_matcher.matches(&project.root_dir) {
+            active_project_was_discovered = true;
+            if !active_manifest_is_standin {
+                return (active_dir.to_path_buf(), active_manifest);
+            }
+        }
+        (project.root_dir.clone(), &project.manifest)
+    })
+    .collect::<Vec<_>>();
 if !active_manifest_is_standin && !active_project_was_discovered {
     manifests.push((active_dir.to_path_buf(), active_manifest));
 }
Suggestion importance[1-10]: 9

__

Why: This addresses a critical bug where in-memory modifications to the active manifest (such as newly added dependencies via pacquet add) would be lost because the method previously always used the on-disk manifest for discovered projects.

High
Suggestions up to commit 36c53f9
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve active in-memory manifest changes

Ensure the active project's in-memory manifest is used instead of the on-disk
one when discovered in workspaces.

pnpm/crates/package-manager/src/install.rs [3088-3096]

-let mut manifests = projects
-    .iter()
-    .map(|project| (project.root_dir.clone(), &project.manifest))
-    .collect::<Vec<_>>();
 let active_dir =
     active_manifest.path().parent().expect("manifest path always has a parent dir");
 let active_dir_matcher = ProjectDirMatcher::new(active_dir);
-let active_project_was_discovered =
-    projects.iter().any(|project| active_dir_matcher.matches(&project.root_dir));
+let mut active_project_was_discovered = false;
+let mut manifests = projects
+    .iter()
+    .map(|project| {
+        if active_dir_matcher.matches(&project.root_dir) {
+            active_project_was_discovered = true;
+            if !active_manifest_is_standin {
+                return (active_dir.to_path_buf(), active_manifest);
+            }
+        }
+        (project.root_dir.clone(), &project.manifest)
+    })
+    .collect::<Vec<_>>();
Suggestion importance[1-10]: 9

__

Why: This fixes a critical bug where in-memory manifest mutations from add or remove commands would be discarded if the active project is already part of the discovered workspaces, breaking those commands in filtered contexts.

High
Skip optional peer auto-installation

Filter out optional peer dependencies from the auto-installed peers list during
freshness checks.

pnpm/crates/package-manager/src/install.rs [2342-2346]

+let optional_peers = manifest
+    .value()
+    .get("peerDependenciesMeta")
+    .and_then(serde_json::Value::as_object)
+    .into_iter()
+    .flat_map(|metadata| metadata.iter())
+    .filter(|(_, metadata)| {
+        metadata
+            .get("optional")
+            .and_then(serde_json::Value::as_bool)
+            .unwrap_or(false)
+    })
+    .map(|(name, _)| name.as_str())
+    .collect::<HashSet<_>>();
 let peers = manifest
     .dependencies([DependencyGroup::Peer])
-    .filter(|(name, _)| !existing.contains(*name))
+    .filter(|(name, _)| !existing.contains(*name) && !optional_peers.contains(*name))
     .map(|(name, specifier)| (name.to_string(), specifier.to_string()))
     .collect::<Vec<_>>();
Suggestion importance[1-10]: 8

__

Why: This corrects lockfile freshness evaluation by correctly skipping optional peer dependencies, avoiding false positives where a valid lockfile is deemed stale.

Medium
Suggestions up to commit a82a548
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve active manifest mutations

Override the discovered workspace project manifest with active_manifest if it's
not a stand-in.

pnpm/crates/package-manager/src/install.rs [3095-3099]

-let active_project_was_discovered =
-    projects.iter().any(|project| active_dir_matcher.matches(&project.root_dir));
-if !active_manifest_is_standin && !active_project_was_discovered {
-    manifests.push((active_dir.to_path_buf(), active_manifest));
+if !active_manifest_is_standin {
+    if let Some((project_dir, manifest)) = manifests
+        .iter_mut()
+        .find(|(project_dir, _)| active_dir_matcher.matches(project_dir))
+    {
+        *project_dir = active_dir.to_path_buf();
+        *manifest = active_manifest;
+    } else {
+        manifests.push((active_dir.to_path_buf(), active_manifest));
+    }
 }
Suggestion importance[1-10]: 9

__

Why: This fixes a critical bug where in-memory manifest mutations (like from add or remove commands) are ignored during dependency resolution for workspace projects.

High
Validate aliased selected directories

Use ProjectDirMatcher instead of just lexical normalization to match selected
directories.

pnpm/crates/package-manager/src/install.rs [3139-3145]

-let selected_dirs =
-    selected_dirs.iter().map(|dir| pacquet_fs::lexical_normalize(dir)).collect::<HashSet<_>>();
+let selected_dir_matchers =
+    selected_dirs.iter().map(|dir| ProjectDirMatcher::new(dir)).collect::<Vec<_>>();
 let mut inputs = project_manifests
     .iter()
     .filter(|(project_dir, _)| {
-        selected_dirs.contains(&pacquet_fs::lexical_normalize(project_dir))
+        selected_dir_matchers.iter().any(|matcher| matcher.matches(project_dir))
     })
Suggestion importance[1-10]: 8

__

Why: Using ProjectDirMatcher correctly accounts for symlinks and path aliases, preventing potential bugs where aliased directories are silently missed in freshness filtering.

Medium
Skip optional peer installation

Filter out optional peers defined in peerDependenciesMeta before adding peers to
auto-installed dependencies.

pnpm/crates/package-manager/src/install.rs [2342-2346]

+let optional_peers = manifest
+    .value()
+    .get("peerDependenciesMeta")
+    .and_then(serde_json::Value::as_object);
 let peers = manifest
     .dependencies([DependencyGroup::Peer])
     .filter(|(name, _)| !existing.contains(*name))
+    .filter(|(name, _)| {
+        !optional_peers
+            .and_then(|meta| meta.get(*name))
+            .and_then(|meta| meta.get("optional"))
+            .and_then(serde_json::Value::as_bool)
+            .unwrap_or(false)
+    })
     .map(|(name, specifier)| (name.to_string(), specifier.to_string()))
     .collect::<Vec<_>>();
Suggestion importance[1-10]: 8

__

Why: This ensures optional peers are not incorrectly treated as required auto-installed dependencies, fixing a lockfile freshness validation mismatch.

Medium
Handle module manifests as YAML

Use a YAML parser to read and write the .modules.yaml file instead of a JSON
parser.

pnpm/crates/cli/tests/install_filters.rs [1044-1052]

 let mut raw_modules: Value =
-    serde_json::from_str(&fs::read_to_string(&modules_path).expect("read .modules.yaml"))
-        .expect("parse .modules.yaml as JSON");
+    serde_saphyr::from_str(&fs::read_to_string(&modules_path).expect("read .modules.yaml"))
+        .expect("parse .modules.yaml");
 raw_modules["layoutVersion"] = json!(4);
 fs::write(
     &modules_path,
-    serde_json::to_string_pretty(&raw_modules).expect("serialize incompatible modules"),
+    serde_saphyr::to_string(&raw_modules).expect("serialize incompatible modules"),
 )
 .expect("write incompatible .modules.yaml");
Suggestion importance[1-10]: 7

__

Why: Using a JSON parser for a YAML file can lead to parsing failures if the file contains YAML-specific syntax, which could break the test unexpectedly.

Medium
Suggestions up to commit 5ca0015
CategorySuggestion                                                                                                                                    Impact
Possible issue
Handle module manifests as YAML

Use serde_saphyr instead of serde_json to correctly parse and serialize
.modules.yaml as YAML.

pnpm/crates/cli/tests/install_filters.rs [1044-1052]

 let mut raw_modules: Value =
-    serde_json::from_str(&fs::read_to_string(&modules_path).expect("read .modules.yaml"))
-        .expect("parse .modules.yaml as JSON");
+    serde_saphyr::from_str(&fs::read_to_string(&modules_path).expect("read .modules.yaml"))
+        .expect("parse .modules.yaml");
 raw_modules["layoutVersion"] = json!(4);
 fs::write(
     &modules_path,
-    serde_json::to_string_pretty(&raw_modules).expect("serialize incompatible modules"),
+    serde_saphyr::to_string(&raw_modules).expect("serialize incompatible modules"),
 )
 .expect("write incompatible .modules.yaml");
Suggestion importance[1-10]: 8

__

Why: The test incorrectly attempts to parse and serialize .modules.yaml as JSON, which can cause the test to fail since the file uses YAML syntax.

Medium
Canonicalize filtered project identity

Use canonical path resolving (via ProjectDirMatcher) when comparing selected
directories with discovered projects to prevent mismatches caused by symlinks or
non-canonical paths.

pnpm/crates/package-manager/src/install.rs [837-3145]

 let selected_importer_ids = selection.as_ref().map(|selection| {
     selection
-        .selected_dirs
+        .all_projects
         .iter()
-        .map(|project_dir| {
-            pacquet_workspace::importer_id_from_root_dir(&workspace_root, project_dir)
+        .filter(|project| {
+            selection
+                .selected_dirs
+                .iter()
+                .any(|selected_dir| ProjectDirMatcher::new(selected_dir).matches(&project.root_dir))
+        })
+        .map(|project| {
+            pacquet_workspace::importer_id_from_root_dir(
+                &workspace_root,
+                &project.root_dir,
+            )
         })
         .collect::<HashSet<_>>()
 });
 ...
-let selected_dirs =
-    selected_dirs.iter().map(|dir| pacquet_fs::lexical_normalize(dir)).collect::<HashSet<_>>();
+let selected_dir_matchers =
+    selected_dirs.iter().map(|dir| ProjectDirMatcher::new(dir)).collect::<Vec<_>>();
 let mut inputs = project_manifests
     .iter()
     .filter(|(project_dir, _)| {
-        selected_dirs.contains(&pacquet_fs::lexical_normalize(project_dir))
+        selected_dir_matchers.iter().any(|matcher| matcher.matches(project_dir))
     })
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a valid edge case regarding canonical paths which could break filtered installs, but its implementation introduces a performance penalty by calling ProjectDirMatcher::new (which does file IO) inside a tight loop instead of pre-computing the matchers.

Medium

@zkochan
zkochan force-pushed the fix/pacquet-install-filters branch from 2066913 to 5ca0015 Compare July 17, 2026 18:05
Comment thread pnpm/crates/pnpr-client/src/lib.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5ca0015

@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 `@pnpm/crates/cli/src/cli_args/sbom.rs`:
- Around line 391-392: Validate each importer ID before passing it to
importer_root_dir in the SBOM manifest paths around the visible
safe_read_package_json_from_dir call and its corresponding occurrences. Reject
absolute paths and traversal segments such as “..”, and skip or safely handle
invalid IDs before reading package.json, while preserving existing behavior for
valid importer IDs.

In `@pnpm/crates/cli/src/cli_args/update.rs`:
- Around line 181-190: Centralize the --workspace validation and canonical
unsupported-error message used by run_selected, run, and run_global. Update
run_selected to call the shared validation helper instead of constructing its
own miette error, preserving identical user-visible text across all update
paths.
🪄 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: bfe06573-855d-4c75-a214-fb07c7c1e90e

📥 Commits

Reviewing files that changed from the base of the PR and between 2066913 and 5ca0015.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (75)
  • .changeset/pacquet-install-filters.md
  • .changeset/pnpr-workspace-identity.md
  • pnpm/crates/cli/src/cli_args/add.rs
  • pnpm/crates/cli/src/cli_args/audit.rs
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/cli/src/cli_args/dispatch_install.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/fetch.rs
  • pnpm/crates/cli/src/cli_args/import.rs
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/cli/src/cli_args/link.rs
  • pnpm/crates/cli/src/cli_args/outdated.rs
  • pnpm/crates/cli/src/cli_args/outdated/tests.rs
  • pnpm/crates/cli/src/cli_args/pipelines.rs
  • pnpm/crates/cli/src/cli_args/prune.rs
  • pnpm/crates/cli/src/cli_args/rebuild.rs
  • pnpm/crates/cli/src/cli_args/recursive.rs
  • pnpm/crates/cli/src/cli_args/remove.rs
  • pnpm/crates/cli/src/cli_args/sbom.rs
  • pnpm/crates/cli/src/cli_args/unlink.rs
  • pnpm/crates/cli/src/cli_args/update.rs
  • pnpm/crates/cli/src/cli_args/update_interactive.rs
  • pnpm/crates/cli/src/cli_args/update_interactive/tests.rs
  • pnpm/crates/cli/src/cli_args/why.rs
  • pnpm/crates/cli/src/state.rs
  • pnpm/crates/cli/src/state/tests.rs
  • pnpm/crates/cli/tests/deploy.rs
  • pnpm/crates/cli/tests/global.rs
  • pnpm/crates/cli/tests/install_filters.rs
  • pnpm/crates/cli/tests/outdated.rs
  • pnpm/crates/cli/tests/pnpr_install.rs
  • pnpm/crates/cli/tests/prune.rs
  • pnpm/crates/cli/tests/sbom.rs
  • pnpm/crates/cli/tests/why.rs
  • pnpm/crates/lockfile-preferred-versions/src/lib.rs
  • pnpm/crates/lockfile-preferred-versions/src/tests.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/current_lockfile.rs
  • pnpm/crates/package-manager/src/current_lockfile/tests.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm/crates/package-manager/src/install_frozen_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/tests.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install.rs
  • pnpm/crates/package-manager/src/prune_direct_deps.rs
  • pnpm/crates/package-manager/src/prune_direct_deps/tests.rs
  • pnpm/crates/package-manager/src/remove.rs
  • pnpm/crates/package-manager/src/remove/tests.rs
  • pnpm/crates/package-manager/src/symlink_direct_dependencies.rs
  • pnpm/crates/package-manager/src/update.rs
  • pnpm/crates/package-manager/src/update/tests.rs
  • pnpm/crates/pnpr-client/src/lib.rs
  • pnpm/crates/pnpr-client/tests/integration.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts
  • pnpr/client/package.json
  • pnpr/client/src/index.ts
  • pnpr/client/src/resolveViaPnprServer.ts
  • pnpr/client/test/resolveViaPnprServer.test.ts
  • pnpr/client/test/tsconfig.json
  • pnpr/crates/pnpr/src/resolver.rs
  • pnpr/crates/pnpr/src/resolver/protocol.rs
  • pnpr/crates/pnpr/src/resolver/resolve.rs
  • pnpr/crates/pnpr/src/resolver/resolve/tests.rs
  • pnpr/crates/pnpr/src/resolver/tests.rs
🚧 Files skipped from review as they are similar to previous changes (63)
  • .changeset/pacquet-install-filters.md
  • .changeset/pnpr-workspace-identity.md
  • pnpr/client/test/tsconfig.json
  • pnpr/client/src/index.ts
  • pnpm/crates/cli/src/cli_args/unlink.rs
  • pnpm/crates/cli/src/cli_args/recursive.rs
  • pnpm/crates/cli/src/state/tests.rs
  • pnpm/crates/cli/src/cli_args/rebuild.rs
  • pnpm/crates/cli/src/state.rs
  • pnpm/crates/cli/src/cli_args/import.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs
  • pnpm/crates/package-manager/src/prune_direct_deps.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpr/crates/pnpr/src/resolver/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/tests.rs
  • pnpm/crates/cli/tests/outdated.rs
  • pnpm/crates/package-manager/src/symlink_direct_dependencies.rs
  • pnpm/crates/cli/tests/prune.rs
  • pnpm/crates/cli/src/cli_args/outdated/tests.rs
  • pnpm/crates/cli/src/cli_args/update_interactive/tests.rs
  • pnpm/crates/cli/src/cli_args/link.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/tests/deploy.rs
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/package-manager/src/remove/tests.rs
  • pnpm/crates/cli/src/cli_args/update_interactive.rs
  • pnpr/client/src/resolveViaPnprServer.ts
  • pnpm/crates/pnpr-client/tests/integration.rs
  • pnpr/crates/pnpr/src/resolver.rs
  • pnpm/crates/cli/src/cli_args/why.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/prune_direct_deps/tests.rs
  • pnpm/crates/package-manager/src/update/tests.rs
  • pnpr/crates/pnpr/src/resolver/protocol.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/cli/src/cli_args/dispatch_install.rs
  • pnpm/crates/cli/src/cli_args/fetch.rs
  • pnpm/crates/cli/src/cli_args/outdated.rs
  • pnpm/crates/package-manager/src/remove.rs
  • pnpm/crates/cli/tests/sbom.rs
  • pnpm/crates/package-manager/src/install_frozen_lockfile.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/tests.rs
  • pnpm/crates/lockfile-preferred-versions/src/lib.rs
  • pnpm/crates/cli/tests/pnpr_install.rs
  • pnpr/crates/pnpr/src/resolver/resolve.rs
  • pnpm/crates/cli/src/cli_args/add.rs
  • pnpm11/installing/deps-installer/test/install/pnprWorkspaceMetadata.ts
  • pnpm/crates/cli/src/cli_args/audit.rs
  • pnpm/crates/pnpr-client/src/lib.rs
  • pnpm/crates/cli/tests/why.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/cli/tests/install_filters.rs
  • pnpm/crates/package-manager/src/current_lockfile.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpr/crates/pnpr/src/resolver/resolve/tests.rs
  • pnpm/crates/package-manager/src/update.rs
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/package-manager/src/current_lockfile/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install.rs

Comment thread pnpm/crates/cli/src/cli_args/sbom.rs Resolved
Comment thread pnpm/crates/cli/src/cli_args/update.rs Resolved
Comment thread pnpm/crates/cli/src/cli_args/sbom.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

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

…le merge

A dependency-free workspace project is present-but-empty in a resolved
lockfile, not absent: pnpm's `pruneLockfile` records it as
`{ specifiers: {} }` and the pnpr resolver returns every requested importer.
So a full-workspace `merge_filtered_wanted_lockfile` finds its empty
snapshot and merges it without a `MissingImporter` error — that error is
reserved for an importer genuinely absent from the fresh lockfile (a partial
resolution). Add a regression test for the dep-free case and correct the
pnpr-client comment that wrongly claimed dep-free importers are omitted.
@zkochan
zkochan force-pushed the fix/pacquet-install-filters branch from 6439feb to e0e361c Compare July 18, 2026 10:08
@qodo-code-review

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13030
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,626.71 ms
(-9.85%)Baseline: 2,913.65 ms
3,496.38 ms
(75.13%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,809.33 ms
(-13.05%)Baseline: 2,080.87 ms
2,497.04 ms
(72.46%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
522.94 ms
(-26.44%)Baseline: 710.87 ms
853.05 ms
(61.30%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
305.99 ms
(-28.32%)Baseline: 426.87 ms
512.25 ms
(59.74%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,328.76 ms
(-12.12%)Baseline: 2,650.05 ms
3,180.06 ms
(73.23%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,421.55 ms
(-6.97%)Baseline: 4,752.75 ms
5,703.29 ms
(77.53%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
229.95 ms
(-21.91%)Baseline: 294.49 ms
353.38 ms
(65.07%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13030
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,380.36 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
283.71 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
270.61 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
81.08 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,339.09 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,450.61 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
245.49 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 9657c88 into pnpm:main Jul 18, 2026
34 of 35 checks passed
zkochan added a commit that referenced this pull request Jul 18, 2026
…13125)

The Rust render_ledger wrote an empty intent list as a bare 'intents:'
key, which parses as YAML null - a shape neither stack's ledger reader
accepted. The 11.14.0 / 12.0.0-alpha.14 release run (#13113)
re-rendered the committed ledger through that path, turning the
[email protected] entry's 'intents: []' into the bare form, and
every 'pnpm version -r' after it failed with
ERR_PNPM_INVALID_VERSIONING_LEDGER.

- Render empty intent lists as '[]' in both ledger entry shapes,
  matching the TypeScript side's yaml.stringify byte for byte.
- Accept null where a list belongs when reading, in both stacks: a
  bare entry key or bare 'intents:' key now reads as an empty list,
  so ledgers written before this fix stay readable.
- Repair the committed .changeset/ledger.yaml entry.
- Drop the stale meta_only field from a package-manager PeerDep test
  fixture (#13030 added it while #13120 removed the
  field, breaking main's --all-targets build).
zkochan added a commit that referenced this pull request Jul 19, 2026
…uites

Stage 2 of pnpm/plans/TEST_PORTING.md (#13146).

Add crates/cli/tests/multiple_importers.rs covering the open Support
Workspaces items: subset installs preserving other importers'
materialization, stale current-lockfile importers, filtered
current-lockfile contents, headless-vs-resolve decisions for link:,
workspace:, and unlinked workspace packages, subdependency-from-workspace
(linkWorkspacePackages: deep and a workspace:* override), the
deps-restorer workspace cases, workspace bin links, and the
shared-lockfile custom virtualStoreDir round-trip.

Promote the three --filter known_failures stubs to real tests now that
filtered installs exist (#13030): the selected-projects hoist
pair in hoist.rs and the workspace-subset optional-dependency skip in
optional_dependencies.rs. Port the hoisted-linker workspace-subset item
(multipleImporters.ts:87) and the hoisted workspace lifecycle-script
case (lifecycleScripts.ts:579, frozen path; fresh-path scripts stay
blocked on #11870).

Stub the not-yet-implemented boundaries (publishConfig.directory
linking, buildIndex-ordered project scripts, sharedWorkspaceLockfile:
false) and two divergences that need a cross-stack decision: pacquet's
subset closure deep-installs importer-level link targets where upstream
keeps them shallow, and the hoisted workspace layout duplicates the
root-winning version under consumer projects.

Move the FilteredWorkspace fixture from install_filters.rs into the
shared tests/_utils.rs as WorkspaceFixture so the new suite reuses it.
zkochan added a commit that referenced this pull request Jul 19, 2026
…uites (#13152)

Stage 2 of pnpm/plans/TEST_PORTING.md (#13146): port the workspace
subset install (--filter) and multi-importer suites.

Add crates/cli/tests/multiple_importers.rs covering the open "Support
Workspaces" items (subset preservation, stale current-lockfile importers,
filtered current-lockfile contents, headless-vs-resolve decisions,
subdependency-from-workspace, workspace bin links, custom virtualStoreDir),
promote the three --filter known_failures stubs in hoist.rs and
optional_dependencies.rs to real tests now that filtered installs exist
(#13030), and port the hoisted-linker workspace-subset and
workspace lifecycle-script cases.

Fix a reporter parity gap the ports exposed: the TypeScript CLI announces
"Lockfile is up to date, resolution step is skipped" whenever the headless
installer is entered (cold materialization and subset installs included) and
"Importing packages to virtual store" under ignorePackageManifest; pacquet
only announced the no-op short-circuit. The frozen materialization branch
now emits the same logs.

Record two behavioral divergences the ports surfaced as known_failures
stubs pending a cross-stack decision: pacquet's subset closure deep-installs
importer-level link targets where upstream keeps them shallow, and pacquet's
hoisted workspace layout duplicates the root-winning version under consumer
projects. Not-yet-implemented boundaries (publishConfig.directory linking,
buildIndex-ordered project scripts, sharedWorkspaceLockfile: false) are
stubbed too.

The FilteredWorkspace fixture moves from install_filters.rs into the shared
tests/_utils/mod.rs as WorkspaceFixture so the new suite reuses it.
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.

3 participants