Skip to content

fix(resolver): preserve exact version pins during update - #13027

Merged
zkochan merged 2 commits into
pnpm:mainfrom
m2na7:fix/update-preserve-exact-pins
Jul 17, 2026
Merged

zkochan merged 2 commits into
pnpm:mainfrom
m2na7:fix/update-preserve-exact-pins

Conversation

@m2na7

@m2na7 m2na7 commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm update rewrites an exact version pin that uses the = operator (=3.5.1) to a caret range (^3.5.1): whichVersionIsPinned has no case for the = operator, so the spec falls through to the default pinning. A bare = now classifies the same way as the plain version it prefixes (=3.5.1 → exact pin, written back as the bare 3.5.2; =x.y.z and x.y.z are the same range, and the bare form is node-semver's canonical spelling — npm's --save-exact writes it the same way).

The * → ^x.y.z half of the issue report is intentional behavior (#5436) and is not changed here.

The Rust port gets the same fix, plus its comparator scan now counts dangling ||/- separators as range elements the way semver-utils does — otherwise =1.2.3|| (a valid range) would classify as a pin in Rust but not in TypeScript.

Side effects of the classification change: pnpm add foo@=1.2.3 now records 1.2.3 instead of ^1.2.3 (matching pnpm add [email protected]), and with save-workspace-protocol: rolling a workspace:=x.y.z dependency updates to workspace:* instead of workspace:^.

Closes #12745

Testing

  • TypeScript: new whichVersionIsPinned table rows (=1.0.0 → patch, =1.0 → minor, =1 → major, npm:foo@=1.0.0 → patch, and >=/^=/~=/dangling-|| staying unpinned). They fail on main with undefined instead of the pin.
  • Rust: the parity table's ("=1.2.3", None) row flips to Some(Patch) plus the same new rows, and a CLI e2e (update_latest_preserves_equals_pin_as_exact) proves update --latest on =100.0.0 writes 101.0.0 instead of ^101.0.0.
  • Both packages' full suites pass (jest 262; cargo 286 unit + update e2e), cargo fmt/clippy/eslint/typecheck clean.

Squash Commit Body

whichVersionIsPinned had no case for the `=` range operator, so `pnpm
update` fell back to the default pinning and rewrote exact pins like
`=3.5.1` to `^3.5.2` in the manifest. A bare `=` now classifies the same
way as the plain version it prefixes: `=x.y.z` is an exact pin written
back as the bare version (node-semver's canonical spelling of that
range), `=x.y` pins to minor, `=x` to major. Compound operators (`>=`,
`^=`, `~=`) stay unpinned, and the `*` -> `^x.y.z` rewrite is intentional
per #5436 and unchanged.

The Rust port gets the same classification fix. Its comparator scan also
counts dangling `||` / `-` separators as range elements, mirroring how
semver-utils emits them as elements of their own; without that, a valid
range like `=1.2.3||` would classify as a pin in Rust while the
TypeScript implementation bails on the multi-element parse.

Closes pnpm/pnpm#12745

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pnpm/ port.
  • 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.

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
    • Preserves exact dependency pins using the = operator during updates, instead of rewriting them into caret ranges.
    • Correctly treats npm:-scoped =... specs as exact pins and updates them to the latest matching exact version.
    • Improved pin detection for various = and malformed range edge cases, ensuring correct “pinned vs not pinned” classification.
  • Tests
    • Added a regression test for pacquet update --latest covering =100.0.0 behavior.
    • Expanded the pin-detection test matrices with additional = cases and updated expectations for edge inputs.

@m2na7
m2na7 requested a review from zkochan as a code owner July 15, 2026 10:31
@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 15, 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: 07ce4597-8b74-4490-b084-68ec4e804ad4

📥 Commits

Reviewing files that changed from the base of the PR and between 4f7f374 and 52db503.

📒 Files selected for processing (3)
  • pnpm/crates/cli/tests/add.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm11/resolving/npm-resolver/test/whichVersionIsPinned.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/resolving/npm-resolver/test/whichVersionIsPinned.test.ts

📝 Walkthrough

Walkthrough

The PR updates Rust and TypeScript pin detection to recognize bare = versions, adds parsing edge-case coverage, and adds a CLI regression test confirming update --latest writes an updated exact version without a caret range.

Changes

Exact pin preservation

Layer / File(s) Summary
Resolver pin parsing
pnpm/crates/resolving-npm-resolver/src/which_version_is_pinned.rs
The Rust resolver parses comparator positions directly, recognizes bare = pins, and rejects compound or prefixed equality operators.
Resolver pin test coverage
pnpm/crates/resolving-npm-resolver/src/which_version_is_pinned/tests.rs
Tests cover patch, minor, and major equality pins plus malformed and compound range cases.
Cross-runtime update validation
pnpm11/resolving/npm-resolver/src/whichVersionIsPinned.ts, pnpm11/resolving/npm-resolver/test/whichVersionIsPinned.test.ts, pnpm/crates/cli/tests/update.rs, .changeset/update-preserve-exact-pins.md
The TypeScript resolver handles =, tests accepted and rejected equality forms, CLI coverage verifies =100.0.0 updates to bare 101.0.0, and the changeset documents the behavior.
Non-registry pin guard
pnpm/crates/cli/tests/add.rs, pnpm/crates/package-manager/src/add.rs
The add-path fixture and documentation cover version-like content in file-based dependency specifications without treating it as a registry pin.

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

Sequence Diagram(s)

sequenceDiagram
  participant PackageJson as package.json
  participant UpdateLatest as update_latest
  participant PinResolver as which_version_is_pinned
  participant UpdatedPackageJson as updated_package.json
  PackageJson->>UpdateLatest: dependency =100.0.0
  UpdateLatest->>PinResolver: classify existing specifier
  PinResolver-->>UpdateLatest: exact pin
  UpdateLatest->>UpdatedPackageJson: write 101.0.0
Loading

Assessment against linked issues

Objective Addressed Explanation
Preserve exact = pins during updates [#12745] ✅
Keep unbound * dependencies unbound instead of converting them to caret ranges [#12745] ❌ No changes address wildcard dependency rewriting.

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

Suggested reviewers: zkochan

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

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 timed out. The project may have too many dependencies for the sandbox.


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 15, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Targeted, well-tested fix that correctly handles the = operator across both implementations with no regressions.

The change is narrow: one case '=' fall-through in TypeScript and an equivalent Operator::Eq branch in Rust. Both stacks are updated together in the same PR per the cardinal parity rule. The logic for dangling ||/- element counting in Rust is well-traced in comments and confirmed by explicit table rows in the tests. Parity between the two implementations is verified by matching unit-test tables and a new CLI e2e test. No callers are affected beyond the intended pin-classification fix.

No files require special attention.

Reviews (3): Last reviewed commit: "test(npm-resolver): keep the non-registr..." | Re-trigger Greptile

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

codecov-commenter commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.48%. Comparing base (068a4cc) to head (52db503).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...olving-npm-resolver/src/which_version_is_pinned.rs 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13027      +/-   ##
==========================================
+ Coverage   85.47%   85.48%   +0.01%     
==========================================
  Files         502      502              
  Lines       80771    80825      +54     
==========================================
+ Hits        69039    69095      +56     
+ Misses      11732    11730       -2     

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

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 4f7f3746c528

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.505 ± 0.144 2.372 2.801 1.66 ± 0.17
pacquet@main 2.657 ± 0.251 2.365 3.132 1.76 ± 0.22
pnpr@HEAD 1.511 ± 0.128 1.348 1.716 1.00
pnpr@main 1.513 ± 0.107 1.401 1.694 1.00 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.50514813606,
      "stddev": 0.1442762043148726,
      "median": 2.4681062026599996,
      "user": 1.7096100200000002,
      "system": 1.34708928,
      "min": 2.3721607371599998,
      "max": 2.80069873116,
      "times": [
        2.50749967316,
        2.80069873116,
        2.40911729716,
        2.5764082621599997,
        2.5172023371599996,
        2.3721607371599998,
        2.3849422801599998,
        2.67997148016,
        2.3747678301599997,
        2.4287127321599997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.65662277136,
      "stddev": 0.2508704781504169,
      "median": 2.55202598366,
      "user": 2.174778619999999,
      "system": 1.72368268,
      "min": 2.36506919016,
      "max": 3.1324110081599996,
      "times": [
        2.5199495221599997,
        2.52666777516,
        2.8880238981599997,
        2.50411351616,
        3.1324110081599996,
        2.61921204016,
        2.96945919216,
        2.46393737916,
        2.57738419216,
        2.36506919016
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.51142031436,
      "stddev": 0.12840566314941906,
      "median": 1.5168781636600002,
      "user": 1.24511212,
      "system": 1.3281196800000001,
      "min": 1.34804835616,
      "max": 1.71587410116,
      "times": [
        1.3944942471600001,
        1.4931594351600002,
        1.55319207416,
        1.58289982316,
        1.42131038916,
        1.37547504616,
        1.71587410116,
        1.68915277916,
        1.5405968921600002,
        1.34804835616
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.51332473616,
      "stddev": 0.10703142142654504,
      "median": 1.49211931516,
      "user": 1.1919198199999999,
      "system": 1.23399788,
      "min": 1.40128437416,
      "max": 1.69352985816,
      "times": [
        1.67218050616,
        1.42462234716,
        1.40822637816,
        1.5396972801600002,
        1.49969521516,
        1.48454341516,
        1.40128437416,
        1.69352985816,
        1.42705380816,
        1.58241417916
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 257.0 ± 7.0 245.6 266.1 1.01 ± 0.04
pacquet@main 261.8 ± 10.4 251.5 278.5 1.03 ± 0.05
pnpr@HEAD 254.8 ± 8.6 241.2 268.9 1.00
pnpr@main 270.6 ± 11.8 251.6 289.4 1.06 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25704921086000004,
      "stddev": 0.0070329387461761554,
      "median": 0.25570012506000006,
      "user": 0.20531213999999998,
      "system": 0.5404306600000002,
      "min": 0.24560468356,
      "max": 0.26613699956000003,
      "times": [
        0.25610780156,
        0.25529244856000005,
        0.26613699956000003,
        0.25079748656000006,
        0.25485005656000004,
        0.24560468356,
        0.25059316256,
        0.26123566356000005,
        0.26511552856000004,
        0.26475827756000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26176003966000005,
      "stddev": 0.010428442514692098,
      "median": 0.25794185606000003,
      "user": 0.21567593999999998,
      "system": 0.53195596,
      "min": 0.25147900856000005,
      "max": 0.27851118656000007,
      "times": [
        0.26666832856000006,
        0.25574188356000005,
        0.25147900856000005,
        0.25619973556000003,
        0.25968397656000003,
        0.25199155156,
        0.26780279156000003,
        0.27793262856000006,
        0.27851118656000007,
        0.25158930556000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25477488846,
      "stddev": 0.008551616203158358,
      "median": 0.25566999356000003,
      "user": 0.19737613999999998,
      "system": 0.50919636,
      "min": 0.24119354956000003,
      "max": 0.26892398956,
      "times": [
        0.24492554556,
        0.26892398956,
        0.25924599256,
        0.25863799856,
        0.24654017256000002,
        0.26308985956000003,
        0.25385178956000004,
        0.25462269856,
        0.24119354956000003,
        0.25671728856000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27056606835999997,
      "stddev": 0.011767437161134328,
      "median": 0.27021026306000007,
      "user": 0.22977714000000002,
      "system": 0.52997716,
      "min": 0.25156858656000003,
      "max": 0.28938800656,
      "times": [
        0.27144543056000003,
        0.27081679856,
        0.25992134256000005,
        0.25156858656000003,
        0.26960372756000006,
        0.28395727656,
        0.26231935156,
        0.26455911356000006,
        0.28938800656,
        0.28208104956
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.787 ± 0.083 2.720 2.966 1.69 ± 0.16
pacquet@main 2.939 ± 0.060 2.864 3.021 1.78 ± 0.16
pnpr@HEAD 1.755 ± 0.165 1.478 2.008 1.06 ± 0.14
pnpr@main 1.649 ± 0.145 1.461 1.843 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7869980168799997,
      "stddev": 0.08259069593107835,
      "median": 2.75176735678,
      "user": 1.8677447600000001,
      "system": 1.40198262,
      "min": 2.72012012578,
      "max": 2.96638790078,
      "times": [
        2.72015624378,
        2.72355157778,
        2.7434595697799997,
        2.74856562078,
        2.7549690927799997,
        2.72012012578,
        2.8931391077799997,
        2.96638790078,
        2.8110259267799997,
        2.78860500278
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.93919306448,
      "stddev": 0.05975384661479262,
      "median": 2.92870979828,
      "user": 2.2878991599999994,
      "system": 1.5694548200000003,
      "min": 2.86444025078,
      "max": 3.0206176377799996,
      "times": [
        2.88263429678,
        2.90856721278,
        2.86444025078,
        2.9951543347799996,
        2.87028268478,
        2.91662781878,
        3.0169125217799997,
        3.0206176377799996,
        2.94079177778,
        2.9759021087799997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.75477536468,
      "stddev": 0.16503639901348363,
      "median": 1.75784218128,
      "user": 1.5736559599999995,
      "system": 1.7718041199999999,
      "min": 1.4780973697800002,
      "max": 2.0076662487799997,
      "times": [
        1.7633915847800001,
        1.4780973697800002,
        1.75229277778,
        1.81801298878,
        1.92517141878,
        2.0076662487799997,
        1.6335412017800002,
        1.5788223357800002,
        1.90158599678,
        1.6891717237800001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6489116118800002,
      "stddev": 0.14464147115477585,
      "median": 1.6649060257800001,
      "user": 1.38200326,
      "system": 1.43813282,
      "min": 1.46063376678,
      "max": 1.84288617478,
      "times": [
        1.6496109437800002,
        1.68020110778,
        1.84288617478,
        1.49533108078,
        1.84076451478,
        1.69662333278,
        1.78237496578,
        1.50171559478,
        1.46063376678,
        1.5389746367800001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 655.7 ± 34.4 598.8 708.6 1.94 ± 0.13
pacquet@main 829.8 ± 106.1 725.8 1019.9 2.46 ± 0.33
pnpr@HEAD 359.5 ± 26.6 321.9 409.6 1.06 ± 0.09
pnpr@main 337.7 ± 13.9 319.8 357.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6557028608600001,
      "stddev": 0.03441596862054313,
      "median": 0.65838601746,
      "user": 0.8406257199999999,
      "system": 0.7300351799999999,
      "min": 0.59876150796,
      "max": 0.70859748996,
      "times": [
        0.6346214869600001,
        0.6173163409600001,
        0.7029334919600001,
        0.59876150796,
        0.6689882209600001,
        0.6639140709600001,
        0.6441154679600001,
        0.70859748996,
        0.6649225669600001,
        0.6528579639600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.8297812508600002,
      "stddev": 0.10610408805179257,
      "median": 0.7924013164600001,
      "user": 1.0690717199999997,
      "system": 0.8363919799999999,
      "min": 0.7258425839600001,
      "max": 1.01989106796,
      "times": [
        0.7332846559600001,
        0.7748595609600001,
        0.7416826239600001,
        0.7258425839600001,
        0.8099430719600001,
        0.7672372689600001,
        0.8504979389600001,
        0.88054642396,
        0.9940273119600002,
        1.01989106796
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.35952911156,
      "stddev": 0.02657003674088712,
      "median": 0.35375854346,
      "user": 0.26408382,
      "system": 0.6158811799999999,
      "min": 0.32186799496,
      "max": 0.40964911396000003,
      "times": [
        0.38662968496,
        0.34552839996,
        0.34818603596000003,
        0.35535369296,
        0.33466081696,
        0.35216339396,
        0.38525130296000004,
        0.35600067896000004,
        0.32186799496,
        0.40964911396000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.33771611566,
      "stddev": 0.013868061946153955,
      "median": 0.33785207695999997,
      "user": 0.23544782,
      "system": 0.55743258,
      "min": 0.31983887096,
      "max": 0.35781365696,
      "times": [
        0.34326992296000003,
        0.35176305196,
        0.32335411896,
        0.33331508696,
        0.34238906696,
        0.31983887096,
        0.35781365696,
        0.32358069596,
        0.32843938096,
        0.35339730396
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.212 ± 0.044 2.134 2.275 7.01 ± 0.39
pacquet@main 2.107 ± 0.063 2.040 2.239 6.68 ± 0.40
pnpr@HEAD 0.315 ± 0.016 0.290 0.349 1.00
pnpr@main 0.329 ± 0.016 0.305 0.358 1.04 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.2115728690000003,
      "stddev": 0.0443291337489704,
      "median": 2.2001436531999996,
      "user": 1.5304425799999999,
      "system": 1.0387733399999999,
      "min": 2.1336094422,
      "max": 2.2749111922,
      "times": [
        2.1858995632,
        2.2473895212,
        2.1985388061999998,
        2.2017485002,
        2.1960891102,
        2.1336094422,
        2.2526061012,
        2.2749111922,
        2.2540745801999997,
        2.1708618732
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.107014285,
      "stddev": 0.06295595547530898,
      "median": 2.0969660827,
      "user": 1.33637798,
      "system": 0.97038034,
      "min": 2.0400033152,
      "max": 2.2389222142,
      "times": [
        2.2389222142,
        2.1804198022,
        2.0400033152,
        2.0889661332,
        2.0622998822,
        2.1270315332,
        2.1172243382,
        2.1049660322,
        2.0646277182,
        2.0456818811999997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3154844546000001,
      "stddev": 0.016157067102210834,
      "median": 0.31629427270000005,
      "user": 0.18320387999999999,
      "system": 0.5745290399999998,
      "min": 0.2903707682,
      "max": 0.34863032320000004,
      "times": [
        0.34863032320000004,
        0.3109281152,
        0.31583918720000004,
        0.2958252522,
        0.2903707682,
        0.3102052262,
        0.3171180422,
        0.3218677502,
        0.32731052320000004,
        0.31674935820000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.32943023740000005,
      "stddev": 0.015844661779207677,
      "median": 0.3305595267,
      "user": 0.22669928,
      "system": 0.5674035399999999,
      "min": 0.3050951692,
      "max": 0.3583807652,
      "times": [
        0.33217170220000003,
        0.3050951692,
        0.30739970120000004,
        0.33976974620000006,
        0.3289473512,
        0.3217990322,
        0.33257520020000003,
        0.3264088082,
        0.3583807652,
        0.34175489820000005
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 365.0 ± 26.6 331.5 417.6 4.40 ± 0.40
pacquet@main 377.7 ± 18.9 333.0 400.2 4.56 ± 0.33
pnpr@HEAD 84.9 ± 4.2 76.8 92.2 1.02 ± 0.07
pnpr@main 82.9 ± 4.3 76.7 90.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36498319474000007,
      "stddev": 0.026595337464704976,
      "median": 0.35581078524,
      "user": 0.36463073999999995,
      "system": 0.05594308,
      "min": 0.33154833324,
      "max": 0.41760351424000003,
      "times": [
        0.38472552524000003,
        0.35665336924,
        0.34535715424,
        0.34240943124,
        0.41760351424000003,
        0.39419130024,
        0.36964009424,
        0.35496820124,
        0.35273502424000003,
        0.33154833324
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.37771686674000005,
      "stddev": 0.01888946504733287,
      "median": 0.37630838574000003,
      "user": 0.36784764,
      "system": 0.06408768,
      "min": 0.33295344524,
      "max": 0.40018345524,
      "times": [
        0.33295344524,
        0.39078290224,
        0.37633961924,
        0.37627715224,
        0.39413717824,
        0.37014639624,
        0.37571169924000003,
        0.37073693724,
        0.40018345524,
        0.38989988224
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08489380986499998,
      "stddev": 0.004226161492899068,
      "median": 0.08561507924,
      "user": 0.01773778375,
      "system": 0.00990479125,
      "min": 0.07681168924,
      "max": 0.09218529124000001,
      "times": [
        0.08780934524,
        0.09066207824,
        0.08547137924,
        0.08671096824,
        0.08540076624,
        0.09191864024,
        0.08838889424,
        0.09218529124000001,
        0.08575877924,
        0.09091482324,
        0.08196707124,
        0.07876291824000001,
        0.08184093424,
        0.08636209324,
        0.08583119624,
        0.09068130224,
        0.08682277924,
        0.08593599224,
        0.08832754924,
        0.08711682224,
        0.08467372924,
        0.08650438124,
        0.08264087724000001,
        0.08281835124,
        0.08442782724,
        0.07994988924,
        0.08152688324,
        0.08137730224,
        0.08189468524,
        0.07681168924,
        0.07718788624,
        0.07791879024000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08285851261142857,
      "stddev": 0.004347675251213235,
      "median": 0.08167449124000001,
      "user": 0.016394154285714287,
      "system": 0.009310303999999998,
      "min": 0.07667207624,
      "max": 0.09078612124,
      "times": [
        0.07963165024,
        0.07732729824,
        0.07696323424,
        0.07770320524,
        0.07667207624,
        0.07880943424,
        0.08139539624,
        0.08163283324000001,
        0.07771640024,
        0.08122068824,
        0.07727608224,
        0.07828416724000001,
        0.08821590924,
        0.08080016824,
        0.08309847824,
        0.08293715524,
        0.07949752924,
        0.08115168924,
        0.09077043124,
        0.09078612124,
        0.08479866524,
        0.08158847924,
        0.08411026024,
        0.08626091324,
        0.08771116024,
        0.09014443524,
        0.08772660924,
        0.08902956724,
        0.08586050024,
        0.08503096124000001,
        0.08989437524,
        0.08167449124000001,
        0.08169343724,
        0.08082707824,
        0.08180706024
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.577 ± 0.085 4.502 4.780 1.25 ± 0.05
pacquet@main 4.715 ± 0.157 4.495 5.005 1.28 ± 0.07
pnpr@HEAD 3.693 ± 0.119 3.580 3.986 1.01 ± 0.05
pnpr@main 3.673 ± 0.141 3.519 3.944 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.5772668408,
      "stddev": 0.08496796833495027,
      "median": 4.5429353376999995,
      "user": 2.0978298799999995,
      "system": 1.59878672,
      "min": 4.5018579607,
      "max": 4.7796669417,
      "times": [
        4.5530800997,
        4.5742343577,
        4.5250309597000005,
        4.5289866557,
        4.5327905757,
        4.5765669847,
        4.5018579607,
        4.5308115817,
        4.6696422907,
        4.7796669417
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.7149803329,
      "stddev": 0.15728556504943186,
      "median": 4.6838150772,
      "user": 2.3353614799999995,
      "system": 1.7156379199999996,
      "min": 4.4951883127,
      "max": 5.0045593597,
      "times": [
        4.5753221257000005,
        4.4951883127,
        4.9336277377,
        4.6396065797,
        4.6301198937,
        4.7011504397,
        5.0045593597,
        4.6683263467,
        4.8025987257,
        4.6993038077
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6929517371000005,
      "stddev": 0.11898581436871188,
      "median": 3.6523355497,
      "user": 1.57857118,
      "system": 1.5467649199999998,
      "min": 3.5796328877,
      "max": 3.9857265357,
      "times": [
        3.6830327337,
        3.5796328877,
        3.8052304527,
        3.6840523817,
        3.6352131177,
        3.6310818307000003,
        3.6208763317,
        3.6668343397000003,
        3.6378367597,
        3.9857265357
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.672558557,
      "stddev": 0.14100667667970648,
      "median": 3.6290687527000003,
      "user": 1.7190589799999998,
      "system": 1.64971032,
      "min": 3.5194585087,
      "max": 3.9443802037,
      "times": [
        3.6183598717,
        3.6376249057,
        3.9015598807000003,
        3.5613316227,
        3.6205125997,
        3.5800909457000003,
        3.6974519167000004,
        3.5194585087,
        3.6448151147,
        3.9443802037
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13027
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,787.00 ms
(-4.47%)Baseline: 2,917.40 ms
3,500.88 ms
(79.61%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
2,211.57 ms
(+4.57%)Baseline: 2,114.97 ms
2,537.97 ms
(87.14%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
655.70 ms
(-12.07%)Baseline: 745.73 ms
894.88 ms
(73.27%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
364.98 ms
(-17.65%)Baseline: 443.23 ms
531.87 ms
(68.62%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,505.15 ms
(-6.92%)Baseline: 2,691.37 ms
3,229.65 ms
(77.57%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,577.27 ms
(-4.55%)Baseline: 4,795.69 ms
5,754.83 ms
(79.54%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
257.05 ms
(-11.43%)Baseline: 290.21 ms
348.25 ms
(73.81%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13027
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,754.78 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
315.48 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
359.53 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.89 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,511.42 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,692.95 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
254.77 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan force-pushed the fix/update-preserve-exact-pins branch from bfbc408 to 4f7f374 Compare July 17, 2026 13:49
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Remediation recommended

1. = pins drop operator 📎 Requirement gap ≡ Correctness
Description
The updated behavior canonicalizes =<version> specs to a bare version (e.g., =100.0.0 updates to
101.0.0), which does not preserve the literal = prefix as required by the checklist rule. If
this canonicalization is intentional (as stated in the PR), the ticket-derived compliance
requirement should be updated to reflect “preserve exact semantics” rather than “preserve the =
spelling”.
Code

pnpm/crates/cli/tests/update.rs[R341-346]

+    write_manifest(&workspace, &format!(r#"{{ "{DEP}": "=100.0.0" }}"#));
+    pacquet(&workspace, ["install"]).assert().success();
+
+    pacquet(&workspace, ["update", "--latest"]).assert().success();
+
+    assert_eq!(dep_spec(&workspace, DEP).as_deref(), Some("101.0.0"));
Evidence
Rule 772200 requires =<version> to remain =<...> after update. The new Rust e2e test asserts
that a manifest written with =100.0.0 ends up with a bare 101.0.0, and the changeset text
explicitly states exact pins are written back as the bare version, contradicting the rule’s “must
remain =<...>” criterion.

pnpm update must preserve exact '=' dependency specifiers
pnpm/crates/cli/tests/update.rs[341-346]
.changeset/update-preserve-exact-pins.md[7-7]

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

## Issue description
The PR intentionally writes exact `=<version>` pins back as the bare version (canonical semver spelling), but compliance rule 772200 requires preserving the literal `=` prefix.

## Issue Context
This rule is marked as ticket-derived, and the PR description + tests indicate the new intended contract is “exact pin semantics preserved, spelling may be canonicalized”.

## Fix Focus Areas
- pnpm/crates/cli/tests/update.rs[341-346]
- .changeset/update-preserve-exact-pins.md[7-7]

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


Grey Divider

Previous review results

Review updated until commit 52db503

Results up to commit 4f7f374


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


Remediation recommended
1. = pins drop operator 📎 Requirement gap ≡ Correctness
Description
The updated behavior canonicalizes =<version> specs to a bare version (e.g., =100.0.0 updates to
101.0.0), which does not preserve the literal = prefix as required by the checklist rule. If
this canonicalization is intentional (as stated in the PR), the ticket-derived compliance
requirement should be updated to reflect “preserve exact semantics” rather than “preserve the =
spelling”.
Code

pnpm/crates/cli/tests/update.rs[R341-346]

+    write_manifest(&workspace, &format!(r#"{{ "{DEP}": "=100.0.0" }}"#));
+    pacquet(&workspace, ["install"]).assert().success();
+
+    pacquet(&workspace, ["update", "--latest"]).assert().success();
+
+    assert_eq!(dep_spec(&workspace, DEP).as_deref(), Some("101.0.0"));
Evidence
Rule 772200 requires =<version> to remain =<...> after update. The new Rust e2e test asserts
that a manifest written with =100.0.0 ends up with a bare 101.0.0, and the changeset text
explicitly states exact pins are written back as the bare version, contradicting the rule’s “must
remain =<...>” criterion.

pnpm update must preserve exact '=' dependency specifiers
pnpm/crates/cli/tests/update.rs[341-346]
.changeset/update-preserve-exact-pins.md[7-7]

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

## Issue description
The PR intentionally writes exact `=<version>` pins back as the bare version (canonical semver spelling), but compliance rule 772200 requires preserving the literal `=` prefix.

## Issue Context
This rule is marked as ticket-derived, and the PR description + tests indicate the new intended contract is “exact pin semantics preserved, spelling may be canonicalized”.

## Fix Focus Areas
- pnpm/crates/cli/tests/update.rs[341-346]
- .changeset/update-preserve-exact-pins.md[7-7]

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

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

The `=` classification change also treats a `file:` path whose only
range-like element is a bare `x.y.z` as an exact pin, so the fixture
`file:../dep-of-pkg-with-1-dep-100.0.0.tgz` (dashes now count as range
elements) classifies as no-pin and let
`add_explicit_range_ignores_pin_from_non_registry_prev` pass even with
the `is_registry_style_specifier` gate removed. Switch it to
`file:../deps/100.0.0.tgz`, which still classifies as a patch pin in both
stacks, so the test fails without the gate again. Refresh the now-stale
rationale comments in the test and in add.rs.

Add a `1.0.0||` row to the TypeScript whichVersionIsPinned table so both
stacks document that a dangling `||` separator is not a single pin.
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 52db503

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

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

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.

pnpm update updates some version ranges inaccurately

3 participants