Skip to content

fix(resolver): let a too-new latest fall back to a prerelease of its major - #16407

Merged
zkochan merged 3 commits into
mainfrom
fix-16388
Sep 29, 2026
Merged

zkochan merged 3 commits into
mainfrom
fix-16388

Conversation

@zkochan

@zkochan zkochan commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

When minimumReleaseAge hides the version a stable dist-tag points to, the tag was only allowed to move to other stable versions. For a package that shipped 1.0.0 after months of 1.0.0-beta.x releases tagged latest, latest fell back to 0.0.1 during the release-age window (see cloudflare/vinext#3567, where pnpm create vinext-app@latest failed with ERR_PNPM_DLX_NO_BIN).

Candidates for a dropped tag are now ranked in tiers, compared before the version:

  1. same prerelease-ness as the target, on its major (unchanged)
  2. a prerelease of the stable target's major, below the target (new)
  3. same prerelease-ness on a lower major, latest only (unchanged)

Non-deprecated versions still win over deprecated ones. Without a tier-2 candidate the tiers follow version order, so nothing else changes. A stable version of the same major still beats a prerelease (1.5.0 too new → 1.4.0, not 1.5.0-rc.1).

The bug is in both stacks: fixed in the Rust resolver (best_tag_candidate) and in v11's filterPkgMetadataVersions.

Closes #16388

Squash Commit Body

When minimumReleaseAge drops the version a stable dist-tag points to, the
tag could only move to stable versions, so `latest` on a freshly released
1.0.0 fell back to an ancient 0.0.1 even though 1.0.0-beta.4 had been
`latest` until then. A prerelease of the target's major that precedes it
now ranks above a stable version of a lower major. A stable version of the
same major still wins, and non-deprecated versions still win over
deprecated ones.

Fixed in both the Rust resolver and the TypeScript metadata filter.

Closes pnpm/pnpm#16388

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. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • When the latest version is hidden by the minimum release age setting, package selection now prefers an eligible stable version from the same major. If none is available, it can select a prerelease from that major instead of an older major’s stable release.
    • Eligible versions that are not deprecated remain preferred over deprecated alternatives.

zkochan and others added 2 commits September 29, 2026 21:18
…major

When minimumReleaseAge drops the version a stable dist-tag points to, the
tag used to move only to stable versions, so `latest` on a freshly
released 1.0.0 fell back to an ancient 0.0.1 even though 1.0.0-beta.4
had been `latest` until then. A prerelease of the target's major that
precedes it now ranks above a stable version of a lower major. A stable
version of the same major still wins, and non-deprecated versions still
win over deprecated ones.

Fixed in both the Rust resolver and the TypeScript metadata filter.

Closes #16388

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

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

Warning

Review limit reached

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: 83430923-87b5-4e95-aa99-0c89f1412509

📥 Commits

Reviewing files that changed from the base of the PR and between 620e7e4 and 1695f2e.

📒 Files selected for processing (1)
  • .changeset/latest-falls-back-to-major-prerelease.md

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: 0fa01f82-a4b4-4ac9-b056-d5566e32e25f

📥 Commits

Reviewing files that changed from the base of the PR and between e97d923 and 620e7e4.

📒 Files selected for processing (5)
  • .changeset/latest-falls-back-to-major-prerelease.md
  • pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta/release_age.rs
  • pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta/tests.rs
  • pnpm11/resolving/registry/pkg-metadata-filter/src/index.ts
  • pnpm11/resolving/registry/pkg-metadata-filter/test/index.ts

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


📝 Walkthrough

Walkthrough

The Rust resolver and TypeScript metadata filter now rank eligible dist-tag replacements by candidate tier before version. Tests cover fallback choices for prerelease, stable, and deprecated candidates. A changeset declares patch releases for three packages.

Changes

Release-age fallback

Layer / File(s) Summary
Rust candidate ranking and tests
.changeset/latest-falls-back-to-major-prerelease.md, pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta/release_age.rs, pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta/tests.rs
The resolver ranks eligible candidates by tier and then version, while retaining the non-deprecated preference and target-version bound. Tests cover selection of a same-major prerelease, a same-major stable version, and a non-deprecated lower-major version.
TypeScript candidate ranking and tests
pnpm11/resolving/registry/pkg-metadata-filter/src/index.ts, pnpm11/resolving/registry/pkg-metadata-filter/test/index.ts
The metadata filter applies candidate tiers to replacement selection. Tests cover same-major prerelease and stable fallbacks, and selection of a lower-major candidate when the prerelease is deprecated.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Use the prerelease preceding a stable release of the major when the latest target is hidden by the release-age filter [#16388] ✅

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

Merge Risk: ⚪ Minimal · up to 620e7

The release-age fallback change is mergeable after normal checks; no concrete merge-blocking issue was identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 620e7

The change can alter which package version a tag installs, but the reviewed paths select from versions that already passed the release-age policy. No new policy bypass or cross-package access was identified. Some broader security coverage remains incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed choice is reachable for a registry package whose stable dist-tag target is excluded by the age cutoff and whose retained versions include a preceding same-major prerelease. The reviewed selection stays within that package’s metadata, although downstream installation receives a different manifest.

Trust Boundaries and Controls

  • observed — Registry metadata supplies version keys, tags, and publication times. The reviewed TypeScript path filters by publication time before ranking, uses own-key checks and null-prototype output maps for version and tag dictionaries, and rejects unparsable fallback candidates. Its policy still relies on the supplied publication times.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.01     15.0±1.50ms    25.0 MB/sec    1.00     14.9±1.15ms    25.1 MB/sec
packument/parse                                  1.00     47.4±3.23µs  1400.6 MB/sec    1.14     53.8±7.00µs  1233.9 MB/sec
tarball/download_dependency                      1.21      6.3±0.99ms   690.0 KB/sec    1.00      5.2±0.69ms   836.7 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    277.6±8.27ms 57.6 KElem/sec    1.23   340.2±52.81ms 47.0 KElem/sec
version_pick/repeated_ranges_file                1.00      4.9±0.30ms  6.3 KElem/sec    1.01      5.0±0.16ms  6.3 KElem/sec
version_pick/repeated_ranges_raw                 1.01      4.9±0.34ms  6.3 KElem/sec    1.00      4.9±0.14ms  6.4 KElem/sec
workspace_resolution/hoist_heavy                 1.00   302.3±20.57ms        ? ?/sec    1.00   302.7±20.84ms        ? ?/sec
workspace_sort/chained_projects                  1.01     19.2±3.64ms        ? ?/sec    1.00     19.1±3.06ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.16%. Comparing base (0ef7d99) to head (1695f2e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16407   +/-   ##
=======================================
  Coverage   92.16%   92.16%           
=======================================
  Files        1516     1516           
  Lines      204012   204032   +20     
=======================================
+ Hits       188024   188054   +30     
+ Misses      15988    15978   -10     

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

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

@github-actions

github-actions Bot commented Sep 29, 2026 •

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 2758.36 ms 2784.91 ms 1.0% 137.92 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1554.75 ms 1749.22 ms 12.5% 77.74 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 253.68 ms 284.98 ms 12.3% 12.68 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pnpr 292.00 ms 274.90 ms -5.9% 14.60 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 11.77 ms 12.49 ms 6.1% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 11.93 ms 11.79 ms -1.1% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 16.13 ms 16.42 ms 1.8% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 17.24 ms 15.60 ms -9.6% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 3144.80 ms 3256.28 ms 3.5% 157.24 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1675.79 ms 1757.96 ms 4.9% 83.79 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 598.19 ms 675.98 ms 13.0% 29.91 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pnpr 422.37 ms 391.46 ms -7.3% 21.12 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1862.90 ms 1824.24 ms -2.1% 93.15 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 417.74 ms 398.28 ms -4.7% 20.89 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 252.46 ms 294.49 ms 16.6% 12.62 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 94.83 ms 96.96 ms 2.2% 4.74 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 344.25 ms 333.10 ms -3.2% 17.21 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 259.49 ms 254.35 ms -2.0% 12.97 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4916.31 ms 4980.31 ms 1.3% 245.82 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3540.44 ms 3674.11 ms 3.8% 177.02 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 188.65 ms 150.45 ms -20.2% 9.43 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 196.32 ms 176.19 ms -10.3% 9.82 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 1695f2e77140

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.797 ± 0.201 2.490 3.119 1.74 ± 0.18
pacquet@main 2.725 ± 0.182 2.493 2.932 1.70 ± 0.17
pnpr@HEAD 1.717 ± 0.127 1.419 1.844 1.07 ± 0.11
pnpr@main 1.603 ± 0.124 1.436 1.820 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.79654569894,
      "stddev": 0.20077642261133946,
      "median": 2.78490854454,
      "user": 2.30276928,
      "system": 2.2989938000000003,
      "min": 2.48966317404,
      "max": 3.1188075120399996
    },
    {
      "command": "pacquet@main",
      "mean": 2.7247522889400004,
      "stddev": 0.1822380020008234,
      "median": 2.7583558985399996,
      "user": 2.31574798,
      "system": 2.2196488000000003,
      "min": 2.49288184404,
      "max": 2.93246165504
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.71678934874,
      "stddev": 0.12693596251283468,
      "median": 1.74922219204,
      "user": 1.9418673799999997,
      "system": 1.841705,
      "min": 1.4190650930400002,
      "max": 1.8441851630400001
    },
    {
      "command": "pnpr@main",
      "mean": 1.60338184294,
      "stddev": 0.12401890527163369,
      "median": 1.55475106404,
      "user": 1.95605028,
      "system": 2.0371278000000004,
      "min": 1.43551112204,
      "max": 1.8200841120400002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 290.1 ± 24.0 258.6 342.6 1.13 ± 0.15
pacquet@main 256.9 ± 25.8 230.0 321.1 1.00
pnpr@HEAD 286.7 ± 32.6 250.1 341.3 1.12 ± 0.17
pnpr@main 300.8 ± 32.1 267.5 375.5 1.17 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2901493486000001,
      "stddev": 0.024041083624281794,
      "median": 0.2849756283,
      "user": 0.33553259999999996,
      "system": 0.66259842,
      "min": 0.2586400533,
      "max": 0.34262568730000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.256936135,
      "stddev": 0.02579513554211515,
      "median": 0.2536847888,
      "user": 0.27604439999999997,
      "system": 0.61887142,
      "min": 0.22999153530000002,
      "max": 0.3211339493
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2867036395,
      "stddev": 0.03258005692884897,
      "median": 0.27490124530000004,
      "user": 0.3177617,
      "system": 0.65154482,
      "min": 0.2500892873,
      "max": 0.3413270083
    },
    {
      "command": "pnpr@main",
      "mean": 0.3008048736,
      "stddev": 0.032132115510783835,
      "median": 0.2920001053,
      "user": 0.3324465,
      "system": 0.65858452,
      "min": 0.2675309193,
      "max": 0.37549494130000005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.6 ± 1.4 10.0 17.0 1.06 ± 0.18
pacquet@main 11.9 ± 1.5 8.9 19.4 1.00
pnpr@HEAD 12.0 ± 1.4 9.0 16.2 1.01 ± 0.17
pnpr@main 12.1 ± 1.3 9.2 15.5 1.02 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.012609281139161673,
      "stddev": 0.0013895338630453352,
      "median": 0.012488788720000001,
      "user": 0.007437013892215569,
      "system": 0.006637352574850303,
      "min": 0.00996018272,
      "max": 0.016972236720000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.011862156572380957,
      "stddev": 0.0015296039703152247,
      "median": 0.01177045472,
      "user": 0.007024231428571427,
      "system": 0.0062835418095238075,
      "min": 0.00886023172,
      "max": 0.019402734720000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011968589392199169,
      "stddev": 0.0013588750633505597,
      "median": 0.01179255972,
      "user": 0.0063448645643153535,
      "system": 0.007030161991701246,
      "min": 0.00898615172,
      "max": 0.01615824672
    },
    {
      "command": "pnpr@main",
      "mean": 0.012087549201632653,
      "stddev": 0.001255183963724878,
      "median": 0.01192644172,
      "user": 0.006936690612244898,
      "system": 0.00657611632653061,
      "min": 0.00917145272,
      "max": 0.01546912672
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 16.7 ± 3.0 11.0 24.6 1.03 ± 0.26
pacquet@main 16.7 ± 3.0 11.9 24.0 1.03 ± 0.26
pnpr@HEAD 16.2 ± 2.9 10.3 26.3 1.00
pnpr@main 18.3 ± 4.5 12.3 33.9 1.13 ± 0.34
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.016717948195328458,
      "stddev": 0.0030210537555093076,
      "median": 0.01641703248,
      "user": 0.008393710218978105,
      "system": 0.009823554890510944,
      "min": 0.01096745648,
      "max": 0.02462131248
    },
    {
      "command": "pacquet@main",
      "mean": 0.016707062525045047,
      "stddev": 0.00302717124860517,
      "median": 0.01613314948,
      "user": 0.008922305405405406,
      "system": 0.009315410630630629,
      "min": 0.01194355648,
      "max": 0.02397874348
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.016172489979999993,
      "stddev": 0.0028718322445121743,
      "median": 0.015596966480000002,
      "user": 0.00886825,
      "system": 0.008833319428571428,
      "min": 0.01027186148,
      "max": 0.02629932748
    },
    {
      "command": "pnpr@main",
      "mean": 0.018329043934545444,
      "stddev": 0.0044752168303835455,
      "median": 0.01724487898,
      "user": 0.009443055844155848,
      "system": 0.01043931701298701,
      "min": 0.01229969048,
      "max": 0.033931874480000006
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.308 ± 0.146 3.120 3.529 1.95 ± 0.16
pacquet@main 3.103 ± 0.128 2.859 3.214 1.83 ± 0.15
pnpr@HEAD 1.773 ± 0.109 1.586 1.961 1.04 ± 0.10
pnpr@main 1.697 ± 0.118 1.560 1.941 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.30773164502,
      "stddev": 0.14606925752344754,
      "median": 3.2562845637200004,
      "user": 3.79752358,
      "system": 2.7591702199999997,
      "min": 3.11965011272,
      "max": 3.52901406272
    },
    {
      "command": "pacquet@main",
      "mean": 3.10315353852,
      "stddev": 0.12837663605933414,
      "median": 3.14480062172,
      "user": 3.37755868,
      "system": 2.5378840199999995,
      "min": 2.85863987772,
      "max": 3.2144129877200003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.77340338602,
      "stddev": 0.10892710163489742,
      "median": 1.7579587917200001,
      "user": 2.0128157799999995,
      "system": 2.1076856199999994,
      "min": 1.58580637472,
      "max": 1.9613059237200001
    },
    {
      "command": "pnpr@main",
      "mean": 1.6974177919200002,
      "stddev": 0.11765050456483679,
      "median": 1.67578992022,
      "user": 1.81845778,
      "system": 1.8877872199999999,
      "min": 1.55979751772,
      "max": 1.94099469872
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 686.3 ± 90.0 539.6 817.3 1.69 ± 0.28
pacquet@main 602.0 ± 49.5 552.5 701.5 1.49 ± 0.19
pnpr@HEAD 405.3 ± 39.9 368.6 491.2 1.00
pnpr@main 422.2 ± 41.1 365.5 477.1 1.04 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.68628570926,
      "stddev": 0.08999880206554665,
      "median": 0.6759777142600001,
      "user": 0.97221046,
      "system": 1.0334712,
      "min": 0.53961970226,
      "max": 0.81734148226
    },
    {
      "command": "pacquet@main",
      "mean": 0.6019658936600001,
      "stddev": 0.04952447344985204,
      "median": 0.59818721476,
      "user": 0.8871365600000001,
      "system": 0.8937582,
      "min": 0.55253196926,
      "max": 0.70146483926
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.40527882286000005,
      "stddev": 0.039862487923164665,
      "median": 0.39146028226000007,
      "user": 0.37215055999999996,
      "system": 0.7522737999999999,
      "min": 0.36864544126000004,
      "max": 0.49123186626000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.42219179795999995,
      "stddev": 0.041126420289848836,
      "median": 0.42236725576,
      "user": 0.38458625999999996,
      "system": 0.7783032999999999,
      "min": 0.36549910526,
      "max": 0.47709942026
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.820 ± 0.054 1.734 1.940 4.46 ± 0.46
pacquet@main 1.870 ± 0.061 1.740 1.958 4.58 ± 0.48
pnpr@HEAD 0.408 ± 0.041 0.364 0.512 1.00
pnpr@main 0.411 ± 0.021 0.371 0.436 1.01 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8200989959399998,
      "stddev": 0.05410719906734012,
      "median": 1.8242368768400001,
      "user": 1.29695558,
      "system": 1.2783708599999997,
      "min": 1.73398482134,
      "max": 1.94010903134
    },
    {
      "command": "pacquet@main",
      "mean": 1.8698624355400004,
      "stddev": 0.06147090888552733,
      "median": 1.8629030423400001,
      "user": 1.3812613800000002,
      "system": 1.3599464599999997,
      "min": 1.7398462853399999,
      "max": 1.95814412834
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.40803355864,
      "stddev": 0.04051901877089258,
      "median": 0.39828073384,
      "user": 0.37220007999999993,
      "system": 0.9013495600000001,
      "min": 0.36439604034,
      "max": 0.5120612133400001
    },
    {
      "command": "pnpr@main",
      "mean": 0.41092736094,
      "stddev": 0.021128240138563747,
      "median": 0.41773620484,
      "user": 0.37665817999999995,
      "system": 0.8532510599999998,
      "min": 0.37124698934,
      "max": 0.43636842834
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 303.6 ± 44.2 248.9 374.9 3.19 ± 0.50
pacquet@main 255.4 ± 24.0 213.9 301.3 2.68 ± 0.29
pnpr@HEAD 96.5 ± 3.1 91.7 104.0 1.01 ± 0.07
pnpr@main 95.3 ± 5.3 88.3 119.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.30363937402,
      "stddev": 0.044186018332446696,
      "median": 0.29449110172000004,
      "user": 0.3051217599999999,
      "system": 0.12044756000000001,
      "min": 0.24887343522000002,
      "max": 0.37487728222000005
    },
    {
      "command": "pacquet@main",
      "mean": 0.25541730967454546,
      "stddev": 0.023954231658154464,
      "median": 0.25246399222000004,
      "user": 0.24054762363636362,
      "system": 0.0975596509090909,
      "min": 0.21389936122000003,
      "max": 0.30128970322000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09648810001310346,
      "stddev": 0.0030773138000771334,
      "median": 0.09696212322000002,
      "user": 0.03675177724137932,
      "system": 0.016211870344827583,
      "min": 0.09170541822000002,
      "max": 0.10397537122000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.09532728394413793,
      "stddev": 0.005347983382464325,
      "median": 0.09483222522000001,
      "user": 0.035330087586206885,
      "system": 0.014485264827586207,
      "min": 0.08832918622000001,
      "max": 0.11978127622000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 346.1 ± 38.1 311.8 435.3 1.00
pacquet@main 358.2 ± 46.2 291.8 425.5 1.03 ± 0.18
pnpm@HEAD 3714.5 ± 216.7 3498.2 4187.8 10.73 ± 1.34
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.34608543754444443,
      "stddev": 0.038062419968012136,
      "median": 0.33310334810000003,
      "user": 0.37407263555555553,
      "system": 0.08069108222222221,
      "min": 0.3117686671,
      "max": 0.43525268710000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.3581969416555556,
      "stddev": 0.046217854670312704,
      "median": 0.34424535310000004,
      "user": 0.38019296888888887,
      "system": 0.08433763777777777,
      "min": 0.29181503810000003,
      "max": 0.42551076810000005
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.714469872655556,
      "stddev": 0.21667167361953013,
      "median": 3.6634602231,
      "user": 5.628208302222221,
      "system": 0.2889094155555555,
      "min": 3.4982365631,
      "max": 4.1878442611
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 266.6 ± 34.1 234.4 342.9 1.04 ± 0.15
pacquet@main 256.3 ± 14.2 232.8 274.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2665524233466667,
      "stddev": 0.03412761291952584,
      "median": 0.25435161218,
      "user": 0.21529575666666664,
      "system": 0.10562147666666666,
      "min": 0.23435514368000002,
      "max": 0.34287064268
    },
    {
      "command": "pacquet@main",
      "mean": 0.25628235158909085,
      "stddev": 0.01423861757666493,
      "median": 0.25948847168,
      "user": 0.20873202181818182,
      "system": 0.1025704690909091,
      "min": 0.23282267468,
      "max": 0.27402274968
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 5.043 ± 0.349 4.596 5.719 1.41 ± 0.11
pacquet@main 4.864 ± 0.260 4.518 5.314 1.36 ± 0.08
pnpr@HEAD 3.686 ± 0.139 3.473 3.927 1.03 ± 0.05
pnpr@main 3.565 ± 0.097 3.428 3.735 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 5.042874118239999,
      "stddev": 0.348803422016463,
      "median": 4.98030842314,
      "user": 2.6771741600000003,
      "system": 2.44727362,
      "min": 4.59567518414,
      "max": 5.71886235414
    },
    {
      "command": "pacquet@main",
      "mean": 4.86449959234,
      "stddev": 0.2599895077129378,
      "median": 4.91630633214,
      "user": 2.3225981600000005,
      "system": 2.1986572200000003,
      "min": 4.51789975014,
      "max": 5.31438030814
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6860879291399997,
      "stddev": 0.1389733583787736,
      "median": 3.6741064526400002,
      "user": 1.93690246,
      "system": 1.7540706199999998,
      "min": 3.4731721491400003,
      "max": 3.92714762714
    },
    {
      "command": "pnpr@main",
      "mean": 3.5647336692400002,
      "stddev": 0.09706924562692157,
      "median": 3.54044001414,
      "user": 1.8721789600000005,
      "system": 1.75278382,
      "min": 3.4284207721400004,
      "max": 3.7351319881400005
    }
  ]
}

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 155.8 ± 19.2 136.4 204.5 1.00
pacquet@main 209.8 ± 38.7 180.0 268.6 1.35 ± 0.30
pnpr@HEAD 175.7 ± 12.9 157.0 195.8 1.13 ± 0.16
pnpr@main 194.9 ± 14.5 173.0 221.1 1.25 ± 0.18
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1558386510511111,
      "stddev": 0.019152670399988955,
      "median": 0.15045356694,
      "user": 0.20202218444444445,
      "system": 0.14465606444444443,
      "min": 0.13639503994,
      "max": 0.20454806194
    },
    {
      "command": "pacquet@main",
      "mean": 0.20978509114000002,
      "stddev": 0.03871789367786492,
      "median": 0.18864554344,
      "user": 0.25556374000000004,
      "system": 0.21008571999999998,
      "min": 0.17998781794,
      "max": 0.26864483194000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.17573318534000001,
      "stddev": 0.012873213430846653,
      "median": 0.17618679694,
      "user": 0.21110387333333333,
      "system": 0.16035598666666664,
      "min": 0.15702657394,
      "max": 0.19581527994
    },
    {
      "command": "pnpr@main",
      "mean": 0.19485994270923077,
      "stddev": 0.014454482197876475,
      "median": 0.19631792994,
      "user": 0.2337372784615384,
      "system": 0.17360012,
      "min": 0.17295739594,
      "max": 0.22114733394
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review September 29, 2026 19:45
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix latest fallback to same-major prereleases under minimumReleaseAge

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Allow a too-new latest target to fall back to a prerelease of its major.
• Preserve same-major stable and non-deprecated version preferences in both resolver stacks.
• Add Rust and v11 regression tests and patch release notes.
Diagram

graph TD
  P["Registry packument"] --> R["Rust resolver"] --> C["Age cutoff"] --> T{"Target kept?"} -->|no| K["Tier ranking"] --> D["Deprecation preference"] --> O["Resolved dist-tags"]
  P --> V["v11 metadata filter"] --> C
  T -->|yes| O
Loading
High-Level Assessment

Keep explicit tier ranking in both existing filters. Plain semver maximization cannot preserve the required stable-before-prerelease preference, while a shared cross-language policy abstraction would add coupling for this focused fix.

Files changed (5) +240 / -29

Bug fix (2) +107 / -29
release_age.rsRank Rust dist-tag fallbacks by candidate tier +61/-19

Rank Rust dist-tag fallbacks by candidate tier

• Allows a dropped stable tag to select an earlier prerelease of its major. Compares fallback tier before version while retaining tag bounds and the non-deprecated preference.

pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta/release_age.rs

index.tsApply tiered fallback in the v11 metadata filter +46/-10

Apply tiered fallback in the v11 metadata filter

• Adds candidate tiers when repopulating dropped dist-tags, permitting an earlier same-major prerelease of a stable target. Keeps version bounds and non-deprecated preference.

pnpm11/resolving/registry/pkg-metadata-filter/src/index.ts

Tests (2) +126 / -0
tests.rsCover Rust latest fallback precedence +59/-0

Cover Rust latest fallback precedence

• Adds cutoff-based cases for same-major prerelease fallback, same-major stable precedence, and non-deprecated lower-major precedence.

pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta/tests.rs

index.tsCover v11 latest fallback precedence +67/-0

Cover v11 latest fallback precedence

• Tests selection of the newest same-major prerelease, preference for a same-major stable version, and preference for a non-deprecated lower-major version.

pnpm11/resolving/registry/pkg-metadata-filter/test/index.ts

Documentation (1) +7 / -0
latest-falls-back-to-major-prerelease.mdAnnounce corrected latest fallback +7/-0

Announce corrected latest fallback

• Adds patch release notes for the metadata-filter package, pnpm, and pacquet. Explains the same-major prerelease fallback and continued preference for a same-major stable version.

.changeset/latest-falls-back-to-major-prerelease.md

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. One changeset covers both release lines 📘 Rule violation § Compliance
Description
.changeset/latest-falls-back-to-major-prerelease.md lists pnpm and pacquet in the same
frontmatter instead of using separate changesets for the v11 and v12 fixes. Both implementations
change in this PR, so a later release-note edit or version bump cannot be scoped to just one release
line.
Code

.changeset/latest-falls-back-to-major-prerelease.md[R2-4]

+"@pnpm/resolving.registry.pkg-metadata-filter": patch
+"pnpm": patch
+"pacquet": patch
Relevance

●●● Strong

Exact recent precedent accepted splitting pnpm and pacquet changesets; current checklist explicitly
requires separate release lines.

PR-#15316
PR-#16387

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires separate changeset files when a PR changes both v11 and v12; the added file
lists both CLI release targets together.

Rule 713436: Changesets for pnpm v11 vs v12 (pacquet) must target the correct package and bump type
.changeset/latest-falls-back-to-major-prerelease.md[1-7]

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 single changeset targets both the v11 TypeScript packages and the v12 Rust package.

## Fix Focus Areas
- .changeset/latest-falls-back-to-major-prerelease.md[1-7]

## Recommended Fix
Create separate changeset files: one targeting `pnpm` and the metadata-filter package, and one targeting `pacquet`. Give each file its own release note.

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

Dismiss ↗ | View ↗


2. Release note combines old and new behavior ✓ Resolved
Description
The changeset's example says latest resolves to 1.0.0-beta.4 rather than 0.0.1, placing the
previous behavior in the new-behavior sentence. Because this is a bug-fix entry, the old fallback
needs its own past-tense sentence rather than a clause attached to the fix.
Code

.changeset/latest-falls-back-to-major-prerelease.md[7]

+When `minimumReleaseAge` hides the version that `latest` points to, pnpm now falls back to a prerelease of the same major before a stable version of an older major. For example, if `1.0.0` is too new, `latest` resolves to `1.0.0-beta.4` rather than `0.0.1`. A stable version of the same major is still preferred over a prerelease [#16388](https://github.com/pnpm/pnpm/issues/16388).
Relevance

●● Moderate

Accepted precedents support separating old and new behavior, but several recent similar wording
findings were rejected.

PR-#14179
PR-#15324
PR-#16221

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added example joins the new result to the old result with rather than, which the checklist
explicitly disallows for bug-fix release notes.

Rule 3058498: Describe previous buggy behavior in a separate past-tense sentence
.changeset/latest-falls-back-to-major-prerelease.md[7-7]

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 combines the corrected fallback and the previous fallback in one sentence using `rather than`.

## Fix Focus Areas
- .changeset/latest-falls-back-to-major-prerelease.md[7-7]

## Recommended Fix
Put the previous `0.0.1` fallback in a separate past-tense sentence, then state the current prerelease fallback independently.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 63 rules
✅ Skills: review-code
Review mode: ⏭️ Skipped: The latest push only revises wording in a changeset release-note markdown file and cannot affect runtime behavior.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 1695f2e

Results up to commit 620e7e4 ⚖️ Balanced


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


Remediation recommended
1. One changeset covers both release lines 📘 Rule violation § Compliance
Description
.changeset/latest-falls-back-to-major-prerelease.md lists pnpm and pacquet in the same
frontmatter instead of using separate changesets for the v11 and v12 fixes. Both implementations
change in this PR, so a later release-note edit or version bump cannot be scoped to just one release
line.
Code

.changeset/latest-falls-back-to-major-prerelease.md[R2-4]

+"@pnpm/resolving.registry.pkg-metadata-filter": patch
+"pnpm": patch
+"pacquet": patch
Relevance

●●● Strong

Exact recent precedent accepted splitting pnpm and pacquet changesets; current checklist explicitly
requires separate release lines.

PR-#15316
PR-#16387

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires separate changeset files when a PR changes both v11 and v12; the added file
lists both CLI release targets together.

Rule 713436: Changesets for pnpm v11 vs v12 (pacquet) must target the correct package and bump type
.changeset/latest-falls-back-to-major-prerelease.md[1-7]

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 single changeset targets both the v11 TypeScript packages and the v12 Rust package.

## Fix Focus Areas
- .changeset/latest-falls-back-to-major-prerelease.md[1-7]

## Recommended Fix
Create separate changeset files: one targeting `pnpm` and the metadata-filter package, and one targeting `pacquet`. Give each file its own release note.

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

Dismiss ↗ | View ↗


2. Release note combines old and new behavior ✓ Resolved
Description
The changeset's example says latest resolves to 1.0.0-beta.4 rather than 0.0.1, placing the
previous behavior in the new-behavior sentence. Because this is a bug-fix entry, the old fallback
needs its own past-tense sentence rather than a clause attached to the fix.
Code

.changeset/latest-falls-back-to-major-prerelease.md[7]

+When `minimumReleaseAge` hides the version that `latest` points to, pnpm now falls back to a prerelease of the same major before a stable version of an older major. For example, if `1.0.0` is too new, `latest` resolves to `1.0.0-beta.4` rather than `0.0.1`. A stable version of the same major is still preferred over a prerelease [#16388](https://github.com/pnpm/pnpm/issues/16388).
Relevance

●● Moderate

Accepted precedents support separating old and new behavior, but several recent similar wording
findings were rejected.

PR-#14179
PR-#15324
PR-#16221

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added example joins the new result to the old result with rather than, which the checklist
explicitly disallows for bug-fix release notes.

Rule 3058498: Describe previous buggy behavior in a separate past-tense sentence
.changeset/latest-falls-back-to-major-prerelease.md[7-7]

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 combines the corrected fallback and the previous fallback in one sentence using `rather than`.

## Fix Focus Areas
- .changeset/latest-falls-back-to-major-prerelease.md[7-7]

## Recommended Fix
Put the previous `0.0.1` fallback in a separate past-tense sentence, then state the current prerelease fallback independently.

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


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

zkochan commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review:

  1. One changeset for both release lines. Not acting. AGENTS.md allows one changeset naming the TypeScript packages, "pnpm", and pacquet when the same release-note text applies to both. Here it does, because both CLIs now behave the same way.
  2. Old behavior joined to the new one with "rather than". Fixed in 1695f2e. The old fallback now has its own past-tense sentence.

Written by an agent (Claude Code, claude-opus-5-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1695f2e

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

noshiro-pf added a commit to noshiro-pf/mono that referenced this pull request Nov 17, 2026
…release

When the `latest` version is younger than `minimumReleaseAge` and no stable
release of its major is old enough, `pnpm update --latest` falls back to a
prerelease of that major (pnpm/pnpm#16407). pnpm offers no option to keep it
to stable releases, so the bot's update moved `eslint-config-typed`'s
`@stylistic/eslint-plugin` from `^5.10.0` to `^6.0.0-beta.6`.

`update-packages:hold-prereleases`, run by pnpm-update.yml right after
`update-packages`, rewrites every range the update moved from a stable
release to a prerelease — in the manifests and the workspace catalogs — to
the newest stable release the hold accepts, or back to the old range, and
re-installs. `mature-updates.mts` shares its registry and hold helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
noshiro-pf added a commit to noshiro-pf/mono that referenced this pull request Nov 17, 2026
…release (#4328)

When the `latest` version is younger than `minimumReleaseAge` and no stable
release of its major is old enough, `pnpm update --latest` falls back to a
prerelease of that major (pnpm/pnpm#16407). pnpm offers no option to keep it
to stable releases, so the bot's update moved `eslint-config-typed`'s
`@stylistic/eslint-plugin` from `^5.10.0` to `^6.0.0-beta.6`.

`update-packages:hold-prereleases`, run by pnpm-update.yml right after
`update-packages`, rewrites every range the update moved from a stable
release to a prerelease — in the manifests and the workspace catalogs — to
the newest stable release the hold accepts, or back to the old range, and
re-installs. `mature-updates.mts` shares its registry and hold helpers.

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 product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm falls back to last stable release instead of prerelease for a major release

2 participants