Repository navigation
fix(self-update): do not downgrade when a dist-tag points at the running version - #13889
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe 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. ChangesSelf-update version resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to 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
Assessment against linked issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Integrated-Benchmark Report (Linux)Commit: 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
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
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
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
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
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
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
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
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
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
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 storeSame 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.
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
}
]
} |
|
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 |
54f2770 to
b8f65df
Compare
|
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. |
Confidence Score: 5/5The 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 |
Code Review by Qodo
1. Historical comment in Rust test
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
| Project | pnpm's project |
| Branch | pr/13889 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| gvs-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 226.35 ms |
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,433.35 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 344.02 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 315.34 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 98.33 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,284.76 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,407.76 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 267.49 ms |
| isolated-linker.repeat-install.cold-cache.hot-store | 📈 view plot | 6.54 ms |
| isolated-linker.repeat-install.hot-cache.hot-store | 📈 view plot | 6.38 ms |
Summary
pnpm self-update next-12on v12.0.0-rc.4 switched down to v12.0.0-rc.3. Thenext-12tag did point at rc.4, but rc.4 was about 11 hours old, so the built-inminimumReleaseAgedefault (1440 minutes) dropped it from the packument andfilterPkgMetadataByPublishDaterepopulated 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 explicitpnpm self-update lateststill has to force a downgrade when the registry'slatestgenuinely lags a new major.So self-update now adds the running version to
minimumReleaseAgeExcludefor 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
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
pnpm self-update <tag>incorrectly downgrading an immature active version.Tests