Skip to content

fix(resolving-npm-resolver): remember the release-age upgrade of a lowest-version mirror pick - #17036

Merged
zkochan merged 1 commit into
mainfrom
fix-release-age-upgrade-mark
Oct 17, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-release-age-upgrade-mark

Conversation

@zkochan

@zkochan zkochan commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Fourth step of pnpm/tasks#146 (Related to pnpm/tasks#146). Consolidating the minimumReleaseAge upgrade's follow-up work turned up a shipped v12 bug, so this PR is a fix.

Bug. The upgrade marks the document it settled on, so later picks of the same package don't ask for the full document again. That matters when the registry's full form is no more complete than its abbreviated one. Three call sites persisted and marked the upgrade, each in its own copy:

Call site Path Marked?
handle_cache_hit in-memory hit yes
fetch_and_pick → persist_release_age_upgrade registry fetch yes
PickState::upgraded_meta online lowest-version mirror read (resolutionMode: lowest-direct / time-based) no

So with minimumReleaseAge and a lowest-version direct pick, a registry whose metadata lacks a complete time map was asked for the full document once per pick of that package. The third copy came in with #15860 (12.8.0).

Fix. PickState::upgrade_for_release_age runs the upgrade, persists an upgraded document unless this is a dry run, and marks the document it returns. It matches v11's upgradeMetaForCache. All three callers use it and keep only their own caching rule. handle_cache_hit now takes the PickState in place of seven of its fields.

v11. Not affected. Every v11 path goes through upgradeMetaForCache, which marks.

Tests. published_by_upgrade_of_a_lowest_version_mirror_pick_is_remembered_across_picks runs two lowest-version picks over a warm abbreviated mirror. Before the fix it saw 2 full-document requests (Expected 1 request(s) ... but received 2), and now it sees 1. Removing the mark fails it, along with 2 existing release-age tests. All 625 tests of pnpm-resolving-npm-resolver pass.

Squash Commit Body

The release-age upgrade marks the document it settled on, so later picks
of the same package in this install do not ask for the full document
again. Three call sites persisted and marked the upgrade in their own
copies. The one behind the online lowest-version mirror read
(PickState::upgraded_meta, from pnpm/pnpm#15860) never marked. With
minimumReleaseAge and a lowest-direct or time-based resolution, a
registry whose metadata lacks a complete `time` map was asked for the
full document once per pick of the package.

PickState::upgrade_for_release_age now runs the upgrade, persists an
upgraded document unless this is a dry run, and marks the document it
returns, as v11's upgradeMetaForCache does. Every caller uses it.
handle_cache_hit takes the PickState in place of seven of its fields.

Part of pnpm/tasks#146.

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

🤖 Generated with Claude Code


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

Summary by CodeRabbit

  • Bug Fixes
    • Reduced repeated full-metadata requests for direct dependencies when minimumReleaseAge is set and resolutionMode is lowest-direct or time-based, including when registry metadata lacks publish times for some versions.

…west-version mirror pick

The release-age upgrade marks the document it settled on, so later picks
of the same package in this install do not ask for the full document
again. That matters when the full document is no more complete than the
abbreviated one.

Three call sites persisted the upgrade and marked it, each in its own
copy:
- handle_cache_hit
- fetch_and_pick's persist_release_age_upgrade
- PickState::upgraded_meta, used by the online lowest-version mirror read

The third copy never marked. With `minimumReleaseAge` and a lowest-direct
or time-based resolution, a registry whose metadata lacks a complete
`time` map was asked for the full document once per pick of the package.

PickState::upgrade_for_release_age now runs the upgrade, persists an
upgraded document unless this is a dry run, and marks the document it
returns. It matches v11's upgradeMetaForCache. Every caller uses it and
keeps only its own caching rule. handle_cache_hit takes the PickState in
place of seven of its fields.

The new test reproduces the extra request: two lowest-version picks over
a warm abbreviated mirror made two full-document requests. Removing the
mark now fails it, along with two existing release-age tests.

Part of pnpm/tasks#146.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dffd9963-ca2f-4365-9e33-8f9c8601ec82
📥 Commits

Reviewing files that changed from the base of the PR and between c79f475 and 06e5ed6.

📒 Files selected for processing: 5
  • .changeset/remember-lowest-direct-release-age-upgrade.md
  • pnpm/crates/resolving-npm-resolver/src/pick_package/cache_hit.rs
  • pnpm/crates/resolving-npm-resolver/src/pick_package/fetch_pick.rs
  • pnpm/crates/resolving-npm-resolver/src/pick_package/state.rs
  • pnpm/crates/resolving-npm-resolver/src/pick_package/tests/release_age.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The resolver centralizes release-age metadata upgrades in PickState, including mirror persistence and cache updates. Cache-hit and fetch-pick paths use this handling. A regression test checks that repeated lowest-version picks issue one full-metadata upgrade request when abbreviated metadata is in the mirror.

Changes: Release-age metadata upgrade

Layer / File(s) Summary
Centralize release-age upgrades
pnpm/crates/resolving-npm-resolver/src/pick_package/state.rs, pnpm/crates/resolving-npm-resolver/src/pick_package/fetch_pick.rs
PickState now returns an upgrade outcome and handles mirror persistence and checked-state updates. The fetch-pick path uses this handling.
Route cache hits through upgrade handling
pnpm/crates/resolving-npm-resolver/src/pick_package/state.rs, pnpm/crates/resolving-npm-resolver/src/pick_package/cache_hit.rs, pnpm/crates/resolving-npm-resolver/src/pick_package/tests/release_age.rs, .changeset/remember-lowest-direct-release-age-upgrade.md
Cache hits pass PickState to the upgrade handling. The regression test checks that two lowest-version picks trigger one full-metadata request. The changeset describes the behavior.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested labels: product: pacquet

Suggested reviewers: igor-2012-killer, charpeni

Merge Risk: ⚪ Minimal · up to 06e5e

This fixes repeated full-metadata requests under minimumReleaseAge with lowest-direct or time-based resolution, and a regression test covers it. No merge-blocking risk was identified.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.55%. Comparing base (c79f475) to head (06e5ed6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17036   +/-   ##
=======================================
  Coverage   92.55%   92.55%           
=======================================
  Files        1779     1779           
  Lines      228563   228504   -59     
=======================================
- Hits       211543   211501   -42     
+ Misses      17020    17003   -17     

☔ 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

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.9±0.30ms    31.4 MB/sec    1.04     12.3±0.07ms    30.3 MB/sec
packument/parse                                  1.07     41.4±1.33µs  1601.9 MB/sec    1.00     38.8±0.30µs  1708.5 MB/sec
tarball/download_dependency                      1.00      3.3±0.18ms  1298.3 KB/sec    1.00      3.3±0.07ms  1296.0 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    182.7±2.88ms 87.6 KElem/sec    1.00    183.4±2.76ms 87.2 KElem/sec
version_pick/repeated_ranges_file                1.02      4.3±0.02ms  7.3 KElem/sec    1.00      4.2±0.02ms  7.4 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.1±0.04ms  7.6 KElem/sec    1.02      4.2±0.02ms  7.4 KElem/sec
workspace_resolution/hoist_heavy                 1.00    199.6±1.27ms        ? ?/sec    1.00    199.4±0.76ms        ? ?/sec
workspace_sort/chained_projects                  1.00     14.2±0.34ms        ? ?/sec    1.00     14.1±0.60ms        ? ?/sec

@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 2399.86 ms 2378.52 ms -0.9% 119.99 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1445.65 ms 1469.20 ms 1.6% 72.28 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 281.43 ms 227.02 ms -19.3% 14.07 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 247.32 ms 248.80 ms 0.6% 12.37 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 7.83 ms 12.37 ms 58.0% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-hot-cache-hot-store pnpr 7.69 ms 7.83 ms 1.9% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 7.88 ms 8.02 ms 1.8% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 7.83 ms 7.87 ms 0.5% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2483.21 ms 2492.12 ms 0.4% 124.16 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1578.91 ms 1473.72 ms -6.7% 78.95 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 538.36 ms 447.13 ms -16.9% 26.92 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 299.10 ms 296.18 ms -1.0% 14.96 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1679.49 ms 1670.34 ms -0.5% 83.97 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 326.95 ms 326.51 ms -0.1% 16.35 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 220.17 ms 221.79 ms 0.7% 11.01 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 89.88 ms 88.00 ms -2.1% 4.49 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 220.87 ms 225.32 ms 2.0% 11.04 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 197.33 ms 329.05 ms 66.8% 9.87 ms Inconclusive (not reproduced)
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 69.16 ms 72.12 ms 4.3% 3.46 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4453.82 ms 4557.62 ms 2.3% 222.69 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3560.91 ms 3563.29 ms 0.1% 178.05 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 112.56 ms 116.72 ms 3.7% 5.63 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 128.21 ms 123.44 ms -3.7% 6.41 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1132.88 ms 1126.58 ms -0.6% 56.64 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 06e5ed68b22d

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked and injected workspace scenarios compare 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.451 ± 0.125 2.322 2.671 1.66 ± 0.14
pacquet@main 2.460 ± 0.121 2.354 2.683 1.66 ± 0.14
pnpr@HEAD 1.479 ± 0.097 1.336 1.678 1.00
pnpr@main 1.492 ± 0.123 1.360 1.723 1.01 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4513916758599996,
      "stddev": 0.1253758049892211,
      "median": 2.37852118246,
      "user": 1.5420642599999996,
      "system": 1.7801924,
      "min": 2.32176600796,
      "max": 2.67101682496
    },
    {
      "command": "pacquet@main",
      "mean": 2.45981823556,
      "stddev": 0.12091550337853496,
      "median": 2.39986239996,
      "user": 1.52596096,
      "system": 1.7598077,
      "min": 2.3542779389599997,
      "max": 2.68343253496
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.47851317936,
      "stddev": 0.09669537502669023,
      "median": 1.4691989249600002,
      "user": 1.40869486,
      "system": 1.6553331999999998,
      "min": 1.33630320696,
      "max": 1.67822455896
    },
    {
      "command": "pnpr@main",
      "mean": 1.4922331003600005,
      "stddev": 0.12301816249503013,
      "median": 1.4456531354600002,
      "user": 1.44281866,
      "system": 1.6298196999999999,
      "min": 1.3603283729600002,
      "max": 1.7231647399600003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 238.4 ± 30.3 219.9 318.4 1.00
pacquet@main 298.9 ± 71.3 229.6 409.6 1.25 ± 0.34
pnpr@HEAD 248.9 ± 8.0 234.5 262.6 1.04 ± 0.14
pnpr@main 245.6 ± 6.7 235.3 254.5 1.03 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23840316671999995,
      "stddev": 0.030270287072672437,
      "median": 0.22701986452,
      "user": 0.27734052,
      "system": 0.5581812399999999,
      "min": 0.21987893002,
      "max": 0.31838118102
    },
    {
      "command": "pacquet@main",
      "mean": 0.29890514402,
      "stddev": 0.07129064643609347,
      "median": 0.28142780652,
      "user": 0.34355642,
      "system": 0.7554597399999999,
      "min": 0.22964648602,
      "max": 0.40956850602
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.24889341202,
      "stddev": 0.008015056630430228,
      "median": 0.24879848052,
      "user": 0.27905862000000003,
      "system": 0.58406784,
      "min": 0.23449988702,
      "max": 0.26255255602
    },
    {
      "command": "pnpr@main",
      "mean": 0.24556853701999998,
      "stddev": 0.006726547240900584,
      "median": 0.24731643752,
      "user": 0.27444221999999996,
      "system": 0.5831776399999999,
      "min": 0.23525692402,
      "max": 0.25454816902
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.1 ± 1.9 7.6 18.4 1.56 ± 0.26
pacquet@main 7.9 ± 0.5 6.9 11.3 1.02 ± 0.09
pnpr@HEAD 8.0 ± 0.6 7.0 10.9 1.03 ± 0.11
pnpr@main 7.8 ± 0.5 6.9 9.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.01207334400779221,
      "stddev": 0.001898071684815538,
      "median": 0.012367077800000001,
      "user": 0.006026823116883118,
      "system": 0.007132164155844154,
      "min": 0.0076397343,
      "max": 0.0183704963
    },
    {
      "command": "pacquet@main",
      "mean": 0.00788711400989762,
      "stddev": 0.0004788691986692014,
      "median": 0.0078286583,
      "user": 0.0048469163139931715,
      "system": 0.003899100341296928,
      "min": 0.006873955300000001,
      "max": 0.0112720023
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008006640173333333,
      "stddev": 0.0006338629893739107,
      "median": 0.0078331518,
      "user": 0.004795275999999996,
      "system": 0.004050908133333332,
      "min": 0.006976509300000001,
      "max": 0.0108878413
    },
    {
      "command": "pnpr@main",
      "mean": 0.007764054905504596,
      "stddev": 0.0005099969731477301,
      "median": 0.007686351300000001,
      "user": 0.0047214913761467895,
      "system": 0.0037952031804281347,
      "min": 0.006885809300000001,
      "max": 0.0098348443
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.1 ± 0.4 7.3 10.7 1.03 ± 0.07
pacquet@main 7.9 ± 0.3 7.1 10.0 1.01 ± 0.06
pnpr@HEAD 7.9 ± 0.3 7.2 10.0 1.01 ± 0.06
pnpr@main 7.9 ± 0.4 7.2 11.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.008069571466870226,
      "stddev": 0.0003812619906619507,
      "median": 0.00802394536,
      "user": 0.0045964954198473304,
      "system": 0.004297787786259541,
      "min": 0.007259946360000001,
      "max": 0.010652453360000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.007905359614416957,
      "stddev": 0.0003246883211662825,
      "median": 0.007883587360000001,
      "user": 0.004950117314487634,
      "system": 0.0037409763250883387,
      "min": 0.0071134323600000006,
      "max": 0.009990580360000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.00789561652666667,
      "stddev": 0.00030792448318883,
      "median": 0.00786716636,
      "user": 0.004772268055555553,
      "system": 0.003754007986111114,
      "min": 0.007216666360000001,
      "max": 0.009971415360000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.007851293516794425,
      "stddev": 0.0003638248257738858,
      "median": 0.00783011636,
      "user": 0.004557849477351914,
      "system": 0.00390815331010453,
      "min": 0.007199092360000001,
      "max": 0.01149889236
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.515 ± 0.069 2.466 2.688 1.67 ± 0.13
pacquet@main 2.501 ± 0.061 2.463 2.669 1.66 ± 0.12
pnpr@HEAD 1.503 ± 0.107 1.390 1.690 1.00
pnpr@main 1.590 ± 0.101 1.419 1.795 1.06 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5147008696599995,
      "stddev": 0.06884065266880746,
      "median": 2.4921248496599997,
      "user": 1.80836498,
      "system": 1.6312361,
      "min": 2.46595877466,
      "max": 2.68815347966
    },
    {
      "command": "pacquet@main",
      "mean": 2.5007279555599995,
      "stddev": 0.06073363155447968,
      "median": 2.48321045566,
      "user": 1.78811908,
      "system": 1.5528163999999998,
      "min": 2.46251099666,
      "max": 2.66879039066
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.50329885656,
      "stddev": 0.10685180927571736,
      "median": 1.4737163661600001,
      "user": 1.1389408799999998,
      "system": 1.2169580999999998,
      "min": 1.38994224766,
      "max": 1.6900883176600001
    },
    {
      "command": "pnpr@main",
      "mean": 1.5898018550599997,
      "stddev": 0.10092147736624395,
      "median": 1.5789075161600001,
      "user": 1.1264372799999998,
      "system": 1.2550137,
      "min": 1.41861944766,
      "max": 1.7947669056600002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 446.7 ± 23.7 409.8 485.3 1.53 ± 0.10
pacquet@main 552.7 ± 120.1 428.3 718.5 1.89 ± 0.42
pnpr@HEAD 292.3 ± 9.9 271.8 302.5 1.00
pnpr@main 296.6 ± 12.9 271.0 311.1 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.4466579385,
      "stddev": 0.023708128428291002,
      "median": 0.44712804520000005,
      "user": 0.6264228999999999,
      "system": 0.7569208599999999,
      "min": 0.4098404167,
      "max": 0.4852897707
    },
    {
      "command": "pacquet@main",
      "mean": 0.5527257968,
      "stddev": 0.12009137694708202,
      "median": 0.5383647327000001,
      "user": 0.8060329000000002,
      "system": 0.96004816,
      "min": 0.42826231670000003,
      "max": 0.7185488837000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2922920924,
      "stddev": 0.00994668935055182,
      "median": 0.2961785002,
      "user": 0.2571796,
      "system": 0.5668705599999999,
      "min": 0.2718358877,
      "max": 0.30254675470000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.2966268077,
      "stddev": 0.012912222183044417,
      "median": 0.2991007747,
      "user": 0.26124400000000003,
      "system": 0.5557643599999998,
      "min": 0.2709821207,
      "max": 0.3110991557
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.668 ± 0.017 1.631 1.688 5.03 ± 0.22
pacquet@main 1.781 ± 0.272 1.621 2.533 5.37 ± 0.85
pnpr@HEAD 0.331 ± 0.014 0.316 0.356 1.00
pnpr@main 0.332 ± 0.012 0.321 0.360 1.00 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.66807420048,
      "stddev": 0.016693734055091603,
      "median": 1.6703416395800001,
      "user": 1.10335846,
      "system": 1.0902896600000003,
      "min": 1.63076775208,
      "max": 1.68767871508
    },
    {
      "command": "pacquet@main",
      "mean": 1.7805419411800003,
      "stddev": 0.272219987514188,
      "median": 1.67948798508,
      "user": 1.28924636,
      "system": 1.30938516,
      "min": 1.6211869350800001,
      "max": 2.5332715560800003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33141132087999997,
      "stddev": 0.01436843448880862,
      "median": 0.32650885108,
      "user": 0.30478116,
      "system": 0.62114026,
      "min": 0.31626059708,
      "max": 0.35564436908
    },
    {
      "command": "pnpr@main",
      "mean": 0.33217908348,
      "stddev": 0.012323118492146717,
      "median": 0.32695457608,
      "user": 0.30971825999999997,
      "system": 0.63307766,
      "min": 0.32069676408,
      "max": 0.36020673308
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 222.3 ± 12.6 201.8 241.8 2.52 ± 0.15
pacquet@main 220.3 ± 14.9 193.1 248.1 2.50 ± 0.17
pnpr@HEAD 88.2 ± 1.4 85.8 93.2 1.00
pnpr@main 90.3 ± 2.3 86.0 94.9 1.02 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.22226087774857142,
      "stddev": 0.01262149527676705,
      "median": 0.22178913332,
      "user": 0.19302196571428573,
      "system": 0.08901556857142855,
      "min": 0.20183554532,
      "max": 0.24181704132
    },
    {
      "command": "pacquet@main",
      "mean": 0.2202968199033333,
      "stddev": 0.014939322560966943,
      "median": 0.22016514832,
      "user": 0.1855672633333333,
      "system": 0.08691822333333332,
      "min": 0.19313728032,
      "max": 0.24806530632
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08824448291375,
      "stddev": 0.001393620375993448,
      "median": 0.08800457882,
      "user": 0.029916867499999996,
      "system": 0.011732307499999997,
      "min": 0.08578590032,
      "max": 0.09322865132
    },
    {
      "command": "pnpr@main",
      "mean": 0.09026775235333334,
      "stddev": 0.002256395494746777,
      "median": 0.08987627532,
      "user": 0.03138921333333333,
      "system": 0.014829506666666662,
      "min": 0.08604159032,
      "max": 0.09490683932
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 226.5 ± 12.5 211.8 250.9 1.02 ± 0.06
pacquet@main 221.1 ± 6.7 212.0 229.9 1.00
pnpm@HEAD 3465.0 ± 92.8 3370.2 3639.7 15.67 ± 0.63
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2265062534488889,
      "stddev": 0.012499184017991737,
      "median": 0.22531513656000002,
      "user": 0.22460469777777772,
      "system": 0.05135722222222222,
      "min": 0.21178714956,
      "max": 0.25091835756
    },
    {
      "command": "pacquet@main",
      "mean": 0.22105939655999998,
      "stddev": 0.006691118165335466,
      "median": 0.22086948656000002,
      "user": 0.21932603111111107,
      "system": 0.05415733333333333,
      "min": 0.21202668056,
      "max": 0.22985180756
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.4650334327822225,
      "stddev": 0.09277787062408879,
      "median": 3.43040564056,
      "user": 5.351212919999999,
      "system": 0.34211911111111104,
      "min": 3.3701885045599997,
      "max": 3.63968135056
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 319.4 ± 55.6 200.7 386.9 1.60 ± 0.28
pacquet@main 199.3 ± 4.7 192.7 209.8 1.00

Confirmation (reversed target order)

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@main 197.9 ± 3.6 194.0 204.4 1.00
pacquet@HEAD 198.7 ± 7.7 188.6 210.9 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.31938992324000004,
      "stddev": 0.05561334404126582,
      "median": 0.32905159574000004,
      "user": 0.24864528,
      "system": 0.12405382000000001,
      "min": 0.20073095574,
      "max": 0.38692925674
    },
    {
      "command": "pacquet@main",
      "mean": 0.19934069066857146,
      "stddev": 0.004671712990207644,
      "median": 0.19732507824,
      "user": 0.1597960657142857,
      "system": 0.07432932,
      "min": 0.19274605974,
      "max": 0.20975250774
    }
  ],
  "confirmation": {
    "results": [
      {
        "command": "pacquet@main",
        "mean": 0.1979497452866667,
        "stddev": 0.0036023638067770483,
        "median": 0.19651918222,
        "user": 0.15558888666666668,
        "system": 0.07864034,
        "min": 0.19395914122000002,
        "max": 0.20444528822000002
      },
      {
        "command": "pacquet@HEAD",
        "mean": 0.19870831768666672,
        "stddev": 0.0076614638664591625,
        "median": 0.19987301322,
        "user": 0.16032888666666667,
        "system": 0.07480907333333332,
        "min": 0.18863521522,
        "max": 0.21089909522000003
      }
    ]
  }
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 73.2 ± 3.8 68.7 80.7 1.03 ± 0.10
pacquet@main 71.3 ± 5.5 68.2 97.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.07323895674380951,
      "stddev": 0.003832356751262566,
      "median": 0.07212273522000001,
      "user": 0.02573275904761905,
      "system": 0.052633255238095235,
      "min": 0.06865129422,
      "max": 0.08068730722
    },
    {
      "command": "pacquet@main",
      "mean": 0.07133143224857143,
      "stddev": 0.005481927978230548,
      "median": 0.06915943122,
      "user": 0.026031168571428568,
      "system": 0.049468917142857144,
      "min": 0.06817094022,
      "max": 0.09752284122
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.616 ± 0.158 4.412 4.875 1.29 ± 0.06
pacquet@main 4.483 ± 0.074 4.405 4.615 1.25 ± 0.04
pnpr@HEAD 3.584 ± 0.113 3.455 3.880 1.00
pnpr@main 3.606 ± 0.118 3.477 3.820 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.616245673220001,
      "stddev": 0.15775165678558803,
      "median": 4.55762298902,
      "user": 1.6997705,
      "system": 2.03675526,
      "min": 4.41218234952,
      "max": 4.874597319519999
    },
    {
      "command": "pacquet@main",
      "mean": 4.48264739542,
      "stddev": 0.07393756952689727,
      "median": 4.45382193802,
      "user": 1.6153704999999998,
      "system": 1.9546030600000002,
      "min": 4.4049996695199996,
      "max": 4.61549058752
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5840591817200007,
      "stddev": 0.11295009875510809,
      "median": 3.56329464152,
      "user": 1.5546164999999998,
      "system": 1.8447799600000003,
      "min": 3.45533943552,
      "max": 3.88028021652
    },
    {
      "command": "pnpr@main",
      "mean": 3.6057969555200002,
      "stddev": 0.1184588677595486,
      "median": 3.5609120345200003,
      "user": 1.5275284999999996,
      "system": 1.81357486,
      "min": 3.47735256252,
      "max": 3.8203513295200002
    }
  ]
}

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 117.1 ± 4.3 110.0 125.5 1.02 ± 0.06
pacquet@main 114.7 ± 5.8 108.4 134.5 1.00
pnpr@HEAD 124.0 ± 4.1 117.2 134.3 1.08 ± 0.07
pnpr@main 128.3 ± 1.8 126.0 132.6 1.12 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11707437441826088,
      "stddev": 0.0042668733812126726,
      "median": 0.11671679494000001,
      "user": 0.1441982730434783,
      "system": 0.11972546521739132,
      "min": 0.10996186794,
      "max": 0.12552407894
    },
    {
      "command": "pacquet@main",
      "mean": 0.11466353812181818,
      "stddev": 0.005843822199017184,
      "median": 0.11256222044,
      "user": 0.14101836,
      "system": 0.12082008181818181,
      "min": 0.10842876594,
      "max": 0.13454520494
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.12400918308285716,
      "stddev": 0.004145694215174959,
      "median": 0.12343707594,
      "user": 0.1508203123809524,
      "system": 0.12342989999999998,
      "min": 0.11724263294000001,
      "max": 0.13433119294
    },
    {
      "command": "pnpr@main",
      "mean": 0.12834770014,
      "stddev": 0.001754511119491472,
      "median": 0.12821268794000001,
      "user": 0.15756690999999998,
      "system": 0.12509214999999999,
      "min": 0.12600760794000002,
      "max": 0.13259969894
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.126 ± 0.019 1.095 1.152 1.00
pacquet@main 1.132 ± 0.017 1.103 1.162 1.00 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.12622645306,
      "stddev": 0.019390951936690045,
      "median": 1.12658412306,
      "user": 0.5187473999999999,
      "system": 0.21154744,
      "min": 1.09502776056,
      "max": 1.15189222056
    },
    {
      "command": "pacquet@main",
      "mean": 1.13174752446,
      "stddev": 0.016792109837462037,
      "median": 1.13288327706,
      "user": 0.5403594999999999,
      "system": 0.21479524000000003,
      "min": 1.10311919256,
      "max": 1.16227086456
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review October 17, 2026 12:27
@zkochan

zkochan commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

Copilot AI balanced review requested due to automatic review settings October 17, 2026 12:27

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

Your trial has ended. Reactivate Greptile to resume code reviews.

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Avoid repeated release-age metadata fetches for lowest-version picks

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Mark release-age upgrades from lowest-version mirror picks to prevent repeated full-metadata
 requests.
• Share upgrade persistence and marking across cache, mirror, and registry paths.
• Add a regression test and patch changeset.
Diagram

graph TD
  C["Memory cache hit"] --> U["Shared release-age upgrade"] --> F["Full registry metadata"]
  D["Lowest mirror pick"] --> U
  N["Registry fetch"] --> U
  U --> M[("Disk mirror")]
  U --> L["Upgrade marker"]
Loading
High-Level Assessment

Centralizing the upgrade and its marking in PickState addresses the missed mirror path without duplicating side effects again. Keeping in-memory caching decisions with each caller preserves their different cache rules.

Files changed (5) +128 / -125

Bug fix (1) +40 / -28
state.rsCentralize upgrade persistence and marking +40/-28

Centralize upgrade persistence and marking

• Adds PickState::upgrade_for_release_age for all three pick paths. It marks the document returned after any mirror reload, while leaving each caller responsible for its in-memory caching rule.

pnpm/crates/resolving-npm-resolver/src/pick_package/state.rs

Refactor (2) +14 / -97
cache_hit.rsRoute cache-hit upgrades through PickState +12/-62

Route cache-hit upgrades through PickState

• Replaces the cache-hit path’s separate upgrade, mirror persistence, and marking logic with the shared method. The path still decides whether to cache an upgraded result and whether the document is registry-verified.

pnpm/crates/resolving-npm-resolver/src/pick_package/cache_hit.rs

fetch_pick.rsShare release-age handling after registry fetches +2/-35

Share release-age handling after registry fetches

• Uses the shared upgrade method before picking a version and removes the fetch path’s duplicate persistence and marking helper.

pnpm/crates/resolving-npm-resolver/src/pick_package/fetch_pick.rs

Tests (1) +69 / -0
release_age.rsCover repeated lowest-version picks +69/-0

Cover repeated lowest-version picks

• Adds a test with a warm abbreviated mirror and incomplete publish times. Two online lowest-version picks must trigger exactly one full-metadata request.

pnpm/crates/resolving-npm-resolver/src/pick_package/tests/release_age.rs

Documentation (1) +5 / -0
remember-lowest-direct-release-age-upgrade.mdDocument the release-age request fix +5/-0

Document the release-age request fix

• Adds a pacquet patch changeset explaining that lowest-direct and time-based picks no longer repeatedly download full metadata when publish times are incomplete.

.changeset/remember-lowest-direct-release-age-upgrade.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zkochan
zkochan merged commit d79f2a7 into main Oct 17, 2026
59 checks passed
@zkochan
zkochan deleted the fix-release-age-upgrade-mark branch October 17, 2026 12:49
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.

3 participants