Skip to content

fix(deps-restorer): re-import a slot when a custom integrity changes - #15673

Merged
zkochan merged 2 commits into
pnpm:mainfrom
aaaxn:fix/custom-resolution-integrity-reimport
Sep 25, 2026
Merged

zkochan merged 2 commits into
pnpm:mainfrom
aaaxn:fix/custom-resolution-integrity-reimport

Conversation

@aaaxn

@aaaxn aaaxn commented Sep 25, 2026 •

Copy link
Copy Markdown

Summary

Closes #15670

A custom resolver can return a new integrity for the same name@version, and shouldRefreshResolution lets it do so on a later install. pnpm 12 wrote the new integrity to the lockfile but never called the custom fetcher. It kept the old files in node_modules and printed "Already up to date". pnpm 11 re-fetches in the same situation.

Root cause. LockfileResolution::integrity() returns None for Custom resolutions, because their integrity belongs to the custom fetcher rather than to the built-in verification. integrity_equal in deps-restorer/src/create_virtual_store/cache_keys.rs compared integrities only through that accessor. Two checks decide whether an existing virtual-store slot can be reused: current_entry_unchanged (plan pass) and package_content_changed (link pass). Both call integrity_equal, so both saw None == None and kept the stale slot.

Fix. integrity_equal now also compares the integrity field a custom resolution records. Built-in verification still treats custom integrity as opaque, and LockfileResolution::integrity() is unchanged. This matches pnpm 11's isIntegrityEqual (pnpm11/deps/graph-builder/src/lockfileToDepGraph.ts), which reads the integrity field of any resolution.

This is a v12-only bug, so there is no v11 change.

Not covered here:

  • With enableGlobalVirtualStore: true, the stale slot is still kept. The GVS slot path comes from create_full_pkg_id (virtual_store_layout/graph_hash.rs), which falls back to the bare package id when integrity() is None. A changed custom integrity therefore maps to the same slot. pnpm 11's createFullPkgId uses the custom integrity there, so this is a separate parity gap. Fixing it changes on-disk GVS slot paths, so I kept it out of this PR.
  • The issue also mentions that pnpm 12 skips shouldRefreshResolution silently under the default optimisticRepeatInstall: true, where pnpm 11 warns. That is a separate change and is not included.

Testing

  • Reproduced with the script from the issue: released 12.7.0 leaves V1 after the second install, and 11.28.0 installs V2. A debug build of this branch installs V2.
  • New e2e test custom_resolvers::changed_custom_resolution_integrity_re_imports_the_package mirrors the issue's script. It fails on main (left: "V1", right: "V2") and passes with the fix.
  • New unit test integrity_equal_compares_custom_resolution_integrities. It fails without the fix and passes with it.
  • pnpm test:rust-affected: 5254 passed. pnpm check:rust, pnpm lint:rust, typos, and the pinned rustfmt all pass. cargo dylint was not run locally.

This PR was written with the help of an AI agent (Claude Code).

Squash Commit Body

A custom resolver can hand back a new integrity for the same
name@version, and `shouldRefreshResolution` lets it do so on a later
install. pnpm wrote the new integrity to the lockfile but kept the old
files in node_modules and reported "Already up to date". Later installs,
frozen ones included, then saw nothing to fix.

`LockfileResolution::integrity` returns `None` for custom resolutions,
because their integrity belongs to the custom fetcher rather than to
the built-in verification. `integrity_equal` compared integrities only
through that accessor, so both the plan-time check
(`current_entry_unchanged`) and the link-time check
(`package_content_changed`) saw `None == None` and kept the slot.

`integrity_equal` now also compares the `integrity` field a custom
resolution records. Built-in verification still treats it as opaque.
This matches pnpm v11, whose `isIntegrityEqual` reads the `integrity`
field of any resolution.

Closes pnpm/pnpm#15670

Checklist

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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Re-running pnpm install now re-fetches a package when a custom resolver reports a changed integrity value, updating the package files in node_modules to match. When enableGlobalVirtualStore is enabled, the previous files are retained.
  • Tests
    • Added coverage confirming that changed integrity values from custom resolvers trigger a package re-import on a subsequent install.

A custom resolver can hand back a new integrity for the same
name@version, and `shouldRefreshResolution` lets it do so on a later
install. pnpm wrote the new integrity to the lockfile but kept the old
files in node_modules and reported "Already up to date". Later installs,
frozen ones included, then saw nothing to fix.

`LockfileResolution::integrity` returns `None` for custom resolutions,
because their integrity belongs to the custom fetcher rather than to
the built-in verification. `integrity_equal` compared integrities only
through that accessor, so both the plan-time check
(`current_entry_unchanged`) and the link-time check
(`package_content_changed`) saw `None == None` and kept the slot.

`integrity_equal` now also compares the `integrity` field a custom
resolution records. Built-in verification still treats it as opaque.
This matches pnpm v11, whose `isIntegrityEqual` reads the `integrity`
field of any resolution.

Closes pnpm#15670
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: 25973a15-d043-40c2-8a5c-02b461a211d9

📥 Commits

Reviewing files that changed from the base of the PR and between f6d3d45 and 4405db4.

📒 Files selected for processing (1)
  • .changeset/custom-resolution-integrity-reimports.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/custom-resolution-integrity-reimports.md

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


📝 Walkthrough

Walkthrough

The install reuse check now compares custom resolution integrity values. Unit and regression tests cover matching and changed values, including re-importing an updated package on a repeat install.

Changes

Custom resolution integrity

Layer / File(s) Summary
Integrity comparison and unit coverage
pnpm/crates/deps-restorer/src/create_virtual_store/cache_keys.rs, pnpm/crates/deps-restorer/src/create_virtual_store/tests/integrity.rs
The reuse check compares standard resolution integrity and custom extra.integrity values. Unit tests cover matching and differing custom integrity values.
Repeat-install regression coverage and changeset
pnpm/crates/cli/tests/suite/custom_resolvers.rs, .changeset/custom-resolution-integrity-reimports.md
The regression test changes the served tarball payload and verifies that a repeat install updates the installed payload. The changeset describes the custom-resolution integrity fix.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
[#15670] Re-fetch and re-import a custom resolution when its integrity changes ✅

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to 4405d

Changing a custom resolution’s integrity is covered by the re-import regression test. No merge-blocking issue is identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f6d3d

The change makes repeat installs replace stale custom-resolver packages in the ordinary virtual store. It does not give custom resolvers new authority, but the global virtual store remains outside the fix, and failure recovery is not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed decision affects packages installed through a configured custom resolver in the ordinary virtual store. Shared global-store stale reuse is a broader existing exposure, but this change does not extend its slot-identity rule or resolver authority.

Trust Boundaries and Controls

  • observed — Built-in integrity verification deliberately excludes custom resolutions. Comparing their recorded integrity for reuse does not turn that value into a built-in verification control or bypass one.

Resilience and Maintainability Implications

  • observed — Interrupted imports bypass the clone-cache path, and shared imports compare or repair existing files. The current-lockfile completion assumption is documented in the reuse check, but its persistence ordering was not verified here.

Hardening Proposals

  • proposed — Address the separate global-store identity gap using a custom-fetcher-compatible provenance rule, without treating an opaque integrity value as built-in verification; cover changed content with global-store reuse enabled.
  • proposed — Verify that a new current-lockfile record cannot become durable before the replacement import and child links complete, including failure and interruption paths.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@codecov-commenter

codecov-commenter commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.92%. Comparing base (df0fb07) to head (4405db4).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15673   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files        1456     1456           
  Lines      196611   196617    +6     
=======================================
+ Hits       180731   180737    +6     
  Misses      15880    15880           

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

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

@github-actions

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2463.30 ms 2488.29 ms 1.0% 123.16 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1468.57 ms 1489.51 ms 1.4% 73.43 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 225.87 ms 218.09 ms -3.4% 11.29 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 359.81 ms 356.12 ms -1.0% 17.99 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 9.77 ms 10.36 ms 6.0% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.09 ms 8.63 ms -14.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 10.63 ms 10.48 ms -1.4% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 10.94 ms 10.35 ms -5.4% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 3184.82 ms 2821.66 ms -11.4% 159.24 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1425.77 ms 1725.87 ms 21.0% 71.29 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pacquet 601.00 ms 636.53 ms 5.9% 30.05 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pnpr 341.63 ms 325.37 ms -4.8% 17.08 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1800.83 ms 1693.28 ms -6.0% 90.04 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 297.33 ms 328.99 ms 10.6% 14.87 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pacquet 218.88 ms 240.75 ms 10.0% 10.94 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 104.79 ms 96.53 ms -7.9% 5.24 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 692.91 ms 611.15 ms -11.8% 34.65 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 238.60 ms 235.17 ms -1.4% 11.93 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4530.63 ms 4482.74 ms -1.1% 226.53 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3532.89 ms 3526.71 ms -0.2% 176.64 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 214.98 ms 170.26 ms -20.8% 10.75 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 137.70 ms 143.70 ms 4.4% 6.88 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: f6d3d45d0c45

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.476 ± 0.157 2.273 2.695 1.65 ± 0.20
pacquet@main 2.453 ± 0.129 2.304 2.710 1.64 ± 0.19
pnpr@HEAD 1.507 ± 0.096 1.367 1.637 1.01 ± 0.12
pnpr@main 1.499 ± 0.152 1.337 1.691 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.47593164608,
      "stddev": 0.15743758617484147,
      "median": 2.4882894115800003,
      "user": 1.4003424,
      "system": 1.4456324399999998,
      "min": 2.2727878055799997,
      "max": 2.69476552158
    },
    {
      "command": "pacquet@main",
      "mean": 2.45346105308,
      "stddev": 0.12867001855316385,
      "median": 2.46329815458,
      "user": 1.5031510999999997,
      "system": 1.5332633400000002,
      "min": 2.30362124458,
      "max": 2.71045100958
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.50679253168,
      "stddev": 0.09599492964152721,
      "median": 1.48950752408,
      "user": 1.4571123,
      "system": 1.49324354,
      "min": 1.36706423258,
      "max": 1.63746133858
    },
    {
      "command": "pnpr@main",
      "mean": 1.49898522368,
      "stddev": 0.15184624548608183,
      "median": 1.46856847908,
      "user": 1.3829278999999997,
      "system": 1.40025954,
      "min": 1.3366687315799999,
      "max": 1.6910371195799998
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 221.7 ± 20.5 201.3 267.2 1.00
pacquet@main 227.5 ± 9.7 217.4 246.2 1.03 ± 0.10
pnpr@HEAD 343.0 ± 40.1 258.4 385.2 1.55 ± 0.23
pnpr@main 359.9 ± 17.1 333.8 398.6 1.62 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.22171916090000005,
      "stddev": 0.02049964929928917,
      "median": 0.2180909286,
      "user": 0.24036648,
      "system": 0.51755358,
      "min": 0.2013234691,
      "max": 0.26724183510000005
    },
    {
      "command": "pacquet@main",
      "mean": 0.2274901169,
      "stddev": 0.009734402646047849,
      "median": 0.22586743010000002,
      "user": 0.23051648,
      "system": 0.5393306800000001,
      "min": 0.2173993881,
      "max": 0.24621337010000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34302989790000005,
      "stddev": 0.04014537168053926,
      "median": 0.35612102060000006,
      "user": 0.36624638,
      "system": 0.7076221799999999,
      "min": 0.25835834010000003,
      "max": 0.38520113810000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.35993734800000005,
      "stddev": 0.017087998241562992,
      "median": 0.3598063951,
      "user": 0.39940237999999995,
      "system": 0.73502678,
      "min": 0.33381561810000004,
      "max": 0.3985536311
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.6 ± 1.7 7.9 17.0 1.19 ± 0.24
pacquet@main 9.8 ± 1.2 7.7 13.5 1.10 ± 0.19
pnpr@HEAD 8.9 ± 1.0 7.4 15.6 1.00
pnpr@main 10.3 ± 1.2 7.9 15.0 1.16 ± 0.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010614091483565886,
      "stddev": 0.0017328974364114963,
      "median": 0.01036340422,
      "user": 0.005988577674418605,
      "system": 0.005184891937984494,
      "min": 0.00793383772,
      "max": 0.01695212972
    },
    {
      "command": "pacquet@main",
      "mean": 0.009789558301280787,
      "stddev": 0.001214419852601643,
      "median": 0.00977416272,
      "user": 0.005547926896551724,
      "system": 0.004783954285714284,
      "min": 0.00769009072,
      "max": 0.01354642472
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008890096634590743,
      "stddev": 0.001033777729904503,
      "median": 0.00862711872,
      "user": 0.004852801850533807,
      "system": 0.004514296797153023,
      "min": 0.007447243720000001,
      "max": 0.01560504072
    },
    {
      "command": "pnpr@main",
      "mean": 0.01028043445400674,
      "stddev": 0.0012450765178239208,
      "median": 0.01008824672,
      "user": 0.00603774693602694,
      "system": 0.004803269225589224,
      "min": 0.00788582972,
      "max": 0.01496150972
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.5 ± 1.0 8.1 15.4 1.01 ± 0.12
pacquet@main 10.7 ± 0.6 9.4 13.1 1.02 ± 0.09
pnpr@HEAD 10.4 ± 0.8 8.4 13.5 1.00
pnpr@main 11.0 ± 0.9 8.7 14.4 1.06 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.01052636826567901,
      "stddev": 0.0010383097635110878,
      "median": 0.01047955292,
      "user": 0.005920888395061728,
      "system": 0.005128559506172836,
      "min": 0.00810435192,
      "max": 0.015426117920000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.010657260535740745,
      "stddev": 0.0005789833398250528,
      "median": 0.010629198420000001,
      "user": 0.006073831296296293,
      "system": 0.005135232777777776,
      "min": 0.00939281392,
      "max": 0.013060970920000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.010425692120000003,
      "stddev": 0.00077044913335065,
      "median": 0.01035063692,
      "user": 0.006244731111111108,
      "system": 0.004716262577777779,
      "min": 0.00841833992,
      "max": 0.013485694920000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.011001978490212769,
      "stddev": 0.0009436775983935819,
      "median": 0.01094284992,
      "user": 0.0061096046808510615,
      "system": 0.00544823404255319,
      "min": 0.00871755992,
      "max": 0.014427210920000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.895 ± 0.255 2.611 3.288 1.95 ± 0.23
pacquet@main 3.208 ± 0.111 3.040 3.417 2.16 ± 0.19
pnpr@HEAD 1.668 ± 0.141 1.418 1.840 1.12 ± 0.13
pnpr@main 1.488 ± 0.121 1.379 1.704 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.89534281482,
      "stddev": 0.25502300442246845,
      "median": 2.8216612599200004,
      "user": 2.8625346799999996,
      "system": 2.21297166,
      "min": 2.6110126169200005,
      "max": 3.28782792392
    },
    {
      "command": "pacquet@main",
      "mean": 3.20813990762,
      "stddev": 0.11114603786633546,
      "median": 3.18482101492,
      "user": 3.5281058799999996,
      "system": 2.65120646,
      "min": 3.0402092039200004,
      "max": 3.4167091279200004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.66786048262,
      "stddev": 0.14121851508103223,
      "median": 1.72587008042,
      "user": 1.50002698,
      "system": 1.5715554600000001,
      "min": 1.41754279992,
      "max": 1.83972347592
    },
    {
      "command": "pnpr@main",
      "mean": 1.48849226132,
      "stddev": 0.12107917252994159,
      "median": 1.4257674654199999,
      "user": 1.0751513799999999,
      "system": 1.19911606,
      "min": 1.37901754692,
      "max": 1.70369729692
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 656.3 ± 66.7 572.9 769.2 1.98 ± 0.23
pacquet@main 604.1 ± 86.1 500.0 725.3 1.82 ± 0.28
pnpr@HEAD 331.3 ± 19.6 307.9 373.1 1.00
pnpr@main 344.8 ± 22.7 310.5 391.8 1.04 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6562939755000001,
      "stddev": 0.06671645314953781,
      "median": 0.6365347633,
      "user": 0.9800030600000001,
      "system": 1.0059826199999997,
      "min": 0.5729091858,
      "max": 0.7692332188000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.6041276543,
      "stddev": 0.08608865658540452,
      "median": 0.6010006218,
      "user": 0.8997422599999998,
      "system": 0.9376969199999999,
      "min": 0.5000100468,
      "max": 0.7253271138
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3313471539,
      "stddev": 0.019579300220213026,
      "median": 0.3253681708,
      "user": 0.29505386,
      "system": 0.64451112,
      "min": 0.3078675278,
      "max": 0.3731241398
    },
    {
      "command": "pnpr@main",
      "mean": 0.34483286840000005,
      "stddev": 0.022695911265141127,
      "median": 0.3416302603,
      "user": 0.29486635999999994,
      "system": 0.65047452,
      "min": 0.3105448118,
      "max": 0.3917912448
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.739 ± 0.115 1.637 1.942 5.83 ± 0.48
pacquet@main 1.810 ± 0.110 1.678 2.035 6.07 ± 0.47
pnpr@HEAD 0.334 ± 0.041 0.301 0.439 1.12 ± 0.15
pnpr@main 0.298 ± 0.015 0.280 0.327 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7389878712200002,
      "stddev": 0.11498501036237171,
      "median": 1.6932819328200002,
      "user": 1.11366962,
      "system": 0.9606422199999999,
      "min": 1.63697062532,
      "max": 1.94171396332
    },
    {
      "command": "pacquet@main",
      "mean": 1.8101772414200004,
      "stddev": 0.10990604954887855,
      "median": 1.8008288273200002,
      "user": 1.17805692,
      "system": 0.9895770199999999,
      "min": 1.67764354132,
      "max": 2.0351244633200003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33425034062000003,
      "stddev": 0.041331785797748,
      "median": 0.32899435382,
      "user": 0.27807272,
      "system": 0.61462892,
      "min": 0.30079315632000003,
      "max": 0.43851801632000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.29803658772,
      "stddev": 0.014677028298495593,
      "median": 0.29733479681999997,
      "user": 0.24441671999999998,
      "system": 0.5595847199999999,
      "min": 0.27979573032,
      "max": 0.32675733732
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 234.8 ± 22.8 201.0 274.2 2.42 ± 0.25
pacquet@main 222.3 ± 18.3 202.8 256.0 2.29 ± 0.21
pnpr@HEAD 97.0 ± 3.9 90.1 104.5 1.00
pnpr@main 103.4 ± 7.8 89.7 116.4 1.07 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2347541271942857,
      "stddev": 0.022763872265975475,
      "median": 0.24075271148,
      "user": 0.2485412828571429,
      "system": 0.07679297142857142,
      "min": 0.20095937348,
      "max": 0.27422745548
    },
    {
      "command": "pacquet@main",
      "mean": 0.22228008647999997,
      "stddev": 0.018319625926412158,
      "median": 0.21887731548,
      "user": 0.22803579384615386,
      "system": 0.07198424615384615,
      "min": 0.20279351348000002,
      "max": 0.25599122448
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09695099728645162,
      "stddev": 0.0038547967405248183,
      "median": 0.09653065048,
      "user": 0.035296962580645165,
      "system": 0.017557238709677417,
      "min": 0.09009348348,
      "max": 0.10453351248000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.10337963893161292,
      "stddev": 0.007821541807260437,
      "median": 0.10479179048,
      "user": 0.04150322064516129,
      "system": 0.018980322580645165,
      "min": 0.08973595848,
      "max": 0.11638032948
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 646.7 ± 85.0 535.7 791.1 1.00
pacquet@main 687.7 ± 37.3 617.7 731.7 1.06 ± 0.15
pnpm@HEAD 3159.3 ± 383.5 2779.2 4102.1 4.88 ± 0.87
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6467494778955555,
      "stddev": 0.08497054799196817,
      "median": 0.61114858934,
      "user": 0.6558067244444444,
      "system": 0.15298904666666666,
      "min": 0.5357267733400001,
      "max": 0.7911471303400001
    },
    {
      "command": "pacquet@main",
      "mean": 0.6876953420066667,
      "stddev": 0.03728519419517316,
      "median": 0.6929067613400001,
      "user": 0.7065830577777777,
      "system": 0.15151093555555553,
      "min": 0.61765180834,
      "max": 0.7316962193400001
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.159302889784445,
      "stddev": 0.38345127161637843,
      "median": 3.0500649613400004,
      "user": 4.916583946666666,
      "system": 0.23021137999999997,
      "min": 2.77917741734,
      "max": 4.102057680340001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 237.6 ± 10.3 219.5 251.6 1.00
pacquet@main 239.8 ± 10.4 221.8 257.6 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2376362867654545,
      "stddev": 0.010255119625441199,
      "median": 0.23516609022,
      "user": 0.20129270363636367,
      "system": 0.0878165,
      "min": 0.21949378022000002,
      "max": 0.25161624122
    },
    {
      "command": "pacquet@main",
      "mean": 0.23983292598923084,
      "stddev": 0.010400983447667224,
      "median": 0.23859931622000002,
      "user": 0.20425626307692304,
      "system": 0.09395573076923076,
      "min": 0.22181793822,
      "max": 0.25761175522
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.550 ± 0.142 4.415 4.815 1.28 ± 0.06
pacquet@main 4.611 ± 0.183 4.424 4.876 1.30 ± 0.07
pnpr@HEAD 3.562 ± 0.136 3.432 3.780 1.00 ± 0.05
pnpr@main 3.549 ± 0.112 3.420 3.817 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.55022733812,
      "stddev": 0.14194118154579885,
      "median": 4.4827424446199995,
      "user": 1.7902799799999998,
      "system": 2.03977074,
      "min": 4.41547188662,
      "max": 4.81545035062
    },
    {
      "command": "pacquet@main",
      "mean": 4.610536171520001,
      "stddev": 0.18302780015922737,
      "median": 4.53062767462,
      "user": 1.8445445799999998,
      "system": 1.9961910399999998,
      "min": 4.42430444662,
      "max": 4.87554091962
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.56187730152,
      "stddev": 0.13607828162567098,
      "median": 3.52671361612,
      "user": 1.67903618,
      "system": 1.8228559399999995,
      "min": 3.43179836362,
      "max": 3.77983017262
    },
    {
      "command": "pnpr@main",
      "mean": 3.5494603851199997,
      "stddev": 0.11192686536746942,
      "median": 3.5328863131199997,
      "user": 1.7116444799999997,
      "system": 1.8518724399999997,
      "min": 3.41955440062,
      "max": 3.81700932162
    }
  ]
}

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

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 170.3 ± 29.1 126.9 227.7 1.23 ± 0.22
pacquet@main 222.0 ± 19.7 199.9 254.0 1.60 ± 0.17
pnpr@HEAD 139.8 ± 8.8 122.8 149.9 1.01 ± 0.08
pnpr@main 138.5 ± 7.5 125.9 151.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17029209431111111,
      "stddev": 0.02908784710969632,
      "median": 0.17026499170000003,
      "user": 0.2133881377777777,
      "system": 0.16307329999999998,
      "min": 0.12690152970000002,
      "max": 0.22771606770000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.22196614070000004,
      "stddev": 0.019736583113306398,
      "median": 0.21498160270000002,
      "user": 0.25862606,
      "system": 0.2217866,
      "min": 0.19991252470000004,
      "max": 0.25399095870000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.13981786686666667,
      "stddev": 0.008811133611877853,
      "median": 0.14369580820000002,
      "user": 0.16955991555555555,
      "system": 0.13726163333333333,
      "min": 0.12282096370000001,
      "max": 0.14985050470000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.13853861396315792,
      "stddev": 0.007527383915389166,
      "median": 0.1376956957,
      "user": 0.15576762315789475,
      "system": 0.13917703684210525,
      "min": 0.12592156470000002,
      "max": 0.15150388970000003
    }
  ]
}

@aaaxn
aaaxn marked this pull request as ready for review September 25, 2026 14:06
@aaaxn
aaaxn requested a review from zkochan as a code owner September 25, 2026 14:06
Copilot AI lite review requested due to automatic review settings September 25, 2026 14:06
@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 →

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Qualify the changeset to note that global virtual store mode remains unsupported.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Fixes pnpm v12 stale virtual-store slots when a custom resolver changes package integrity.

Changes:

  • Compare custom resolution integrities during slot reuse.
  • Add unit and end-to-end regression tests.
  • Add a pacquet patch changeset.
File Description
pnpm/​crates/​deps-restorer/​src/​create_virtual_store/​tests/​integrity.rs Adds unit coverage for custom integrity comparison.
pnpm/​crates/​deps-restorer/​src/​create_virtual_store/​cache_keys.rs Detects changed custom integrities.
pnpm/​crates/​cli/​tests/​suite/​custom_resolvers.rs Verifies re-fetching and re-importing end to end.
.changeset/​custom-resolution-integrity-reimports.md Documents the user-facing fix.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 25, 2026
Copilot AI review requested due to automatic review settings September 25, 2026 14:15

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (1)

@zkochan

zkochan commented Sep 25, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution

@zkochan
zkochan merged commit b161a97 into pnpm:main Sep 25, 2026
51 checks passed
@welcome

welcome Bot commented Sep 25, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

zkochan added a commit to TrevorBurnham/pnpm that referenced this pull request Sep 25, 2026
The global virtual store named a custom resolution's slot after the bare
package id, because create_full_pkg_id only read
LockfileResolution::integrity(), which is None for every custom
resolution. A custom resolver that records a new integrity for the same
name@version therefore kept its old slot, and node_modules kept the old
files under enableGlobalVirtualStore.

The slot id now uses the custom resolver's integrity string, or a hash of
the whole resolution when it has none, as pnpm 11's createFullPkgId does.
The side-effects dep graph shares the same helper, so its key for a custom
resolution with an integrity matches pnpm 11 too.

LockfileResolution::custom_integrity() replaces the private helper in
cache_keys.rs and the CustomResolution::integrity() accessor, so the
reuse check and both slot ids read the value the same way.

The changeset from pnpm#15673 said GVS installs still kept the old
files. It is not released yet, so it now covers both layouts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom resolution whose integrity changed is not re-fetched: lockfile updated, node_modules stale

4 participants