Skip to content

fix(self-update): do not downgrade when a dist-tag points at the running version - #13889

Merged
zkochan merged 1 commit into
pnpm:mainfrom
lazerg:fix/issue-13883-self-update-tag-downgrade
Aug 20, 2026
Merged

zkochan merged 1 commit into
pnpm:mainfrom
lazerg:fix/issue-13883-self-update-tag-downgrade

Conversation

@lazerg

@lazerg lazerg commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm self-update next-12 on v12.0.0-rc.4 switched down to v12.0.0-rc.3. The next-12 tag did point at rc.4, but rc.4 was about 11 hours old, so the built-in minimumReleaseAge default (1440 minutes) dropped it from the packument and filterPkgMetadataByPublishDate repopulated the tag to the newest mature release below it, rc.3. Self-update then resolved a version older than the one already running and installed it.

The no-downgrade guard from #11435 only covers implicit latest, and widening it to every tag would take away the escape hatch it deliberately left: an explicit pnpm self-update latest still has to force a downgrade when the registry's latest genuinely lags a new major.

So self-update now adds the running version to minimumReleaseAgeExclude for its own resolve instead. That version is already on the machine, so keeping it hidden buys no protection, and keeping it visible stops a dist-tag that points at it, or at anything newer, from falling back to an older release. pnpm self-update <tag> on a fresh release is now a no-op until something newer matures, which is what the cutoff means. An explicit version or a tag that really points at an older release still downgrades as before.

The same change lands in pacquet's resolve_pnpm_version, which builds the identical policy for its own probe.

Closes #13883.

Squash Commit Body

The minimumReleaseAge cutoff filters an immature version out of the
packument and repopulates every dist-tag pointing at it to the newest
mature release below it. For a dependency that is the right answer,
but self-update reads the tag as "which pnpm should I be running", so
a tag pointing at the freshly published version the user already runs
resolved to the previous release and downgraded them: pnpm
self-update next-12 on 12.0.0-rc.4 switched to 12.0.0-rc.3.

The no-downgrade guard added in pnpm/pnpm#11435 does not cover this,
and cannot be widened to every tag without losing the explicit
"pnpm self-update latest" downgrade it deliberately allows.

Self-update now appends the running version to
minimumReleaseAgeExclude before it resolves. That version is already
installed, so the cutoff protects nothing by hiding it, and keeping
it visible pins any tag that points at it or past it to it. Mirrored
in pacquet's resolve_pnpm_version.

Closes pnpm/pnpm#13883.

Checklist

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

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

Summary by CodeRabbit

  • Bug Fixes

    • Fixed pnpm self-update <tag> incorrectly downgrading an immature active version.
    • Self-update now keeps the currently running version when it matches the requested dist-tag, even when release-age restrictions apply.
    • Improved version resolution for the active pnpm release.
    • No-op updates leave the global installation unchanged.
  • Tests

    • Added coverage for tagged self-updates involving immature releases and minimum release-age settings.

@lazerg
lazerg requested a review from zkochan as a code owner August 13, 2026 07:02
@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 →

@codecov-commenter

codecov-commenter commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.16%. Comparing base (5f43039) to head (b8f65df).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13889   +/-   ##
=======================================
  Coverage   88.16%   88.16%           
=======================================
  Files         647      647           
  Lines      107346   107367   +21     
=======================================
+ Hits        94639    94662   +23     
+ Misses      12707    12705    -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.

@coderabbitai

coderabbitai Bot commented Aug 13, 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: 27a49795-09ac-42dc-bc48-579b4a7119e9

📥 Commits

Reviewing files that changed from the base of the PR and between cd1b42d and b8f65df.

📒 Files selected for processing (5)
  • .changeset/self-update-tag-no-downgrade.md
  • pnpm/crates/cli/src/config_deps.rs
  • pnpm/crates/cli/src/config_deps/tests.rs
  • pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts
  • pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • .changeset/self-update-tag-no-downgrade.md
  • pnpm/crates/cli/src/config_deps/tests.rs
  • pnpm/crates/cli/src/config_deps.rs
  • pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts
  • pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts

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


📝 Walkthrough

Walkthrough

The change excludes the running pnpm version from minimum-release-age filtering in Rust and TypeScript resolution paths. It adds regression tests for dist-tag self-update behavior and documents the patch release.

Changes

Self-update version resolution

Layer / File(s) Summary
Running-version exclusion policy
pnpm/crates/cli/src/config_deps.rs, pnpm/crates/cli/src/config_deps/tests.rs
The Rust resolver adds PNPM_VERSION to the minimum-release-age exclusions. Tests verify that an immature latest target resolves to the running version.
Self-update no-op behavior
pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts, pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts, .changeset/self-update-tag-no-downgrade.md
The self-updater excludes the active pnpm version. Tests verify no downgrade, no global installation change, and the no-op result. The changeset records the patch release.

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

Merge Risk: ⚪ Minimal · up to b8f65

The change prevents self-update from downgrading when a distribution tag points to the version already running, while preserving explicit downgrade behavior. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SelfUpdater
  participant VersionResolver
  participant GlobalInstallation
  User->>SelfUpdater: Run self-update with a dist-tag
  SelfUpdater->>VersionResolver: Resolve target with active version excluded from age filtering
  VersionResolver-->>SelfUpdater: Return the active pnpm version
  SelfUpdater-->>User: Report that the active version already matches
  SelfUpdater->>GlobalInstallation: Leave the installation unchanged
Loading

Assessment against linked issues

Objective Addressed Explanation
[#13883] Prevent pnpm self-update next-12 from downgrading and return a no-op when the running version is latest. ✅

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

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.

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

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: b8f65dfde2ed

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.401 ± 0.121 2.250 2.602 1.73 ± 0.15
pacquet@main 2.376 ± 0.127 2.245 2.608 1.71 ± 0.16
pnpr@HEAD 1.388 ± 0.102 1.285 1.601 1.00
pnpr@main 1.459 ± 0.092 1.315 1.573 1.05 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4013541708800004,
      "stddev": 0.12099660080722999,
      "median": 2.4019433032800004,
      "user": 1.2253265199999999,
      "system": 1.36881588,
      "min": 2.24989742128,
      "max": 2.6020474302800003
    },
    {
      "command": "pacquet@main",
      "mean": 2.37582066598,
      "stddev": 0.12732725788018584,
      "median": 2.3281100672800004,
      "user": 1.27913592,
      "system": 1.33482688,
      "min": 2.2445751522800004,
      "max": 2.60780318228
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.38828704408,
      "stddev": 0.10219728559044217,
      "median": 1.3572624587800002,
      "user": 1.1656081199999997,
      "system": 1.20758068,
      "min": 1.28475719028,
      "max": 1.6008955222799999
    },
    {
      "command": "pnpr@main",
      "mean": 1.4594916169799999,
      "stddev": 0.09174209171377048,
      "median": 1.4584183562800002,
      "user": 1.21978732,
      "system": 1.25833428,
      "min": 1.31481771028,
      "max": 1.57332116928
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 274.9 ± 15.0 258.5 310.2 1.01 ± 0.07
pacquet@main 271.9 ± 13.1 256.2 299.1 1.00
pnpr@HEAD 278.6 ± 6.4 267.5 290.7 1.02 ± 0.05
pnpr@main 283.1 ± 9.5 266.3 299.2 1.04 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.27494718815999997,
      "stddev": 0.014979393625650518,
      "median": 0.27256763326,
      "user": 0.21482116,
      "system": 0.50632392,
      "min": 0.25846736376,
      "max": 0.31016550276
    },
    {
      "command": "pacquet@main",
      "mean": 0.27192358836,
      "stddev": 0.013115138279727948,
      "median": 0.26835564676,
      "user": 0.21792576000000002,
      "system": 0.49002751999999994,
      "min": 0.25617793676,
      "max": 0.29906607676
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27855351926000005,
      "stddev": 0.0064328788097178305,
      "median": 0.27858120676,
      "user": 0.22527935999999996,
      "system": 0.49067921999999997,
      "min": 0.26749054276,
      "max": 0.29074753076
    },
    {
      "command": "pnpr@main",
      "mean": 0.28314923126,
      "stddev": 0.00946909149311634,
      "median": 0.28074998825999997,
      "user": 0.22075765999999994,
      "system": 0.50762062,
      "min": 0.26632340076,
      "max": 0.29921471676
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 7.7 ± 0.9 6.0 12.1 1.02 ± 0.21
pacquet@main 8.5 ± 1.1 6.9 13.0 1.12 ± 0.24
pnpr@HEAD 9.5 ± 1.7 6.4 16.6 1.26 ± 0.31
pnpr@main 7.6 ± 1.3 5.9 14.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.007675386369565218,
      "stddev": 0.0009148413342597837,
      "median": 0.0075706765,
      "user": 0.005020712240802674,
      "system": 0.0027050387959866224,
      "min": 0.0060056295,
      "max": 0.012112081500000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.00849190231314879,
      "stddev": 0.001104995544519534,
      "median": 0.0083141915,
      "user": 0.005676074602076125,
      "system": 0.0028582332179930775,
      "min": 0.0069109475,
      "max": 0.012998355500000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009541084668067221,
      "stddev": 0.0016574154186927473,
      "median": 0.0093602955,
      "user": 0.00603723327731092,
      "system": 0.0035273691876750697,
      "min": 0.0063806425,
      "max": 0.0166353735
    },
    {
      "command": "pnpr@main",
      "mean": 0.007554513702290078,
      "stddev": 0.0012898972194670415,
      "median": 0.0070402755,
      "user": 0.004986856793893129,
      "system": 0.0026274305343511454,
      "min": 0.005881346500000001,
      "max": 0.014469868500000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.1 ± 1.2 6.2 15.7 1.02 ± 0.22
pacquet@main 10.1 ± 2.6 6.7 20.4 1.27 ± 0.38
pnpr@HEAD 8.7 ± 1.4 6.5 15.7 1.09 ± 0.25
pnpr@main 8.0 ± 1.2 6.0 11.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00814645373302326,
      "stddev": 0.0012472982591732725,
      "median": 0.007987589140000001,
      "user": 0.005681343100775197,
      "system": 0.0024874705426356594,
      "min": 0.006189503640000001,
      "max": 0.015691820640000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.010140377385370377,
      "stddev": 0.002553443065793186,
      "median": 0.00947509164,
      "user": 0.006348115925925924,
      "system": 0.0037694629629629636,
      "min": 0.006729026640000001,
      "max": 0.020407934640000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008715036566199265,
      "stddev": 0.0014463972690222095,
      "median": 0.00838753964,
      "user": 0.0058908809594095946,
      "system": 0.002828140221402213,
      "min": 0.006544750640000001,
      "max": 0.01567242464
    },
    {
      "command": "pnpr@main",
      "mean": 0.007966771229285713,
      "stddev": 0.0012447294051698336,
      "median": 0.00788424514,
      "user": 0.005358319464285712,
      "system": 0.002619380357142858,
      "min": 0.006013172640000001,
      "max": 0.01180068664
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.813 ± 0.034 2.770 2.877 1.81 ± 0.15
pacquet@main 2.862 ± 0.049 2.792 2.955 1.85 ± 0.16
pnpr@HEAD 1.591 ± 0.089 1.433 1.724 1.03 ± 0.10
pnpr@main 1.551 ± 0.128 1.407 1.745 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.8133733129,
      "stddev": 0.033805278275741105,
      "median": 2.8057316925,
      "user": 1.8599237799999997,
      "system": 1.47915466,
      "min": 2.7699252595000003,
      "max": 2.8767464695
    },
    {
      "command": "pacquet@main",
      "mean": 2.8623986573000004,
      "stddev": 0.048874194477022924,
      "median": 2.8560198515,
      "user": 2.0526902799999998,
      "system": 1.51139026,
      "min": 2.7915333215,
      "max": 2.9552755995
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5914969626000002,
      "stddev": 0.08872606699500875,
      "median": 1.6316007650000002,
      "user": 1.33476038,
      "system": 1.58395636,
      "min": 1.4333481935,
      "max": 1.7241812085000001
    },
    {
      "command": "pnpr@main",
      "mean": 1.5509005210000002,
      "stddev": 0.12791589281068216,
      "median": 1.494994781,
      "user": 1.32132898,
      "system": 1.47831526,
      "min": 1.4068042775,
      "max": 1.7452978965000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 451.2 ± 46.8 384.5 533.0 1.36 ± 0.15
pacquet@main 450.1 ± 55.2 366.2 550.2 1.36 ± 0.18
pnpr@HEAD 332.4 ± 9.8 315.3 344.6 1.00 ± 0.05
pnpr@main 331.7 ± 15.0 317.2 365.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.45115133458,
      "stddev": 0.04682973870645756,
      "median": 0.45474925637999997,
      "user": 0.52216278,
      "system": 0.66851924,
      "min": 0.38446277038,
      "max": 0.53299551238
    },
    {
      "command": "pacquet@main",
      "mean": 0.4500820085799999,
      "stddev": 0.0552207013215966,
      "median": 0.44298593538000003,
      "user": 0.5425091799999999,
      "system": 0.67525164,
      "min": 0.36619161438000003,
      "max": 0.55017216538
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33238111578000007,
      "stddev": 0.009766284708285214,
      "median": 0.33179118688,
      "user": 0.22109698,
      "system": 0.5112130399999999,
      "min": 0.31533602338,
      "max": 0.34464059138
    },
    {
      "command": "pnpr@main",
      "mean": 0.33166330718000003,
      "stddev": 0.015036105999740992,
      "median": 0.32611237088,
      "user": 0.22764108,
      "system": 0.49055543999999995,
      "min": 0.31724113938,
      "max": 0.36586412038
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.900 ± 0.040 1.848 1.991 5.41 ± 0.43
pacquet@main 1.936 ± 0.062 1.871 2.051 5.51 ± 0.45
pnpr@HEAD 0.386 ± 0.029 0.344 0.427 1.10 ± 0.12
pnpr@main 0.351 ± 0.027 0.324 0.405 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.90033478474,
      "stddev": 0.04030663661432386,
      "median": 1.89748616724,
      "user": 0.7558673399999999,
      "system": 0.7354931199999999,
      "min": 1.8475734587400001,
      "max": 1.99097405874
    },
    {
      "command": "pacquet@main",
      "mean": 1.9363387362400002,
      "stddev": 0.062243309162981694,
      "median": 1.91974254174,
      "user": 0.86613524,
      "system": 0.73452462,
      "min": 1.87094726974,
      "max": 2.0507532267400004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38557554473999994,
      "stddev": 0.02894733726455235,
      "median": 0.38395917073999997,
      "user": 0.25917204,
      "system": 0.55762302,
      "min": 0.34401757274,
      "max": 0.42680248574
    },
    {
      "command": "pnpr@main",
      "mean": 0.35138540834,
      "stddev": 0.02670105673787259,
      "median": 0.34275204224,
      "user": 0.23566013999999996,
      "system": 0.54045742,
      "min": 0.32439779474,
      "max": 0.40538615374000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 301.6 ± 55.0 231.5 433.1 2.30 ± 0.49
pacquet@main 368.3 ± 107.8 267.2 573.0 2.81 ± 0.88
pnpr@HEAD 154.3 ± 59.2 98.3 301.0 1.18 ± 0.47
pnpr@main 130.9 ± 14.5 104.4 158.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3015982570766666,
      "stddev": 0.0550378313370191,
      "median": 0.29905470666,
      "user": 0.27913728666666665,
      "system": 0.07375251999999999,
      "min": 0.23149002366000002,
      "max": 0.43313232966
    },
    {
      "command": "pacquet@main",
      "mean": 0.36825889806,
      "stddev": 0.10776264197306303,
      "median": 0.33211973766,
      "user": 0.32722082,
      "system": 0.10585342,
      "min": 0.26723612166,
      "max": 0.57295984466
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.15429229894571433,
      "stddev": 0.05922223969388323,
      "median": 0.12658271666,
      "user": 0.0640016676190476,
      "system": 0.02296725714285714,
      "min": 0.09832545566000002,
      "max": 0.30101451466
    },
    {
      "command": "pnpr@main",
      "mean": 0.13087628546952385,
      "stddev": 0.014520390066463619,
      "median": 0.13422423966000002,
      "user": 0.049706381904761905,
      "system": 0.01805706761904762,
      "min": 0.10436842866000001,
      "max": 0.15798331666
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 772.7 ± 176.3 536.7 1052.0 1.09 ± 0.29
pacquet@main 707.9 ± 95.6 554.3 840.2 1.00
pnpm@HEAD 3838.8 ± 233.6 3599.6 4292.4 5.42 ± 0.80
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7726692310333334,
      "stddev": 0.1762973548450656,
      "median": 0.7935399257,
      "user": 0.7695037044444444,
      "system": 0.1518765311111111,
      "min": 0.5366934677,
      "max": 1.0520018757
    },
    {
      "command": "pacquet@main",
      "mean": 0.7078733605888891,
      "stddev": 0.09564774117579351,
      "median": 0.7177972017,
      "user": 0.7142947044444443,
      "system": 0.14029186444444441,
      "min": 0.5543072107,
      "max": 0.8401670277000001
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.838840938144444,
      "stddev": 0.23364095906187263,
      "median": 3.8529287417,
      "user": 5.84503514888889,
      "system": 0.32615975333333336,
      "min": 3.5995919276999997,
      "max": 4.2924225567
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.483 ± 0.136 4.361 4.813 1.26 ± 0.06
pacquet@main 4.406 ± 0.054 4.337 4.510 1.24 ± 0.05
pnpr@HEAD 3.555 ± 0.130 3.408 3.813 1.00
pnpr@main 3.581 ± 0.076 3.493 3.726 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.483101899860001,
      "stddev": 0.13568286915402833,
      "median": 4.44040765636,
      "user": 1.7120037799999999,
      "system": 1.6711113999999998,
      "min": 4.36142099086,
      "max": 4.81301823686
    },
    {
      "command": "pacquet@main",
      "mean": 4.406054361860001,
      "stddev": 0.05438334943134494,
      "median": 4.4042377343600005,
      "user": 1.7104431799999997,
      "system": 1.6095013999999999,
      "min": 4.33684982986,
      "max": 4.50973386986
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5552366800599997,
      "stddev": 0.12991335863472922,
      "median": 3.53426799036,
      "user": 1.6586980799999995,
      "system": 1.6733932999999996,
      "min": 3.40775709986,
      "max": 3.8129820798600003
    },
    {
      "command": "pnpr@main",
      "mean": 3.5813945890600003,
      "stddev": 0.07616331225166849,
      "median": 3.58172795886,
      "user": 1.8363909799999998,
      "system": 1.8281682999999997,
      "min": 3.4926256008600003,
      "max": 3.72648026286
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store — the layout pnpm 12 installs into by default. Comparable to that scenario head-to-head.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 216.6 ± 14.6 194.9 247.7 1.00 ± 0.12
pacquet@main 216.4 ± 21.7 202.3 284.0 1.00
pnpr@HEAD 247.2 ± 14.1 226.4 272.5 1.14 ± 0.13
pnpr@main 239.3 ± 8.5 222.5 251.5 1.11 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21663965221846157,
      "stddev": 0.014578786385531395,
      "median": 0.21436941068,
      "user": 0.2656199323076923,
      "system": 0.2263924230769231,
      "min": 0.19488467668,
      "max": 0.24773201268000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.21644413926333336,
      "stddev": 0.021715612821657473,
      "median": 0.21099405968,
      "user": 0.25926873999999994,
      "system": 0.22683850000000003,
      "min": 0.20233017168,
      "max": 0.28403549568
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.24717181301333335,
      "stddev": 0.014053223676001045,
      "median": 0.24743171168000003,
      "user": 0.28799299,
      "system": 0.2494843333333333,
      "min": 0.22635327268000002,
      "max": 0.27246589668000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.2392659348618182,
      "stddev": 0.008453319501891904,
      "median": 0.24031946668,
      "user": 0.2961439672727273,
      "system": 0.2278456818181818,
      "min": 0.22246903168,
      "max": 0.25153666268
    }
  ]
}

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13889
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
194.88 ms
(+6.16%)Baseline: 183.57 ms
220.29 ms
(88.47%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,769.93 ms
(-0.83%)Baseline: 2,793.06 ms
3,351.67 ms
(82.64%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,847.57 ms
(-4.29%)Baseline: 1,930.34 ms
2,316.41 ms
(79.76%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
384.46 ms
(-16.18%)Baseline: 458.65 ms
550.38 ms
(69.85%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
231.49 ms
(+6.45%)Baseline: 217.46 ms
260.95 ms
(88.71%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,249.90 ms
(-2.62%)Baseline: 2,310.38 ms
2,772.46 ms
(81.15%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,361.42 ms
(+0.02%)Baseline: 4,360.36 ms
5,232.43 ms
(83.35%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
258.47 ms
(-9.07%)Baseline: 284.24 ms
341.08 ms
(75.78%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
536.69 ms
(+2.66%)Baseline: 522.77 ms
627.33 ms
(85.55%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
6.19 ms
(-8.58%)Baseline: 6.77 ms
8.12 ms
(76.19%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
6.01 ms
(-7.88%)Baseline: 6.52 ms
7.82 ms
(76.77%)
🐰 View full continuous benchmarking report in Bencher

@lazerg

lazerg commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

The Bencher alert (isolated-linker.fresh-install.hot-cache.hot-store, +47%) looks unrelated to this change. This PR only touches the self-update version-resolution code: config_deps.rs's resolve_pnpm_version and selfUpdate.ts. That code runs during pnpm self-update, not during install or linking. The other benchmark scenarios in the same report show small, non-alerting deltas, consistent with runner noise. #13877 hit the same check with a similar unrelated alert and still merged.

@zkochan
zkochan force-pushed the fix/issue-13883-self-update-tag-downgrade branch from 54f2770 to b8f65df Compare August 20, 2026 18:41
@coderabbitai

coderabbitai Bot commented Aug 20, 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.

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge with focused coverage of the corrected self-update behavior in both implementations.

The new exclusions are limited to the exact running pnpm version, preserve release-age filtering for other versions and packages, and the reviewed changes reveal no concrete blocking or non-blocking defect.

Reviews (1): Last reviewed commit: "fix(self-update): do not downgrade when ..." | Re-trigger Greptile

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Informational

1. Historical comment in Rust test 📘 Rule violation ⚙ Maintainability
Description
A newly added test comment (in both Rust and TypeScript) explains prior behavior—e.g., a tag being
moved back causing a downgrade or the user being switched—instead of describing the current
contract/expectation under test. This violates the rule against historical/temporal comments and
risks becoming stale as behavior changes.
Code

pnpm/crates/cli/src/config_deps/tests.rs[R395-398]

+/// pnpm/pnpm#13883: a dist-tag pointing at the running pnpm, published
+/// within the `minimumReleaseAge` cutoff, must still resolve to it. The
+/// maturity filter moved such a tag back to the previous mature release,
+/// so `pnpm self-update <tag>` downgraded instead of doing nothing.
Relevance

● Weak

Recent close precedent rejected rewording historical comments, despite other accepted
comment-trimming suggestions; team behavior is mixed.

PR-#13728
PR-#13905

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The cited additions are written with past-tense, historical framing (e.g., language like "moved" and
outcomes like "downgraded"/"switched") rather than stating the present behavior the tests assert;
the compliance checklist explicitly forbids temporal or historical narration in inline test comments
and requires comments to describe the current contract being tested.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/cli/src/config_deps/tests.rs[395-398]
pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts[560-563]

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

## Issue description
Newly added test comments in Rust and TypeScript describe historical behavior (e.g., the tag being “moved back” leading to a downgrade or a user being “switched”) rather than stating the current contract/expected behavior that the test is asserting.

## Issue Context
Per the review guide/compliance rule, inline comments should document current behavior/contracts, not narrate what used to happen; historical/temporal phrasing becomes stale when implementation changes.

## Fix Focus Areas
- pnpm/crates/cli/src/config_deps/tests.rs[395-398]
- pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts[560-563]

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


Grey Divider

Context sources
✅ Compliance rules (platform): 27 rules

Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13889
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)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
226.35 ms
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,433.35 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
344.02 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
315.34 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
98.33 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,284.76 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,407.76 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
267.49 ms
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
6.54 ms
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
6.38 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit f28e6cc into pnpm:main Aug 20, 2026
39 checks passed
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 self-update next-12 downgrades from rc.4 to rc.3

3 participants