Skip to content

fix(npm-resolver): apply the publishedBy cutoff to the held-back-update baseline - #13115

Merged
zkochan merged 7 commits into
pnpm:mainfrom
xianjianlf2:fix/held-back-warning-release-age-13071
Aug 6, 2026
Merged

zkochan merged 7 commits into
pnpm:mainfrom
xianjianlf2:fix/held-back-warning-release-age-13071

Conversation

@xianjianlf2

@xianjianlf2 xianjianlf2 commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The held-back-update warning printed by pnpm update blamed "your manifests and already installed dependencies" (and recommended an override) even when minimumReleaseAge was the actual reason a newer version was not picked. The baseline pick that the warning compares against ran without the publishedBy / minimumReleaseAge filter, so any hold-back looked like a manifest constraint. Both stacks had the gap (the Rust side hardcoded published_by: None); both are fixed in this PR.

Closes #13071

Squash Commit Body

The held-back-update warning compares the constrained pick against a
baseline "what would have been picked" resolution. That baseline ran
without applying the publishedBy cutoff, so when minimumReleaseAge was
the real reason a newer version was skipped, the warning wrongly
attributed the hold-back to manifests/installed dependencies and
recommended an override that would defeat the age gate.

TypeScript: the baseline pick in resolving/npm-resolver now filters
package metadata through filterPkgMetadataByPublishDate (honoring
publishedByExclude) before picking. Rust: preferred_overlay's baseline
logic is extracted into a testable held_back_preferred that applies the
same filter instead of hardcoding published_by: None.

Regression tests in both stacks pin the corrected warning behavior.

Closes pnpm/pnpm#13071

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pnpm/ port.
  • Added a changeset (@pnpm/resolving.npm-resolver, pnpm, pacquet).
  • Added or updated tests (TS test/heldBackUpdateWarning.test.ts; Rust preferred_overlay/tests.rs — TS npm-resolver suite 279 passing, Rust crate 294 + 3 passing, fmt/clippy clean).
  • Updated the documentation if needed — n/a, corrects an inaccurate warning message path.

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


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed misleading “held-back update” warnings when newer versions are blocked by minimumReleaseAge.
    • Prevented recommendations from suggesting overrides that bypass age-based protection.
    • Preserved accurate warnings for manifest-pinned versions and publish-date policy exclusions.
  • Tests

    • Added coverage for age restrictions, manifest pinning, mature newer versions, and excluded versions.

@xianjianlf2
xianjianlf2 requested a review from zkochan as a code owner July 18, 2026 03:00
@welcome

welcome Bot commented Jul 18, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Held-back update warning baselines now apply minimumReleaseAge filtering in both Rust and TypeScript npm resolvers. Age-gated versions no longer trigger warnings, while manifest-pinned versions continue to do so. Unit, integration, and Changeset coverage were added.

Changes

Held-back warning behavior

Layer / File(s) Summary
Rust warning baseline and coverage
pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs, pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs, pnpm/crates/resolving-npm-resolver/src/preferred_overlay/tests.rs
The Rust resolver filters baseline metadata by publish maturity before selecting the preferred version. Tests cover age gates, manifest pins, mature versions, and version-policy exclusions.
TypeScript warning integration and regression tests
pnpm11/resolving/npm-resolver/src/index.ts, pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts, .changeset/held-back-warning-release-age.md
The TypeScript resolver applies the maturity cutoff to warning baselines, tests warning suppression and retention scenarios, and documents the behavior change.

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

Sequence Diagram(s)

sequenceDiagram
  participant Resolver
  participant MetadataFilter
  participant VersionPicker
  participant WarningLogger
  Resolver->>MetadataFilter: Filter versions by release-age cutoff
  MetadataFilter-->>Resolver: Return eligible baseline metadata
  Resolver->>VersionPicker: Select preferred version
  VersionPicker-->>Resolver: Return preferred version
  Resolver->>WarningLogger: Emit warning only when versions differ
Loading

Assessment against linked issues

Objective Addressed Explanation
Suppress held-back warnings when minimumReleaseAge prevents the newer version from being selected [#13071] ✅
Continue warning when a manifest pin, rather than the age gate, holds back the version [#13071] ✅
Avoid recommending an override that bypasses the configured age restriction [#13071] ✅

Possibly related PRs

  • pnpm/pnpm#13504: Modifies the same publish-date metadata filtering path and related npm resolver behavior.
  • pnpm/pnpm#13512: Modifies minimumReleaseAge filtering in the npm resolver.
  • pnpm/pnpm#13527: Modifies dependency version-selection filtering for constrained versions.

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

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

  • Safe to merge. The change is a targeted fix with parallel TypeScript and Rust implementations, both backed by new tests. No logic regressions were found.
  • The extraction of applyPublishedByPolicy is a straightforward refactor — the same filtering logic that was inline is now shared, and both call sites (the actual pick and the baseline) now agree on what the cutoff admits. The five new tests in each stack cover the key behavioral cases. The only gap is an untested abbreviated-metadata path in the baseline (documented by a comment), but this is a pre-existing untested branch that the PR does not regress.
  • No files require special attention.

Reviews (6): Last reviewed commit: "refactor(npm-resolver): route the publis..." | Re-trigger Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 18, 2026
@codecov-commenter

codecov-commenter commented Jul 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (ecd540b) to head (70c9a3f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13115      +/-   ##
==========================================
+ Coverage   88.12%   88.13%   +0.01%     
==========================================
  Files         609      611       +2     
  Lines       99159    99396     +237     
==========================================
+ Hits        87383    87602     +219     
- Misses      11776    11794      +18     

☔ 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 Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 70c9a3f9f71e

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.587 ± 0.101 2.424 2.724 1.67 ± 0.18
pacquet@main 2.678 ± 0.178 2.436 2.920 1.73 ± 0.21
pnpr@HEAD 1.644 ± 0.156 1.389 1.881 1.06 ± 0.15
pnpr@main 1.548 ± 0.158 1.379 1.796 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5866849625400006,
      "stddev": 0.10067989250697577,
      "median": 2.60624398044,
      "user": 1.9355047000000003,
      "system": 1.55388378,
      "min": 2.4235439619399997,
      "max": 2.72366757794,
      "times": [
        2.4235439619399997,
        2.72366757794,
        2.60860660794,
        2.60967249594,
        2.56326078394,
        2.46589268794,
        2.65530146894,
        2.60388135294,
        2.71585068094,
        2.49717200694
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.67822087324,
      "stddev": 0.17770033489588358,
      "median": 2.6565025589399998,
      "user": 2.2783613,
      "system": 1.74323288,
      "min": 2.43624002794,
      "max": 2.92026604194,
      "times": [
        2.50350966094,
        2.60218361394,
        2.50746278894,
        2.7108215039399997,
        2.92026604194,
        2.86255517794,
        2.7938349639399997,
        2.56577175294,
        2.8795631999399998,
        2.43624002794
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6442228415400002,
      "stddev": 0.15611381899807436,
      "median": 1.59970125844,
      "user": 1.6842925000000002,
      "system": 1.5081679799999999,
      "min": 1.38928990494,
      "max": 1.8806330799400002,
      "times": [
        1.79864334894,
        1.8437640619400002,
        1.5771911519400001,
        1.57252179594,
        1.62221136494,
        1.67947625594,
        1.5127912139400002,
        1.8806330799400002,
        1.38928990494,
        1.56570623694
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5478133115400001,
      "stddev": 0.15830347954652446,
      "median": 1.51892084644,
      "user": 1.5456911,
      "system": 1.4656256799999996,
      "min": 1.3794713689400002,
      "max": 1.7962087239400002,
      "times": [
        1.7962087239400002,
        1.3892747059400001,
        1.55651444794,
        1.4303812739400001,
        1.41000234494,
        1.3794713689400002,
        1.7588607329400001,
        1.71634987994,
        1.5597423919400002,
        1.4813272449400001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 314.8 ± 12.6 294.0 341.7 1.00 ± 0.06
pacquet@main 313.7 ± 13.4 291.2 332.6 1.00
pnpr@HEAD 330.8 ± 9.8 314.7 341.7 1.05 ± 0.05
pnpr@main 337.8 ± 14.3 315.2 366.1 1.08 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.31481295086,
      "stddev": 0.012590225033932562,
      "median": 0.31351393695999996,
      "user": 0.27170126,
      "system": 0.6079138399999999,
      "min": 0.29404372396,
      "max": 0.34165700796,
      "times": [
        0.31032160496,
        0.30521713796,
        0.31784234096,
        0.32493356696,
        0.30908461696,
        0.31202272395999997,
        0.29404372396,
        0.31500514996,
        0.34165700796,
        0.31800163496
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.31371057356,
      "stddev": 0.013418881421979502,
      "median": 0.31521518796000003,
      "user": 0.27632726,
      "system": 0.62034904,
      "min": 0.29124476296,
      "max": 0.33258489096,
      "times": [
        0.31384562496,
        0.29124476296,
        0.33258489096,
        0.32486142096,
        0.32824845296,
        0.31448463496,
        0.30002113196,
        0.29887324096,
        0.31594574096,
        0.31699583396
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33079077476,
      "stddev": 0.009818740727653182,
      "median": 0.33428985746,
      "user": 0.28075895999999995,
      "system": 0.6118792399999998,
      "min": 0.31465620796,
      "max": 0.34172593896,
      "times": [
        0.33377373396,
        0.34172593896,
        0.33637018196,
        0.33480598096,
        0.32473473996,
        0.33999403096,
        0.34024578796,
        0.32405911596,
        0.31754202896,
        0.31465620796
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.33782261665999996,
      "stddev": 0.014294437972453462,
      "median": 0.33900709846,
      "user": 0.28036596,
      "system": 0.65029454,
      "min": 0.31515112596,
      "max": 0.36605931696,
      "times": [
        0.34799207896,
        0.36605931696,
        0.34193902496,
        0.33846214996,
        0.34653669596,
        0.33955204696,
        0.31515112596,
        0.32988940796,
        0.32683017296,
        0.32581414596
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.734 ± 0.022 2.700 2.767 1.66 ± 0.16
pacquet@main 2.704 ± 0.114 2.604 2.998 1.64 ± 0.17
pnpr@HEAD 1.650 ± 0.154 1.467 1.916 1.00
pnpr@main 1.665 ± 0.161 1.499 1.963 1.01 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.73422706568,
      "stddev": 0.021545432350121078,
      "median": 2.73502748748,
      "user": 2.16901114,
      "system": 1.7489426799999996,
      "min": 2.69976599548,
      "max": 2.76746901948,
      "times": [
        2.74121704848,
        2.76746901948,
        2.7227323384799997,
        2.71491899948,
        2.71487556048,
        2.69976599548,
        2.74420198048,
        2.75839899448,
        2.74985279348,
        2.72883792648
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.70424422198,
      "stddev": 0.11360032546814124,
      "median": 2.6675920404799998,
      "user": 2.09639234,
      "system": 1.69332168,
      "min": 2.60438004948,
      "max": 2.99781025148,
      "times": [
        2.6965809634799998,
        2.64674174148,
        2.60438004948,
        2.73776906248,
        2.99781025148,
        2.7556758274799997,
        2.64723345148,
        2.66670451348,
        2.66847956748,
        2.62106679148
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6497510300799998,
      "stddev": 0.1543057270609285,
      "median": 1.64909804398,
      "user": 1.48153014,
      "system": 1.38558458,
      "min": 1.46700566948,
      "max": 1.9156464984800001,
      "times": [
        1.87892224748,
        1.46700566948,
        1.6445919314800002,
        1.6536041564800001,
        1.7123523054800003,
        1.5176968984800001,
        1.9156464984800001,
        1.48188362848,
        1.5610239174800002,
        1.66478304748
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6650010002800002,
      "stddev": 0.16065094435541383,
      "median": 1.6336052049800003,
      "user": 1.54458084,
      "system": 1.5277139800000001,
      "min": 1.49893489448,
      "max": 1.96297245748,
      "times": [
        1.50908261648,
        1.75640945848,
        1.52859411548,
        1.7916605814800002,
        1.5201026534800002,
        1.6730930954800003,
        1.49893489448,
        1.8150428154800002,
        1.5941173144800003,
        1.96297245748
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 477.1 ± 28.7 416.2 512.5 1.44 ± 0.11
pacquet@main 445.1 ± 37.6 392.7 488.4 1.34 ± 0.13
pnpr@HEAD 334.2 ± 9.1 324.3 350.1 1.01 ± 0.05
pnpr@main 331.4 ± 14.8 314.0 364.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.47709609238000006,
      "stddev": 0.028702469159118536,
      "median": 0.48176433078,
      "user": 0.6341552,
      "system": 0.87607658,
      "min": 0.41620398928,
      "max": 0.51249131528,
      "times": [
        0.41620398928,
        0.47316369928,
        0.48651973828,
        0.50566733628,
        0.47700892328,
        0.51249131528,
        0.49873049628,
        0.46222133528000003,
        0.45040065128,
        0.48855343928
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4451462788800001,
      "stddev": 0.03758227460149899,
      "median": 0.45945691328000005,
      "user": 0.6019416000000001,
      "system": 0.8051209800000001,
      "min": 0.39269574028,
      "max": 0.48837762428000003,
      "times": [
        0.40554582828,
        0.48837762428000003,
        0.46966081028,
        0.45859131928,
        0.46032250728,
        0.47590349628,
        0.48513179528,
        0.41627208228,
        0.39269574028,
        0.39896158528000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33419490518,
      "stddev": 0.009080064255695578,
      "median": 0.33218778328,
      "user": 0.22545489999999999,
      "system": 0.58039968,
      "min": 0.32427584528,
      "max": 0.35013779728,
      "times": [
        0.33237453228,
        0.32427584528,
        0.33200103428,
        0.32507482628,
        0.35013779728,
        0.34416594928,
        0.32449311728,
        0.34354152128,
        0.33559907028,
        0.33028535828
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.33143782737999994,
      "stddev": 0.01478365376013558,
      "median": 0.33131694478,
      "user": 0.2201035,
      "system": 0.5665596799999999,
      "min": 0.31401746328,
      "max": 0.36412215828,
      "times": [
        0.36412215828,
        0.33132719828,
        0.31884634928,
        0.33535773928,
        0.33130669128,
        0.33355290328,
        0.34308516028,
        0.31509912628,
        0.32766348428,
        0.31401746328
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.742 ± 0.022 1.725 1.800 5.64 ± 0.27
pacquet@main 1.720 ± 0.012 1.701 1.740 5.56 ± 0.26
pnpr@HEAD 0.309 ± 0.014 0.291 0.335 1.00
pnpr@main 0.316 ± 0.011 0.302 0.331 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7422278094200003,
      "stddev": 0.022477668136286818,
      "median": 1.73380206752,
      "user": 0.7890282399999999,
      "system": 0.7930322000000001,
      "min": 1.72523320852,
      "max": 1.7998028725200002,
      "times": [
        1.7998028725200002,
        1.75062896052,
        1.75099425352,
        1.74512466652,
        1.73302739452,
        1.73457674052,
        1.72523320852,
        1.72603799552,
        1.7275870505200002,
        1.72926495152
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.71991757342,
      "stddev": 0.011908048031206922,
      "median": 1.71964836502,
      "user": 0.73323384,
      "system": 0.7777779,
      "min": 1.70109717952,
      "max": 1.73969434452,
      "times": [
        1.73969434452,
        1.71935324652,
        1.70109717952,
        1.71278871252,
        1.7294389445200002,
        1.72956270352,
        1.72519080152,
        1.71994348352,
        1.7036000015200001,
        1.71850631652
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30909787192000004,
      "stddev": 0.014104303883828656,
      "median": 0.30787412402000003,
      "user": 0.18343514,
      "system": 0.5352746999999999,
      "min": 0.29063038052,
      "max": 0.33464820352,
      "times": [
        0.29063038052,
        0.30896613952,
        0.31006447752,
        0.29944601452,
        0.30199437952,
        0.33464820352,
        0.32893414952,
        0.31513449452,
        0.30678210852,
        0.29437837152
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31620626562,
      "stddev": 0.011270518382151809,
      "median": 0.31315369602,
      "user": 0.20311893999999997,
      "system": 0.5405812999999999,
      "min": 0.30199339552,
      "max": 0.33132212452,
      "times": [
        0.30199339552,
        0.32773625052,
        0.32750834952,
        0.31767941552,
        0.30681005152,
        0.30862797652,
        0.30601621452,
        0.30722430652,
        0.33132212452,
        0.32714457152
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 187.0 ± 11.5 175.2 216.0 1.96 ± 0.15
pacquet@main 188.5 ± 8.8 175.0 205.3 1.98 ± 0.13
pnpr@HEAD 97.3 ± 6.4 87.6 109.6 1.02 ± 0.08
pnpr@main 95.4 ± 4.5 86.3 106.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1869743135971429,
      "stddev": 0.01148898099233408,
      "median": 0.18554268074000002,
      "user": 0.16428391999999997,
      "system": 0.0951944457142857,
      "min": 0.17516164774,
      "max": 0.21598000174,
      "times": [
        0.19819070974,
        0.17949857774,
        0.19689142274000002,
        0.18933568074,
        0.18618161074,
        0.17713304574,
        0.17516164774,
        0.17682236874,
        0.17558812574000002,
        0.17891577074,
        0.18942723074,
        0.18490375074,
        0.19361044674,
        0.21598000174
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.18850612045428572,
      "stddev": 0.008755669669902606,
      "median": 0.18828647774,
      "user": 0.16348634857142857,
      "system": 0.09916430285714285,
      "min": 0.17498142774,
      "max": 0.20534017974000002,
      "times": [
        0.20090980874,
        0.19398352174,
        0.19056514574,
        0.19559223274,
        0.19336717174,
        0.19107281774,
        0.18600780974,
        0.18212556774,
        0.18037580674,
        0.20534017974000002,
        0.18072212374000002,
        0.18060365874,
        0.18343841374,
        0.17498142774
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09734742192750001,
      "stddev": 0.0064422716628348186,
      "median": 0.09679712174,
      "user": 0.02408657625,
      "system": 0.014943972500000001,
      "min": 0.08756929174,
      "max": 0.10958408274,
      "times": [
        0.08921183974,
        0.08759196274,
        0.08974611274,
        0.09757766874,
        0.09772789274,
        0.09814050074,
        0.09790811074,
        0.09506891774,
        0.09515982474,
        0.09587762274,
        0.09673466074,
        0.09426571874,
        0.09270988474,
        0.08756929174,
        0.08947633674,
        0.09147159674,
        0.09685958274,
        0.09430204474000001,
        0.09934587674,
        0.10221906074,
        0.09905542474,
        0.10912773174,
        0.10655016374,
        0.10905380074,
        0.10232905874,
        0.10575679574,
        0.10423829274,
        0.10958408274,
        0.10423503274,
        0.09018938774,
        0.09375786374,
        0.09227535874
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09539453556758622,
      "stddev": 0.0044858625964150824,
      "median": 0.09523004774,
      "user": 0.022243006206896544,
      "system": 0.015459418620689657,
      "min": 0.08631266274,
      "max": 0.10633618174000001,
      "times": [
        0.09731071774,
        0.10633618174000001,
        0.09688013074,
        0.08879075174,
        0.08631266274,
        0.09283452774,
        0.09273108474,
        0.09285712574,
        0.09105503774,
        0.09271762174,
        0.09389497674,
        0.09350235274,
        0.08959573774,
        0.09025996974,
        0.09694938674,
        0.09559436874,
        0.09525607974,
        0.09523004774,
        0.09923369474,
        0.09696254874,
        0.09497162974000001,
        0.09725604374,
        0.10170819774,
        0.09433025974,
        0.09594402974,
        0.09457536474,
        0.09779619674000001,
        0.09963437674,
        0.10592042674
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.132 ± 0.235 0.808 1.484 1.01 ± 0.40
pacquet@main 1.123 ± 0.386 0.624 1.794 1.00
pnpm@HEAD 3.271 ± 0.128 3.039 3.403 2.91 ± 1.01
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1317720478933333,
      "stddev": 0.2348106459046836,
      "median": 1.11303169656,
      "user": 1.0481484644444443,
      "system": 0.34286167777777776,
      "min": 0.80837656156,
      "max": 1.48396612256,
      "times": [
        1.00548227056,
        0.81998488956,
        1.15227400556,
        1.48396612256,
        1.3175610045600001,
        1.11303169656,
        1.1022222725600002,
        1.38304960756,
        0.80837656156
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.12325556756,
      "stddev": 0.3858255827744713,
      "median": 1.17488866456,
      "user": 1.0680002422222223,
      "system": 0.3324082333333333,
      "min": 0.6238452315599999,
      "max": 1.7942543895600003,
      "times": [
        1.4340822315600001,
        0.85004547056,
        1.33247485756,
        0.6238452315599999,
        1.7942543895600003,
        1.32377940156,
        0.72278882656,
        0.85314103456,
        1.17488866456
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.271344220782223,
      "stddev": 0.12784365913004964,
      "median": 3.31906630456,
      "user": 4.720845797777778,
      "system": 0.32504856666666665,
      "min": 3.03935928856,
      "max": 3.4029029945600002,
      "times": [
        3.3740412815600003,
        3.31495838256,
        3.03935928856,
        3.36492597356,
        3.31906630456,
        3.4029029945600002,
        3.12046003356,
        3.17344723256,
        3.3329364955600003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.597 ± 0.161 4.448 4.900 1.29 ± 0.06
pacquet@main 4.577 ± 0.140 4.436 4.821 1.28 ± 0.06
pnpr@HEAD 3.576 ± 0.129 3.480 3.868 1.00 ± 0.05
pnpr@main 3.562 ± 0.116 3.451 3.776 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.59748394302,
      "stddev": 0.16070002533672947,
      "median": 4.5539645769199995,
      "user": 1.9813293599999997,
      "system": 1.52237844,
      "min": 4.44751597342,
      "max": 4.89971674942,
      "times": [
        4.523377229419999,
        4.4860447494199995,
        4.5845519244199995,
        4.857464665419999,
        4.46619134142,
        4.598761072419999,
        4.633617860419999,
        4.47759786442,
        4.44751597342,
        4.89971674942
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.5767801735199996,
      "stddev": 0.14048132177135023,
      "median": 4.51714188542,
      "user": 2.0677990599999996,
      "system": 1.5128269399999998,
      "min": 4.43553328342,
      "max": 4.821234760419999,
      "times": [
        4.49658912442,
        4.750000303419999,
        4.51742931342,
        4.51685445742,
        4.48154813342,
        4.821234760419999,
        4.43553328342,
        4.53609746342,
        4.750989630419999,
        4.46152526542
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5755943621199995,
      "stddev": 0.12922626952243566,
      "median": 3.51399540092,
      "user": 1.48117396,
      "system": 1.3576768399999999,
      "min": 3.47984617042,
      "max": 3.8683162544200003,
      "times": [
        3.4868231234200002,
        3.4895704854200003,
        3.5273089514200002,
        3.8683162544200003,
        3.5321495304200003,
        3.49975258742,
        3.69820622842,
        3.47984617042,
        3.50068185042,
        3.6732884394200003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.56196562702,
      "stddev": 0.11553859251004601,
      "median": 3.54157439042,
      "user": 1.3595292600000002,
      "system": 1.31263614,
      "min": 3.45120624742,
      "max": 3.77590034742,
      "times": [
        3.74716909342,
        3.5454773104200004,
        3.57655641842,
        3.46325974242,
        3.46384570942,
        3.5376714704200003,
        3.45120624742,
        3.4781719264200004,
        3.58039800442,
        3.77590034742
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13115
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,673.87 ms
(-9.44%)Baseline: 2,952.67 ms
3,543.21 ms
(75.46%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,822.91 ms
(-13.58%)Baseline: 2,109.31 ms
2,531.17 ms
(72.02%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
525.24 ms
(-29.39%)Baseline: 743.88 ms
892.66 ms
(58.84%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
307.92 ms
(-30.85%)Baseline: 445.33 ms
534.39 ms
(57.62%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,581.65 ms
(-4.04%)Baseline: 2,690.41 ms
3,228.49 ms
(79.96%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,470.95 ms
(-6.67%)Baseline: 4,790.33 ms
5,748.40 ms
(77.78%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
247.58 ms
(-17.86%)Baseline: 301.40 ms
361.68 ms
(68.45%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13115
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,485.99 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
282.65 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
285.71 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
78.44 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,491.52 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,579.89 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
263.11 ms
🐰 View full continuous benchmarking report in Bencher

@xianjianlf2
xianjianlf2 force-pushed the fix/held-back-warning-release-age-13071 branch from d30b626 to 6492efb Compare July 22, 2026 03:27
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main and pushed the updated branch (6492efb). The previous Audit dependencies failure is stale after the rebase; local high-threshold audit now exits successfully with only the existing ignored moderate advisory.

Local checks:

  • PATH=/Users/even/.nvm/versions/node/v24.18.0/bin:$PATH COREPACK_ENABLE_PROJECT_SPEC=0 node /Users/even/.cache/node/corepack/v1/pnpm/11.13.0/bin/pnpm.cjs --dir pnpm11/resolving/npm-resolver test (22 suites / 290 tests passing)
  • cargo test -p pacquet-resolving-npm-resolver preferred_overlay (3 tests passing)
  • PATH=/Users/even/.nvm/versions/node/v24.18.0/bin:$PATH COREPACK_ENABLE_PROJECT_SPEC=0 node /Users/even/.cache/node/corepack/v1/pnpm/11.13.0/bin/pnpm.cjs audit --audit-level high

Note: pushes use HUSKY=0 locally because this checkout's Corepack shim for [email protected] points at a missing cached bin/pnpm.mjs; validation used a working pnpm entrypoint.

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Regex for trailing slash ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The Jest test uses a regex (/\/$/) to strip a trailing slash from registries.default, even
though a simple string operation would be clearer and aligns with repo parsing conventions. This
introduces avoidable regex parsing where direct string logic would suffice.
Code

pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[66]

+  getMockAgent().get(registries.default.replace(/\/$/, ''))
Evidence
PR Compliance ID 6 requires preferring simple string operations over custom regex when regex is not
needed. The new tests call registries.default.replace(/\/$/, '') in three places to remove a
trailing slash, which can be implemented with endsWith('/') + slice (or a small helper) without
regex.

CLAUDE.md: Prefer simple string operations over custom regex; use existing parser-combinator pattern for structured parsing
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[66-66]
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[92-92]
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[116-116]

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 strips a trailing `/` using a regex (`/\/$/`), which is unnecessary for this simple operation.

## Issue Context
Compliance guidance prefers simple string operations over custom regex when the parsing need is straightforward.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[66-67]
- pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[92-93]
- pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[116-117]

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


2. Baseline packument re-filtering ✓ Resolved 🐞 Bug ➹ Performance
Description
When publishedBy/published_by is set, the held-back warning path (warnOnceOnHeldBackUpdate /
held_back_preferred) rebuilds a maturity-filtered baseline by running
filterPkgMetadataByPublishDate / filter_pkg_metadata_by_publish_date, even though the actual
version pick already performs the same maturity filtering. This duplicates a full packument
scan/clone (including potentially large time data), adding O(packument size) CPU/allocations per
resolved range during pnpm update, which can noticeably slow updates on large versions maps and
increases CPU exposure to attacker-controlled registry metadata.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R391-401]

+  let baselineMeta = meta
+  if (opts.publishedBy != null) {
+    const excludeResult = opts.publishedByExclude?.(meta.name) ?? false
+    // When the metadata is abbreviated (no `time` field), the pick only
+    // succeeded because every version predates the cutoff (see
+    // `pickPackageFromMeta`), so there is nothing to filter out.
+    if (excludeResult !== true && meta.time != null) {
+      assertMetaHasTime(meta)
+      const trustedVersions = Array.isArray(excludeResult) ? excludeResult : undefined
+      baselineMeta = filterPkgMetadataByPublishDate(meta, opts.publishedBy, trustedVersions)
+    }
Evidence
The cited code paths show that the held-back warning helper is invoked after a successful pick on
the main resolve/update flow, and when publishedBy/published_by is enabled it computes its
baseline by calling the packument-filtering helper (filterPkgMetadataByPublishDate /
filter_pkg_metadata_by_publish_date) to allocate a filtered metadata/Package. However, the pick
logic already applies the same published-by maturity cutoff inside pickPackageFromMeta /
pick_package_from_meta, so invoking the filter again for the warning baseline adds a redundant
second pass over the packument: the filter helper iterates all versions (and may scan candidates per
dist-tag) and in Rust also clones fields like time, demonstrating the extra per-package work and
allocations.

pnpm11/resolving/npm-resolver/src/index.ts[374-413]
pnpm11/resolving/npm-resolver/src/index.ts[701-734]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[27-58]
pnpm11/resolving/registry/pkg-metadata-filter/src/index.ts[5-74]
pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs[358-383]
pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs[94-144]
pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[146-173]
pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[370-425]

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

## Issue description
When `publishedBy/published_by` is enabled, the held-back warning baseline computation (`warnOnceOnHeldBackUpdate()` / `held_back_preferred()`) calls `filterPkgMetadataByPublishDate()` / `filter_pkg_metadata_by_publish_date()` to rebuild a maturity-filtered packument/`Package`. The actual pick already applies the same maturity filtering in `pickPackageFromMeta()` / `pick_package_from_meta()`, so the warning path redundantly performs a second full packument scan and (in Rust) clones potentially large fields like `time`, adding unnecessary CPU/allocations on `pnpm update`—especially for packages with very large `versions` maps.

## Issue Context
- The held-back warning helper runs on the resolve/update path after a version is successfully picked.
- The baseline logic currently materializes a filtered metadata object by iterating all versions (and potentially scanning candidates per dist-tag), and in Rust allocates a new `Package` and clones `time` and other fields.
- This repeats maturity filtering already done during the actual pick when `publishedBy/published_by` is active, creating redundant O(packument size) work and increasing CPU exposure to registry-controlled metadata.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[391-412]
- pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs[97-144]

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



Informational

3. Missing trailing comma parameters 📘 Rule violation ⚙ Maintainability ⭐ New
Description
applyPublishedByPolicy uses a multi-line parameter list but the last parameter
publishedByExclude lacks a trailing comma, increasing diff noise and violating the TypeScript
trailing-comma style requirement.
Code

pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[R131-134]

+  meta: PackageMeta,
+  publishedBy: Date,
+  publishedByExclude?: PackageVersionPolicy
+): PublishedByView {
Relevance

● Weak

Close precedent: team rejected adding trailing commas to multi-line TS signatures in same area.

PR-#13133
PR-#13428
PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript constructs. In
applyPublishedByPolicy, the final parameter line publishedByExclude?: PackageVersionPolicy is
multi-line and lacks a trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[130-134]

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

## Issue description
`applyPublishedByPolicy` has a multi-line parameter list without a trailing comma on the last parameter.

## Issue Context
The repo’s TypeScript style requires trailing commas in multi-line constructs to reduce diff churn.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[130-134]

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


Grey Divider

Context used
✅ Compliance rules (platform): 24 rules

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit 70c9a3f

Results up to commit 6492efb ⚖️ Balanced


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


Remediation recommended
1. Regex for trailing slash ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The Jest test uses a regex (/\/$/) to strip a trailing slash from registries.default, even
though a simple string operation would be clearer and aligns with repo parsing conventions. This
introduces avoidable regex parsing where direct string logic would suffice.
Code

pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[66]

+  getMockAgent().get(registries.default.replace(/\/$/, ''))
Evidence
PR Compliance ID 6 requires preferring simple string operations over custom regex when regex is not
needed. The new tests call registries.default.replace(/\/$/, '') in three places to remove a
trailing slash, which can be implemented with endsWith('/') + slice (or a small helper) without
regex.

CLAUDE.md: Prefer simple string operations over custom regex; use existing parser-combinator pattern for structured parsing
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[66-66]
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[92-92]
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[116-116]

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 strips a trailing `/` using a regex (`/\/$/`), which is unnecessary for this simple operation.

## Issue Context
Compliance guidance prefers simple string operations over custom regex when the parsing need is straightforward.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[66-67]
- pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[92-93]
- pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts[116-117]

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


2. Baseline packument re-filtering ✓ Resolved 🐞 Bug ➹ Performance
Description
When publishedBy/published_by is set, the held-back warning path (warnOnceOnHeldBackUpdate /
held_back_preferred) rebuilds a maturity-filtered baseline by running
filterPkgMetadataByPublishDate / filter_pkg_metadata_by_publish_date, even though the actual
version pick already performs the same maturity filtering. This duplicates a full packument
scan/clone (including potentially large time data), adding O(packument size) CPU/allocations per
resolved range during pnpm update, which can noticeably slow updates on large versions maps and
increases CPU exposure to attacker-controlled registry metadata.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R391-401]

+  let baselineMeta = meta
+  if (opts.publishedBy != null) {
+    const excludeResult = opts.publishedByExclude?.(meta.name) ?? false
+    // When the metadata is abbreviated (no `time` field), the pick only
+    // succeeded because every version predates the cutoff (see
+    // `pickPackageFromMeta`), so there is nothing to filter out.
+    if (excludeResult !== true && meta.time != null) {
+      assertMetaHasTime(meta)
+      const trustedVersions = Array.isArray(excludeResult) ? excludeResult : undefined
+      baselineMeta = filterPkgMetadataByPublishDate(meta, opts.publishedBy, trustedVersions)
+    }
Evidence
The cited code paths show that the held-back warning helper is invoked after a successful pick on
the main resolve/update flow, and when publishedBy/published_by is enabled it computes its
baseline by calling the packument-filtering helper (filterPkgMetadataByPublishDate /
filter_pkg_metadata_by_publish_date) to allocate a filtered metadata/Package. However, the pick
logic already applies the same published-by maturity cutoff inside pickPackageFromMeta /
pick_package_from_meta, so invoking the filter again for the warning baseline adds a redundant
second pass over the packument: the filter helper iterates all versions (and may scan candidates per
dist-tag) and in Rust also clones fields like time, demonstrating the extra per-package work and
allocations.

pnpm11/resolving/npm-resolver/src/index.ts[374-413]
pnpm11/resolving/npm-resolver/src/index.ts[701-734]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[27-58]
pnpm11/resolving/registry/pkg-metadata-filter/src/index.ts[5-74]
pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs[358-383]
pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs[94-144]
pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[146-173]
pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[370-425]

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

## Issue description
When `publishedBy/published_by` is enabled, the held-back warning baseline computation (`warnOnceOnHeldBackUpdate()` / `held_back_preferred()`) calls `filterPkgMetadataByPublishDate()` / `filter_pkg_metadata_by_publish_date()` to rebuild a maturity-filtered packument/`Package`. The actual pick already applies the same maturity filtering in `pickPackageFromMeta()` / `pick_package_from_meta()`, so the warning path redundantly performs a second full packument scan and (in Rust) clones potentially large fields like `time`, adding unnecessary CPU/allocations on `pnpm update`—especially for packages with very large `versions` maps.

## Issue Context
- The held-back warning helper runs on the resolve/update path after a version is successfully picked.
- The baseline logic currently materializes a filtered metadata object by iterating all versions (and potentially scanning candidates per dist-tag), and in Rust allocates a new `Package` and clones `time` and other fields.
- This repeats maturity filtering already done during the actual pick when `publishedBy/published_by` is active, creating redundant O(packument size) work and increasing CPU exposure to registry-controlled metadata.

## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[391-412]
- pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs[97-144]

ⓘ 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

Code review by qodo was updated up to the latest commit 6492efb

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13115
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,699.77 ms
(-1.43%)Baseline: 2,738.92 ms
3,286.70 ms
(82.14%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,725.23 ms
(-5.37%)Baseline: 1,823.14 ms
2,187.77 ms
(78.86%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
416.20 ms
(-11.48%)Baseline: 470.17 ms
564.21 ms
(73.77%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
175.16 ms
(-19.23%)Baseline: 216.85 ms
260.22 ms
(67.31%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,423.54 ms
(-2.10%)Baseline: 2,475.41 ms
2,970.49 ms
(81.59%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,447.52 ms
(-1.59%)Baseline: 4,519.46 ms
5,423.35 ms
(82.01%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
294.04 ms
(-3.79%)Baseline: 305.62 ms
366.75 ms
(80.18%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
808.38 ms
(+11.15%)Baseline: 727.31 ms
872.77 ms
(92.62%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13115
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,467.01 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
290.63 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
324.28 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
87.57 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,389.29 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,479.85 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
314.66 ms
🐰 View full continuous benchmarking report in Bencher

xianjianlf2 and others added 5 commits August 6, 2026 11:50
…te baseline

The held-back-update warning compared the picked version against a
baseline picked from the unfiltered metadata, while the actual pick
excluded versions blocked by minimumReleaseAge. When the age gate was
the only reason a newer version was not picked, the warning still fired
and misattributed the hold-back to the manifests and already installed
dependencies, recommending an override that would defeat the age gate.

Filter the baseline metadata by the same publishedBy cutoff (honoring
publishedByExclude) in both stacks, so the warning only fires when a
preference a fresh install would apply is the real cause.

Closes pnpm#13071
…TS suite

The Rust suite covered publishedByExclude keeping the baseline unfiltered
but the TypeScript suite did not; add the equivalent integration test.
Also wrap the issue URL in the Rust test comment in angle brackets to
satisfy dylint's bare-url lint.
…y cutoff

The held-back suites pinned "cutoff blocks the newer version" and "no
cutoff, manifest pin holds the update back", but nothing exercised a
cutoff that is active while the newer version is already mature. A
baseline filter that dropped too much would have suppressed a legitimate
warning undetected, so both stacks get that case.

The Rust packument also gains the `release_age_upgrade_checked` and
`derived` fields `Package` grew on main, without which the crate no
longer compiles after the rebase.
… contract

`filter_pkg_metadata_by_publish_date` named the publishedBy branch in
`pick_package_from_meta` as its only caller; the held-back baseline is a
second one. State the precondition callers must satisfy instead of
enumerating them.
@zkochan
zkochan force-pushed the fix/held-back-warning-release-age-13071 branch from 6492efb to 91fb50f Compare August 6, 2026 11:16
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 91fb50f

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

@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

🧹 Nitpick comments (2)
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts (2)

47-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Declare collectWarnings after its first use.

Move collectWarnings below the beforeEach and afterEach registrations. The TypeScript style requires function declarations after use.

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

In `@pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts` around
lines 47 - 51, Move the collectWarnings function declaration below the
beforeEach and afterEach registrations in the test setup, without changing its
warning-filtering or collection behavior.

Source: Coding guidelines


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

Replace repeated regular-expression URL trimming.

The registry URL is a fixed string with one trailing slash. Define a shared base URL with a string operation and use it in each mock setup.

  • pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts#L66-L66: Use the shared base URL.
  • pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts#L92-L92: Use the shared base URL.
  • pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts#L116-L116: Use the shared base URL.
  • pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts#L141-L141: Use the shared base URL.
Proposed change
 const registries: Registries = {
   default: 'https://registry.npmjs.org/',
 }
+const registryBaseUrl = registries.default.slice(0, -1)
 
-  getMockAgent().get(registries.default.replace(/\/$/, ''))
+  getMockAgent().get(registryBaseUrl)

As per coding guidelines, prefer plain string operations over custom regular expressions.

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

In `@pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts` at line 66,
Replace the repeated registries.default regular-expression trimming in
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts at lines 66,
92, 116, and 141 with one shared base URL constant derived using a plain string
operation, then use that constant in all four getMockAgent mock setups.

Source: Coding guidelines

🤖 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/resolving-npm-resolver/src/preferred_overlay/tests.rs`:
- Around line 140-154: Add exact-version exclusion coverage in both affected
tests: in pnpm/crates/resolving-npm-resolver/src/preferred_overlay/tests.rs
lines 140-154, configure the policy to trust only [email protected] and assert the
held-back preferred result remains; in
pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts lines 140-165,
configure publishedByExclude for only 2.1.4 and assert the held-back warning
remains. Preserve resolver parity for this excluded-version case.

---

Nitpick comments:
In `@pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts`:
- Around line 47-51: Move the collectWarnings function declaration below the
beforeEach and afterEach registrations in the test setup, without changing its
warning-filtering or collection behavior.
- Line 66: Replace the repeated registries.default regular-expression trimming
in pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts at lines 66,
92, 116, and 141 with one shared base URL constant derived using a plain string
operation, then use that constant in all four getMockAgent mock setups.
🪄 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: 1ca1d78d-5c85-44da-aa03-484dc421770c

📥 Commits

Reviewing files that changed from the base of the PR and between f31c7ca and 91fb50f.

📒 Files selected for processing (6)
  • .changeset/held-back-warning-release-age.md
  • pnpm/crates/resolving-npm-resolver/src/pick_package_from_meta.rs
  • pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs
  • pnpm/crates/resolving-npm-resolver/src/preferred_overlay/tests.rs
  • pnpm11/resolving/npm-resolver/src/index.ts
  • pnpm11/resolving/npm-resolver/test/heldBackUpdateWarning.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .changeset/held-back-warning-release-age.md
  • pnpm11/resolving/npm-resolver/src/index.ts
  • pnpm/crates/resolving-npm-resolver/src/preferred_overlay.rs

`minimumReleaseAgeExclude` entries carry optional exact versions
(`[email protected]`), which reach the baseline as a trusted-versions list. Both
stacks only exercised the package-wide exclusion, leaving that list
untested: dropping it would silently narrow the baseline back to the
mature versions and swallow the warning.

Also declare the warning collector below its registrations and derive
the mock registry origin once with a plain string slice.
@qodo-code-review

Copy link
Copy Markdown

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

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

The held-back baseline re-derived the maturity filter the pick applies:
evaluate the exclude policy, decide between "excluded wholesale",
"trusted exact versions", and "abbreviated metadata", then filter. Two
copies of that decision is how the baseline drifted from the pick in the
first place, which is the bug this branch fixes.

Both stacks now compute it once, in applyPublishedByPolicy /
apply_published_by_policy, which reports the abbreviated-metadata case
back as `needsFullMetadata` instead of deciding it: the pick refetches
full metadata, while the baseline treats a pick that already succeeded
as proof the versions cleared the cutoff.

No behavior change; the filter itself was already memoized per packument
and policy, so this deduplicates the decision, not the work.
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 70c9a3f

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Held-back-update warning misattributes cause to manifests when minimumReleaseAge is the actual reason

3 participants