Skip to content

fix(resolver): apply resolutionMode under a minimum release age - #13831

Merged
zkochan merged 2 commits into
mainfrom
fix-13752
Aug 11, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-13752

Conversation

@zkochan

@zkochan zkochan commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #13752.

resolutionMode: lowest-direct and time-based were ignored whenever a release-age cutoff was in effect. Since minimumReleaseAge has a non-zero built-in default, that is almost always — which is why the reporter found the setting worked only with an explicit minimumReleaseAge: 0, and why an invalid resolutionMode value produced no visible effect either.

The two settings answer different questions, and the picker was treating them as alternatives. pickMatchingVersionFast branches on whether publishedBy is set: with it, pickRespectingMinReleaseAge took the highest mature version and never read pickLowestVersion; without it, pickIgnoringReleaseAge honoured the mode. But minimumReleaseAge narrows which versions are on offer — pickPackageFromMeta applies the maturity filter to meta before picking — and resolutionMode decides which end of what is left to take. They compose. The maturity branch now picks by pickLowestVersion over the matured view.

The fallback is deliberately unchanged: when no mature version satisfies the range it still takes the lowest regardless of maturity, so the resolver reports the violation inline rather than throwing at that layer.

Both stacks had the same shape. pacquet's PickerOpts::pick_lowest_version even documented the interaction as intended — "Forced to false when published_by is active" — but nothing else justified it, and the surrounding comments only explain the fallback. That doc comment was describing the bug, so it is corrected rather than preserved.

Why the existing tests missed it. Both stacks' lowest-direct tests disable the interaction: the TypeScript one runs through testDefaults, which sets no minimumReleaseAge, and pacquet's resolution_mode_lowest_direct_picks_lowest_direct_version writes minimumReleaseAge: 0 into pnpm-workspace.yaml — the issue's own workaround. The new tests keep a release age configured, and both were confirmed to fail before the change.

Squash Commit Body

`resolutionMode: lowest-direct` and `time-based` were ignored whenever a
release-age cutoff was in effect, which the built-in `minimumReleaseAge`
default means is almost always. The picker branched on `publishedBy`
rather than composing the two: the maturity branch always took the
highest mature version and never read `pickLowestVersion`, so the mode
only took effect when `minimumReleaseAge: 0` was set explicitly.

The two settings answer different questions. `minimumReleaseAge` narrows
which versions are on offer; `resolutionMode` picks an end of what is
left. So the maturity branch now picks by `pickLowestVersion` over the
matured view. The fallback is unchanged: when no mature version
satisfies the range it still takes the lowest regardless of maturity, so
the resolver reports the violation inline instead of throwing.

Both stacks had the same shape, and pacquet documented the interaction
as deliberate on `PickerOpts::pick_lowest_version` — that comment was
describing the bug, and is corrected.

Closes pnpm/pnpm#13752.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-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

    • Corrected dependency resolution when minimumReleaseAge is configured with lowest-direct or time-based resolution.
    • The installer now selects the lowest eligible mature direct dependency version instead of always choosing the newest eligible version.
    • Preserved fallback behavior when no mature version satisfies the requested range.
  • Tests

    • Added coverage for resolution behavior involving release-age restrictions.

`resolutionMode: lowest-direct` and `time-based` were ignored whenever a
release-age cutoff was in effect, which the built-in `minimumReleaseAge`
default means is almost always. The picker branched on `publishedBy`
rather than composing the two: the maturity branch always took the
highest mature version and never read `pickLowestVersion`, so the mode
only took effect when `minimumReleaseAge: 0` was set explicitly.

The two settings answer different questions. `minimumReleaseAge` narrows
which versions are on offer; `resolutionMode` picks an end of what is
left. So the maturity branch now picks by `pickLowestVersion` over the
matured view. The fallback is unchanged: when no mature version
satisfies the range it still takes the lowest regardless of maturity, so
the resolver reports the violation inline instead of throwing.

Both stacks had the same shape, and pacquet documented the interaction
as deliberate on `PickerOpts::pick_lowest_version` — that comment was
describing the bug, and is corrected.

Closes #13752.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 11, 2026 13:29

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.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f95bd6d-6711-4541-a2f5-fdabb21b2bfa

📥 Commits

Reviewing files that changed from the base of the PR and between 29ae15e and d9346f1.

📒 Files selected for processing (4)
  • pnpm/crates/cli/tests/suite/install.rs
  • pnpm/crates/resolving-npm-resolver/src/pick_package.rs
  • pnpm11/installing/deps-installer/test/install/resolutionMode.ts
  • pnpm11/resolving/npm-resolver/src/pickPackage.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm/crates/resolving-npm-resolver/src/pick_package.rs
  • pnpm11/resolving/npm-resolver/src/pickPackage.ts
  • pnpm11/installing/deps-installer/test/install/resolutionMode.ts
  • pnpm/crates/cli/tests/suite/install.rs

📝 Walkthrough

Walkthrough

The npm resolvers now honor lowest-version selection when minimum release age filters package versions. Rust and TypeScript tests cover lowest-direct and time-based resolution. A patch changeset documents the correction.

Changes

Resolution mode and maturity filtering

Layer / File(s) Summary
Mature version selection
pnpm/crates/resolving-npm-resolver/src/pick_package.rs, pnpm11/resolving/npm-resolver/src/pickPackage.ts
Mature package selection now chooses the lowest or highest version according to the resolver setting. The immature-version fallback remains unchanged.
Install regression coverage and release metadata
pnpm/crates/cli/tests/suite/install.rs, pnpm11/installing/deps-installer/test/install/resolutionMode.ts, .changeset/lowest-direct-under-minimum-release-age.md
Install tests verify lowest-direct and time-based selection under minimum release age. The changeset records patch releases for the affected packages.

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

Assessment against linked issues

Objective Addressed Explanation
Explicit resolutionMode must be applied with the default minimumReleaseAge ([#13752]) ❓ The tests use configured nonzero minimum release ages. They do not cover the default value.
Invalid resolutionMode values must produce validation errors ([#13752]) ❌ No validation or invalid-value test was added.

Sequence Diagram(s)

sequenceDiagram
  participant Install as Install tests
  participant Resolver as npm resolver
  participant Registry as Package metadata
  Install->>Resolver: Resolve with resolutionMode and minimumReleaseAge
  Resolver->>Registry: Read available package versions
  Registry-->>Resolver: Return versions and publication times
  Resolver-->>Install: Select the lowest mature version
Loading

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-13752

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

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

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix resolver: apply resolutionMode even when minimumReleaseAge is active

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Apply resolutionMode selection after minimumReleaseAge filters eligible versions.
• Preserve lowest-version fallback when no mature version satisfies the range.
• Add regression tests ensuring lowest-direct works with a nonzero release-age cutoff.
Diagram

graph TD
  C["Config: resolutionMode + minimumReleaseAge"] --> P["Version picker"] --> D{"Mature version satisfies?"}
  D -->|"yes"| M["Pick lowest/highest per mode"] --> R["Resolved version"]
  D -->|"no"| F["Fallback: lowest overall"] --> R
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Normalize into a single “eligible set then pick” helper
  • ➕ Further reduces risk of future divergence between the min-release-age path and normal path
  • ➕ Makes it harder to accidentally bypass resolutionMode again
  • ➖ Refactor touches more code than necessary for a bug fix
  • ➖ May be harder to backport cleanly
2. Share test fixtures/behavior contracts across Rust + TS implementations
  • ➕ Improves confidence that both stacks stay behaviorally aligned
  • ➕ Reduces chance of regressions where only one stack is fixed
  • ➖ Requires new shared harness or duplicated “contract” tests across languages
  • ➖ Higher upfront complexity than targeted tests

Recommendation: Current approach is the right fix: treat minimumReleaseAge as an eligibility filter and apply resolutionMode within the filtered set, keeping the existing lowest-version fallback for violation reporting. Consider a follow-up refactor to centralize the “eligible set then pick” structure if this area continues to evolve, but it’s reasonable to keep this PR focused and minimal-risk.

Files changed (5) +86 / -20

Bug fix (2) +28 / -20
pick_package.rsHonor pick_lowest_version when publishedBy/minimumReleaseAge is active +18/-14

Honor pick_lowest_version when publishedBy/minimumReleaseAge is active

• Updates picker option docs to reflect intended composition of maturity filtering with mode-based selection. Changes the min-release-age picker path to choose from mature versions using either lowest or highest pick based on 'pick_lowest_version', while retaining the existing fallback to lowest overall when no mature version satisfies.

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

pickPackage.tsApply pickLowestVersion when selecting among mature versions +10/-6

Apply pickLowestVersion when selecting among mature versions

• Updates the minimum-release-age code path to pick from mature versions using 'pickLowestVersion' (lowest vs highest) instead of always preferring the highest mature version. Keeps the documented fallback to lowest regardless of maturity when no mature version satisfies the range.

pnpm11/resolving/npm-resolver/src/pickPackage.ts

Tests (2) +51 / -0
install.rsAdd Rust CLI regression test for lowest-direct under release-age cutoff +33/-0

Add Rust CLI regression test for lowest-direct under release-age cutoff

• Introduces a new test that sets 'resolutionMode: lowest-direct' and 'minimumReleaseAge: 1' in pnpm-workspace.yaml. Verifies install resolves a direct dependency to the lowest satisfying mature version (100.0.0) rather than the highest (100.1.0).

pnpm/crates/cli/tests/suite/install.rs

resolutionMode.tsAdd TS installer test for lowest-direct with minimumReleaseAge +18/-0

Add TS installer test for lowest-direct with minimumReleaseAge

• Adds a regression test ensuring 'resolutionMode: lowest-direct' still selects the lowest satisfying direct dependency when 'minimumReleaseAge' is configured. Asserts the lockfile contains the lower version and not the higher one.

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

Documentation (1) +7 / -0
lowest-direct-under-minimum-release-age.mdAdd changeset documenting minimumReleaseAge + resolutionMode fix +7/-0

Add changeset documenting minimumReleaseAge + resolutionMode fix

• Adds a patch changeset for @pnpm/resolving.npm-resolver, pacquet, and pnpm. Documents that 'resolutionMode' is no longer ignored when a nonzero 'minimumReleaseAge' cutoff is active.

.changeset/lowest-direct-under-minimum-release-age.md

@greptile-apps

greptile-apps Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "test(resolver): pin time-based against a..." | Re-trigger Greptile

Comment on lines +130 to +136
// When minimumReleaseAge is active: pick from the mature versions by the
// caller's `pickLowestVersion` preference, since maturity narrows which
// versions are on offer and `resolutionMode` decides which end of what is
// left to take. If no mature version satisfies the range, fall back to the
// lowest version regardless of maturity so the resolver can report the
// violation inline and let the install layer (or other caller) decide what to
// do — never throw at this layer.

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.

P2 Remove duplicated picker narration

This comment narrates the branch, selection preference, and fallback implemented directly below, with the same explanation duplicated in the Rust implementation and tests. Keeping the behavior in code and focused tests avoids prose drifting as the two implementations evolve.

Context Used: Comments and docs in code are suspicious. Is test ... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trimmed in d9346f1, in both stacks. The comment is down to the two things the code cannot state: that minimumReleaseAge and resolutionMode compose (one narrows what is on offer, the other picks an end of the remainder) rather than being alternatives — which is exactly the assumption the bug was built on — and that the fallback drops the maturity filter deliberately, so the install layer reports the violation instead of this layer throwing. The narration of the branch and the fallback order is gone, and I removed a second copy of the fallback rationale that sat inside the Rust function body.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/cli/tests/suite/install.rs`:
- Around line 1503-1534: Add synchronized minimumReleaseAge coverage for
resolutionMode time-based in pnpm/crates/cli/tests/suite/install.rs:1503-1534
and pnpm11/installing/deps-installer/test/install/resolutionMode.ts:98-114.
Reuse the existing fixtures with fixed publish times, configure a nonzero
release age, and assert that the mature version is selected while the immature
candidate is excluded; update the corresponding Rust and TypeScript tests
consistently.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f5e402c0-415f-4a58-919d-79d9a4e15c2f

📥 Commits

Reviewing files that changed from the base of the PR and between d25c634 and 29ae15e.

📒 Files selected for processing (5)
  • .changeset/lowest-direct-under-minimum-release-age.md
  • pnpm/crates/cli/tests/suite/install.rs
  • pnpm/crates/resolving-npm-resolver/src/pick_package.rs
  • pnpm11/installing/deps-installer/test/install/resolutionMode.ts
  • pnpm11/resolving/npm-resolver/src/pickPackage.ts

Comment thread pnpm/crates/cli/tests/suite/install.rs Resolved
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     17.2±3.10ms    21.7 MB/sec    1.10     19.0±2.49ms    19.7 MB/sec
packument/parse                                  1.00     41.7±4.12µs  1590.0 MB/sec    1.07     44.7±5.43µs  1483.3 MB/sec
tarball/download_dependency                      1.09      4.1±0.84ms  1069.9 KB/sec    1.00      3.7±0.66ms  1166.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.03   261.1±10.26ms 61.3 KElem/sec    1.00   253.1±29.51ms 63.2 KElem/sec
workspace_resolution/hoist_heavy                 1.02   402.0±19.45ms        ? ?/sec    1.00   393.3±21.91ms        ? ?/sec

@qodo-code-review

qodo-code-review Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Wildcard lowest pick sorts 🐞 Bug ➹ Performance
Description
With minimumReleaseAge active, the updated mature-version path now uses the lowest-version picker
when pickLowestVersion is set, which for * ranges sorts all versions. On packages with many
versions this adds avoidable O(n log n) CPU work in resolutionMode lowest-direct/time-based
(previously the mature path always used the highest picker; the sort typically only occurred via the
fallback).
Code

pnpm11/resolving/npm-resolver/src/pickPackage.ts[R143-145]

+    const pickMature = pickerOpts.pickLowestVersion ? pickLowest : pickHighest
+    const mature = pickMature(pickerOpts, meta, targetSpec)
+    if (mature) return mature
Relevance

●● Moderate

Perf concern plausible, but needs special-casing '*' / picker internals; no close precedent on
wildcard sorting behavior.

PR-#12506
PR-#13779

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR changes the mature selection under publishedBy to use pickLowest when pickLowestVersion
is true. The pickLowestVersionByVersionRange implementation for '*' performs a full sort (TS) /
parse+sort (Rust), which can be costly for large version sets and is now reachable on the common
“mature match exists” path for lowest-direct/time-based.

pnpm11/resolving/npm-resolver/src/pickPackage.ts[127-173]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[642-661]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[159-175]
pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[333-360]

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 PR makes `pickLowestVersion` apply under `publishedBy`/`minimumReleaseAge` (mature-version selection). For wildcard ranges (`versionRange === '*'`), both TS and Rust lowest pickers currently sort all versions to find the minimum. This can become noticeably expensive on large packuments now that the mature path can hit the lowest picker (previously it always used the highest picker and only fell back to the lowest picker when no mature match existed).

## Issue Context
- `resolutionMode` `time-based` and `lowest-direct` enable `pickLowestVersion` for direct dependencies.
- With `minimumReleaseAge` active (default), the mature picker now calls the lowest picker, so `*` specs can newly incur full sorting.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[159-175]
- pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[333-360]

### Suggested implementation direction
- Replace the `'*'` special-case that sorts all versions with a linear scan that tracks the minimum parsed semver (including prereleases, matching the current intent of the `'*'` special-case).
- Keep behavior identical (e.g. still including prereleases for `'*'`), but reduce cost to O(n).

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



Informational

2. Brittle YAML append 🐞 Bug ☼ Reliability ⭐ New
Description
The new CLI test appends YAML text to pnpm-workspace.yaml without ensuring the file ends with a
newline or that the keys don’t already exist, making the test sensitive to future fixture changes
(it can concatenate onto the last line or create duplicate top-level keys). This can cause the test
to fail for the wrong reason (invalid config) or silently stop testing the intended behavior.
Code

pnpm/crates/cli/tests/suite/install.rs[R1545-1548]

+    let workspace_yaml = workspace.join("pnpm-workspace.yaml");
+    let mut existing = fs::read_to_string(&workspace_yaml).expect("read pnpm-workspace.yaml");
+    existing.push_str("resolutionMode: time-based\nminimumReleaseAge: 1\n");
+    fs::write(&workspace_yaml, existing).expect("write pnpm-workspace.yaml");
Relevance

● Weak

Similar request to stop raw YAML appends in Rust CLI tests was explicitly rejected recently.

PR-#13600
PR-#13790

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test directly appends two YAML keys via push_str, without newline/duplicate-key guards;
the harness’ workspace-yaml writer does not visibly enforce a trailing newline, and the repo already
has a helper that adds newline + asserts key absence, showing the intended robust pattern for these
tests.

pnpm/crates/cli/tests/suite/install.rs[1545-1548]
pnpm/crates/testing-utils/src/bin.rs[124-138]
pnpm/crates/cli/tests/suite/_utils/mod.rs[83-100]

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

### Issue description
The test mutates `pnpm-workspace.yaml` by blindly appending text. This assumes the file ends with a newline and that `resolutionMode` / `minimumReleaseAge` are not already present.

### Issue Context
The test harness writes the initial `pnpm-workspace.yaml`, and there is already a shared helper that appends top-level YAML keys safely by:
- asserting the key is not already present
- ensuring a trailing newline before appending

### Fix Focus Areas
- pnpm/crates/cli/tests/suite/install.rs[1545-1548]

### Suggested fix
Replace the manual `read_to_string` + `push_str` mutation with the existing helper (e.g. `append_workspace_yaml_key` / `set_minimum_release_age`) or replicate its safety checks locally (ensure trailing `\n` and assert no existing `resolutionMode:` / `minimumReleaseAge:` lines before appending).

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


Grey Divider

Context
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit d9346f1 ⚖️ Balanced

Results up to commit 29ae15e ⚖️ Balanced


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


Remediation recommended
1. Wildcard lowest pick sorts 🐞 Bug ➹ Performance
Description
With minimumReleaseAge active, the updated mature-version path now uses the lowest-version picker
when pickLowestVersion is set, which for * ranges sorts all versions. On packages with many
versions this adds avoidable O(n log n) CPU work in resolutionMode lowest-direct/time-based
(previously the mature path always used the highest picker; the sort typically only occurred via the
fallback).
Code

pnpm11/resolving/npm-resolver/src/pickPackage.ts[R143-145]

+    const pickMature = pickerOpts.pickLowestVersion ? pickLowest : pickHighest
+    const mature = pickMature(pickerOpts, meta, targetSpec)
+    if (mature) return mature
Relevance

●● Moderate

Perf concern plausible, but needs special-casing '*' / picker internals; no close precedent on
wildcard sorting behavior.

PR-#12506
PR-#13779

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR changes the mature selection under publishedBy to use pickLowest when pickLowestVersion
is true. The pickLowestVersionByVersionRange implementation for '*' performs a full sort (TS) /
parse+sort (Rust), which can be costly for large version sets and is now reachable on the common
“mature match exists” path for lowest-direct/time-based.

pnpm11/resolving/npm-resolver/src/pickPackage.ts[127-173]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[642-661]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[159-175]
pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[333-360]

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 PR makes `pickLowestVersion` apply under `publishedBy`/`minimumReleaseAge` (mature-version selection). For wildcard ranges (`versionRange === '*'`), both TS and Rust lowest pickers currently sort all versions to find the minimum. This can become noticeably expensive on large packuments now that the mature path can hit the lowest picker (previously it always used the highest picker and only fell back to the lowest picker when no mature match existed).

## Issue Context
- `resolutionMode` `time-based` and `lowest-direct` enable `pickLowestVersion` for direct dependencies.
- With `minimumReleaseAge` active (default), the mature picker now calls the lowest picker, so `*` specs can newly incur full sorting.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[159-175]
- pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[333-360]

### Suggested implementation direction
- Replace the `'*'` special-case that sorts all versions with a linear scan that tracks the minimum parsed semver (including prereleases, matching the current intent of the `'*'` special-case).
- Keep behavior identical (e.g. still including prereleases for `'*'`), but reduce cost to O(n).

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


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.

@codecov-commenter

codecov-commenter commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.24%. Comparing base (d25c634) to head (d9346f1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13831   +/-   ##
=======================================
  Coverage   88.23%   88.24%           
=======================================
  Files         625      625           
  Lines      102801   102803    +2     
=======================================
+ Hits        90710    90716    +6     
+ Misses      12091    12087    -4     

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

Review findings on #13831:

- `time-based` sets the same lowest-direct preference the fix restores,
  but only `lowest-direct` was pinned. Cover it in both stacks; both new
  tests were confirmed to fail without the fix.
- Trim the picker comments to the two things the code cannot say: that
  the release age and the resolution mode compose rather than compete,
  and that the fallback drops the maturity filter on purpose so the
  install layer reports the violation instead of this layer throwing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 11, 2026 13:55

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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 11, 2026
@qodo-code-review

Copy link
Copy Markdown

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

@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

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: d9346f12f859

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

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.643 ± 0.147 2.485 2.901 1.67 ± 0.19
pacquet@main 2.658 ± 0.142 2.517 2.935 1.68 ± 0.19
pnpr@HEAD 1.586 ± 0.130 1.394 1.832 1.00 ± 0.13
pnpr@main 1.580 ± 0.155 1.398 1.807 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6434002444,
      "stddev": 0.14694933474575142,
      "median": 2.5964380249000003,
      "user": 2.10143878,
      "system": 1.6305715399999996,
      "min": 2.4851972649,
      "max": 2.9011479849,
      "times": [
        2.5339338239,
        2.5457881029,
        2.6178040739,
        2.5357084549000004,
        2.7459065489000003,
        2.5848760639,
        2.6079999859000003,
        2.8756401399000002,
        2.9011479849,
        2.4851972649
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6577243441,
      "stddev": 0.1423120182016773,
      "median": 2.6003166539,
      "user": 2.3494629799999998,
      "system": 1.6801769399999997,
      "min": 2.5165620369000004,
      "max": 2.9354296039000003,
      "times": [
        2.8482817979,
        2.9354296039000003,
        2.6422099509000003,
        2.5881032049,
        2.5495139879,
        2.5574184339,
        2.5165620369000004,
        2.7634600359,
        2.5637342859000003,
        2.6125301029
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5858710411,
      "stddev": 0.13000460931985378,
      "median": 1.5769829494,
      "user": 1.45885388,
      "system": 1.4400598400000002,
      "min": 1.3943026429,
      "max": 1.8319618459,
      "times": [
        1.6376018409000002,
        1.3943026429,
        1.5163640579000002,
        1.8319618459,
        1.6536339999000003,
        1.4641146869000001,
        1.5015345149000001,
        1.6595427039000001,
        1.5132296529000002,
        1.6864244649000002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5797749846,
      "stddev": 0.1551236207329595,
      "median": 1.5873319699000001,
      "user": 1.3634516799999998,
      "system": 1.3623795399999996,
      "min": 1.3977329869000001,
      "max": 1.8068299799000003,
      "times": [
        1.4529026909000002,
        1.6222823049000001,
        1.6932019169,
        1.8068299799000003,
        1.8044436139000002,
        1.4293757499000002,
        1.3977329869000001,
        1.5630534029,
        1.6116105369000002,
        1.4163166629000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 309.0 ± 12.5 291.8 331.0 1.06 ± 0.16
pacquet@main 290.4 ± 41.0 252.3 367.0 1.00
pnpr@HEAD 318.0 ± 17.8 294.7 346.5 1.10 ± 0.17
pnpr@main 305.8 ± 10.3 282.4 317.3 1.05 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.30899892704000004,
      "stddev": 0.012542422367444196,
      "median": 0.31037037244000004,
      "user": 0.2737313,
      "system": 0.61238514,
      "min": 0.29180754494000005,
      "max": 0.33097603894000005,
      "times": [
        0.31608481894,
        0.29180754494000005,
        0.31152612994000006,
        0.31190974294,
        0.29320234394000005,
        0.29938774794000006,
        0.30296053994000005,
        0.30921461494,
        0.32291974794000006,
        0.33097603894000005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.29041494254000005,
      "stddev": 0.041045873110450985,
      "median": 0.27218264594,
      "user": 0.255524,
      "system": 0.55327684,
      "min": 0.25225819694,
      "max": 0.36698559594,
      "times": [
        0.28316387194000003,
        0.26261502294000005,
        0.35051026194,
        0.36698559594,
        0.32132674294,
        0.27772871194000004,
        0.25225819694,
        0.26639169894000003,
        0.25653274194000003,
        0.26663657994
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31801818154,
      "stddev": 0.017776212499410176,
      "median": 0.31743702194,
      "user": 0.2687104,
      "system": 0.57990644,
      "min": 0.29473462494,
      "max": 0.34652807794,
      "times": [
        0.33119587794000005,
        0.31565593594,
        0.34652807794,
        0.31921810794000005,
        0.32103533194000006,
        0.31519616094,
        0.34014931894000006,
        0.30128924594000006,
        0.29517913294000003,
        0.29473462494
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30576765023999997,
      "stddev": 0.010349300164496368,
      "median": 0.30954492194000005,
      "user": 0.2421407,
      "system": 0.59614424,
      "min": 0.28241879894000005,
      "max": 0.31733796594,
      "times": [
        0.30942636894000003,
        0.31241247494,
        0.31127644494000006,
        0.31733796594,
        0.29547475894,
        0.30094773194,
        0.30569232194,
        0.31302616094,
        0.30966347494,
        0.28241879894000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.738 ± 0.077 2.648 2.898 1.62 ± 0.14
pacquet@main 2.732 ± 0.072 2.669 2.904 1.61 ± 0.14
pnpr@HEAD 1.696 ± 0.142 1.500 1.891 1.00
pnpr@main 1.716 ± 0.171 1.516 1.961 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7384569304,
      "stddev": 0.07650637645084582,
      "median": 2.7225661693000003,
      "user": 1.9231994000000001,
      "system": 1.56650714,
      "min": 2.6477463648,
      "max": 2.8977216768000003,
      "times": [
        2.7171364948,
        2.8177375348000004,
        2.8977216768000003,
        2.7901403958000004,
        2.6816657278,
        2.6477463648,
        2.7075182928,
        2.6654248368,
        2.7314821358000003,
        2.7279958438
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7323606342000004,
      "stddev": 0.07156649142071828,
      "median": 2.7064486288000005,
      "user": 1.9210378000000001,
      "system": 1.54539674,
      "min": 2.6693533768,
      "max": 2.9041583628,
      "times": [
        2.6837319098,
        2.7901176818000004,
        2.9041583628,
        2.7712167228,
        2.7073916508000004,
        2.7003696398000003,
        2.6693533768,
        2.7055056068,
        2.6822530218000002,
        2.7095083688000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6955394164000002,
      "stddev": 0.142181215273995,
      "median": 1.7059062998,
      "user": 1.3016252000000001,
      "system": 1.37615054,
      "min": 1.4995849968,
      "max": 1.8905829288,
      "times": [
        1.7623635598,
        1.8212971958,
        1.4995849968,
        1.8905829288,
        1.6334494428,
        1.8378851118,
        1.5246438538,
        1.7869440918,
        1.5491939428,
        1.6494490398
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7163955650999998,
      "stddev": 0.17141628893331579,
      "median": 1.6720717588,
      "user": 1.4111523,
      "system": 1.5173628399999999,
      "min": 1.5156188328,
      "max": 1.9612419258,
      "times": [
        1.5372996728,
        1.8069966248,
        1.9115706858,
        1.9265188108,
        1.9612419258,
        1.5642883648,
        1.6812272438,
        1.5156188328,
        1.6629162737999998,
        1.5962772158
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 500.5 ± 41.1 440.8 557.4 1.47 ± 0.13
pacquet@main 491.6 ± 12.7 470.7 508.6 1.44 ± 0.06
pnpr@HEAD 354.9 ± 21.6 326.3 396.6 1.04 ± 0.07
pnpr@main 340.4 ± 12.5 323.0 364.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5004845076400001,
      "stddev": 0.041089195902333446,
      "median": 0.50831987674,
      "user": 0.6913461599999999,
      "system": 0.7655297,
      "min": 0.44083077724,
      "max": 0.55735945524,
      "times": [
        0.51793353024,
        0.52829568324,
        0.54068468624,
        0.55735945524,
        0.49870622324,
        0.53368566024,
        0.45805614224,
        0.45384807324000004,
        0.44083077724,
        0.47544484524
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4915871054400001,
      "stddev": 0.012705331541890078,
      "median": 0.49352895824000004,
      "user": 0.69275836,
      "system": 0.7750645,
      "min": 0.47068605924000007,
      "max": 0.50860050524,
      "times": [
        0.49142699824,
        0.47068605924000007,
        0.48682525724000003,
        0.50270215224,
        0.49563091824000005,
        0.49815234924000007,
        0.50443327324,
        0.4752434252400001,
        0.50860050524,
        0.48217011624000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3549073944400001,
      "stddev": 0.02157411456077325,
      "median": 0.35010483524,
      "user": 0.25883156,
      "system": 0.5981614,
      "min": 0.32625863424,
      "max": 0.39663302124000005,
      "times": [
        0.39663302124000005,
        0.38294852724000006,
        0.35470851424000005,
        0.35415646324000005,
        0.36626795124000006,
        0.33686102924000005,
        0.34119872124000006,
        0.34605320724000005,
        0.34398787524,
        0.32625863424
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3403674732400001,
      "stddev": 0.01253586986346432,
      "median": 0.34229162524,
      "user": 0.27420266,
      "system": 0.5472857,
      "min": 0.32304746424,
      "max": 0.36488320324000006,
      "times": [
        0.33632213324000004,
        0.34509572324000004,
        0.34608832424,
        0.33992214624000006,
        0.34466110424,
        0.32304746424,
        0.36488320324000006,
        0.32473057524000004,
        0.33005210124000006,
        0.34887195724000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.850 ± 0.067 1.773 1.962 5.53 ± 0.40
pacquet@main 1.801 ± 0.046 1.751 1.880 5.39 ± 0.37
pnpr@HEAD 0.334 ± 0.021 0.313 0.369 1.00
pnpr@main 0.347 ± 0.013 0.333 0.372 1.04 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8499798311399995,
      "stddev": 0.06652923141203178,
      "median": 1.83185659354,
      "user": 1.0118482400000002,
      "system": 0.9158299599999999,
      "min": 1.77296562254,
      "max": 1.96184963854,
      "times": [
        1.77296562254,
        1.8159919145399999,
        1.80580500154,
        1.7855521165400001,
        1.79396953354,
        1.84772127254,
        1.90976230754,
        1.93287304754,
        1.96184963854,
        1.87330785654
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8005121616400004,
      "stddev": 0.0462353578124795,
      "median": 1.79561172804,
      "user": 0.9330438400000001,
      "system": 0.8374510599999999,
      "min": 1.75129753054,
      "max": 1.87995614254,
      "times": [
        1.80715085754,
        1.75129753054,
        1.75429730154,
        1.87995614254,
        1.78407259854,
        1.76618889554,
        1.81051095754,
        1.84291358554,
        1.85411696454,
        1.75461678254
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33434859644,
      "stddev": 0.021214672786452227,
      "median": 0.32792691754000003,
      "user": 0.24903253999999997,
      "system": 0.54642846,
      "min": 0.31348244754,
      "max": 0.36920780154,
      "times": [
        0.35252813754,
        0.36920780154,
        0.34234060054,
        0.31517650754,
        0.31348244754,
        0.32501271354,
        0.31795808754,
        0.31360972754,
        0.33084112154,
        0.36332881954
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.34711089334,
      "stddev": 0.01297973449523024,
      "median": 0.34384743804,
      "user": 0.25943193999999997,
      "system": 0.58650996,
      "min": 0.33304355954000003,
      "max": 0.37165285754,
      "times": [
        0.35236636254000003,
        0.33304355954000003,
        0.33512028154,
        0.34323917254,
        0.33579110454,
        0.34445570354,
        0.37165285754,
        0.36302382454000004,
        0.33785221554,
        0.35456385154000003
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 247.2 ± 15.0 219.3 266.0 2.63 ± 0.21
pacquet@main 231.1 ± 31.6 187.5 291.2 2.46 ± 0.36
pnpr@HEAD 101.6 ± 6.2 90.6 113.9 1.08 ± 0.09
pnpr@main 94.1 ± 4.9 86.2 107.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24719263681333334,
      "stddev": 0.01495525345644938,
      "median": 0.24607659148000002,
      "user": 0.21791474666666666,
      "system": 0.07115942,
      "min": 0.21927198148000002,
      "max": 0.26598822848000003,
      "times": [
        0.24388316548000002,
        0.24528891348000004,
        0.26014249848000004,
        0.26518038748,
        0.24838704848000004,
        0.24529832048000003,
        0.24685486248000002,
        0.23657295748000004,
        0.26331552448,
        0.21927198148000002,
        0.26598822848000003,
        0.22612775348000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.23105940681333337,
      "stddev": 0.031649095610652794,
      "median": 0.22967100798000004,
      "user": 0.20774574666666668,
      "system": 0.06741942,
      "min": 0.18754483448000003,
      "max": 0.29118060748,
      "times": [
        0.24172536148000004,
        0.19467450348000004,
        0.19957917148,
        0.22155264748000003,
        0.18754483448000003,
        0.23539866548000002,
        0.26272842948,
        0.22584515248000003,
        0.20954264748000004,
        0.29118060748,
        0.23349686348000004,
        0.26944399748000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10156605137285715,
      "stddev": 0.006179146437977134,
      "median": 0.10054582348,
      "user": 0.02776922285714286,
      "system": 0.014720277142857138,
      "min": 0.09063774748,
      "max": 0.11385453448,
      "times": [
        0.09955063348000001,
        0.09897135248000001,
        0.10659897848000001,
        0.11385453448,
        0.10220614548000001,
        0.10738516048,
        0.10246855048,
        0.10075487148000001,
        0.09620556348,
        0.09342984548000001,
        0.10033677548,
        0.10995985948,
        0.09806466448000001,
        0.11382074148,
        0.10357450248000001,
        0.10231061248000001,
        0.10017680348,
        0.09456853048000001,
        0.09355209648,
        0.09486790348,
        0.10728906948,
        0.09635435348,
        0.10985325848000001,
        0.10739011048000001,
        0.09687423348,
        0.10364506548,
        0.09063774748,
        0.09914747448000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09407530708714285,
      "stddev": 0.004895022343142594,
      "median": 0.09316474648,
      "user": 0.024615579999999995,
      "system": 0.011464422857142859,
      "min": 0.08616438148000001,
      "max": 0.10746096248,
      "times": [
        0.09830261348000001,
        0.09368947448,
        0.09535912948,
        0.09598137148000001,
        0.09371534348,
        0.10136166548,
        0.10016909948000001,
        0.10272724748,
        0.09211068148,
        0.09158628348,
        0.09615147248,
        0.10746096248,
        0.09833341148000001,
        0.09578033348000001,
        0.09006584048,
        0.08902119348000001,
        0.09264001848,
        0.09038343848000001,
        0.08918399948,
        0.08731052148,
        0.08616438148000001,
        0.08848592448,
        0.09602231748000001,
        0.09263328548000001,
        0.09211729348,
        0.09113433248000001,
        0.09429562648,
        0.09192133548
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 959.3 ± 219.2 652.2 1430.8 1.01 ± 0.34
pacquet@main 949.2 ± 234.6 725.8 1404.2 1.00
pnpm@HEAD 3597.9 ± 201.0 3254.2 3893.9 3.79 ± 0.96
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.959264057,
      "stddev": 0.21915835666765882,
      "median": 0.973194051,
      "user": 0.9216126222222221,
      "system": 0.1450306933333333,
      "min": 0.652224692,
      "max": 1.4308113290000002,
      "times": [
        0.9642738820000001,
        0.807747086,
        0.772631413,
        1.043696658,
        0.996276342,
        0.973194051,
        1.4308113290000002,
        0.652224692,
        0.9925210600000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.9491955052222223,
      "stddev": 0.2345662587637668,
      "median": 0.9175590440000001,
      "user": 0.9255999555555555,
      "system": 0.1463246933333333,
      "min": 0.7257958280000001,
      "max": 1.4042393860000002,
      "times": [
        0.7257958280000001,
        1.219607541,
        1.4042393860000002,
        0.939048455,
        0.812646614,
        0.9175590440000001,
        1.032475687,
        0.728893682,
        0.7624933100000001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.597877960111111,
      "stddev": 0.2010214975763174,
      "median": 3.564747445,
      "user": 5.4755706222222225,
      "system": 0.32916569333333334,
      "min": 3.254196968,
      "max": 3.8939047560000004,
      "times": [
        3.50883737,
        3.591076901,
        3.671169017,
        3.4682709320000003,
        3.564747445,
        3.542366694,
        3.8939047560000004,
        3.886331558,
        3.254196968
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.607 ± 0.118 4.514 4.888 1.27 ± 0.04
pacquet@main 4.653 ± 0.142 4.492 4.926 1.28 ± 0.04
pnpr@HEAD 3.664 ± 0.132 3.555 3.969 1.01 ± 0.04
pnpr@main 3.638 ± 0.062 3.567 3.750 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6073373149200005,
      "stddev": 0.1179709622536068,
      "median": 4.571492236319999,
      "user": 2.1584021,
      "system": 1.5692745,
      "min": 4.51352638932,
      "max": 4.88789764032,
      "times": [
        4.55210249532,
        4.88789764032,
        4.61561910632,
        4.63212533032,
        4.51659795432,
        4.71553363032,
        4.51800169732,
        4.53108692832,
        4.51352638932,
        4.59088197732
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.653266760719999,
      "stddev": 0.14210364824609983,
      "median": 4.63239062282,
      "user": 2.2909795,
      "system": 1.7071833999999995,
      "min": 4.49202963432,
      "max": 4.92559724332,
      "times": [
        4.61735673832,
        4.66690141832,
        4.54853869032,
        4.52278206132,
        4.92559724332,
        4.49202963432,
        4.65062617632,
        4.64742450732,
        4.87226018232,
        4.58915095532
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.66371434862,
      "stddev": 0.13230135140417634,
      "median": 3.61664772732,
      "user": 1.6446975000000001,
      "system": 1.5828830000000003,
      "min": 3.55486340532,
      "max": 3.96912213332,
      "times": [
        3.68619494932,
        3.62718293132,
        3.63219998332,
        3.6051264083200003,
        3.56017706732,
        3.57613011332,
        3.55486340532,
        3.96912213332,
        3.82003397132,
        3.60611252332
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.63803062212,
      "stddev": 0.06165452168816154,
      "median": 3.62530923782,
      "user": 1.7438645999999995,
      "system": 1.6693893999999996,
      "min": 3.56735893032,
      "max": 3.75009150132,
      "times": [
        3.7205351543200003,
        3.66430109532,
        3.59853254132,
        3.60470079632,
        3.64591767932,
        3.58203251032,
        3.75009150132,
        3.58556150632,
        3.56735893032,
        3.66127450632
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13831
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,647.75 ms
(-2.10%)Baseline: 2,704.51 ms
3,245.41 ms
(81.58%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,772.97 ms
(-2.11%)Baseline: 1,811.21 ms
2,173.45 ms
(81.57%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
440.83 ms
(-4.69%)Baseline: 462.51 ms
555.02 ms
(79.43%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
219.27 ms
(-7.04%)Baseline: 235.89 ms
283.06 ms
(77.46%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,485.20 ms
(+0.87%)Baseline: 2,463.69 ms
2,956.43 ms
(84.06%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,513.53 ms
(-0.47%)Baseline: 4,534.69 ms
5,441.62 ms
(82.94%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
291.81 ms
(-2.99%)Baseline: 300.81 ms
360.97 ms
(80.84%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
652.22 ms
(-11.96%)Baseline: 740.82 ms
888.99 ms
(73.37%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13831
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,499.58 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
313.48 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
326.26 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
90.64 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,394.30 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,554.86 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
294.73 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit efb3d74 into main Aug 11, 2026
42 of 43 checks passed
@zkochan
zkochan deleted the fix-13752 branch August 11, 2026 15:14
zkochan added a commit that referenced this pull request Aug 12, 2026
…13877)

An auto-installed (hoisted) peer of a transitive dependency was
resolved with the importer-level pick options, so under
resolutionMode: lowest-direct / time-based it landed on the lowest
version satisfying the peer range. A hoisted peer is not a dependency
the user declared: the TypeScript CLI resolves it like a transitive
dep, to the highest satisfying version under the subdep publish-date
cutoff. pacquet now switches the importer ctx's depth-0 pick options
to the subdep options once the manifest-declared direct deps have
seeded — everything extend_tree walks after that point is a hoist arm.

The bug was latent (any active release-age cutoff disabled
resolutionMode entirely, masking it) and was unmasked by
#13831. It surfaced in #13871, where clipanion's
typanion "*" peer resolved to [email protected] - whose published
manifest ships its build tooling as runtime dependencies - adding
~136 spurious packages to the lockfile.

The TypeScript CLI already behaves this way; it gains a pinning test
for the same scenario.
zkochan added a commit to Ayush442842q/pnpm that referenced this pull request Aug 21, 2026
`allowBuilds` keys are not always bare package names: builds ignored
for git/tarball dependencies are keyed by their dep path
(`name@<non-semver source>`). Matching raw keys against the resolved
name index would wrongly delete undecided entries for still-installed
git dependencies.

- Extract the package name from the key before pruning, and keep
  entries whose key yields no provable name (hashless git-repo keys,
  malformed shapes): `packageNameFromAllowBuildKey` in
  `@pnpm/building.policy`, and its Rust mirror
  `allow_build_key_package_name` in the workspace-manifest-writer
  crate.
- Bail out of the Rust prune when the block re-parse fails instead of
  deleting the whole block, and stop mutating the decoded view before
  the flow-style bail.
- Share the undecided-placeholder literal via `UNDECIDED_ALLOW_BUILD`.
- Drop the stray resolution-mode changeset that duplicated the release
  note of pnpm#13831, already released in 11.22.0.

Co-Authored-By: Claude Fable 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.

resolutionMode: lowest-direct is silently ignored in v11 unless minimumReleaseAge: 0 is explicitly set

3 participants