Repository navigation
fix(resolving-npm-resolver): remember the release-age upgrade of a lowest-version mirror pick - #17036
Conversation
…west-version mirror pick The release-age upgrade marks the document it settled on, so later picks of the same package in this install do not ask for the full document again. That matters when the full document is no more complete than the abbreviated one. Three call sites persisted the upgrade and marked it, each in its own copy: - handle_cache_hit - fetch_and_pick's persist_release_age_upgrade - PickState::upgraded_meta, used by the online lowest-version mirror read The third copy never marked. With `minimumReleaseAge` and a lowest-direct or time-based resolution, a registry whose metadata lacks a complete `time` map was asked for the full document once per pick of the package. PickState::upgrade_for_release_age now runs the upgrade, persists an upgraded document unless this is a dry run, and marks the document it returns. It matches v11's upgradeMetaForCache. Every caller uses it and keeps only its own caching rule. handle_cache_hit takes the PickState in place of seven of its fields. The new test reproduces the extra request: two lowest-version picks over a warm abbreviated mirror made two full-document requests. Removing the mark now fails it, along with two existing release-age tests. Part of pnpm/tasks#146. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17036 +/- ##
=======================================
Coverage 92.55% 92.55%
=======================================
Files 1779 1779
Lines 228563 228504 -59
=======================================
- Hits 211543 211501 -42
+ Misses 17020 17003 -17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
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; the linked and injected workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4513916758599996,
"stddev": 0.1253758049892211,
"median": 2.37852118246,
"user": 1.5420642599999996,
"system": 1.7801924,
"min": 2.32176600796,
"max": 2.67101682496
},
{
"command": "pacquet@main",
"mean": 2.45981823556,
"stddev": 0.12091550337853496,
"median": 2.39986239996,
"user": 1.52596096,
"system": 1.7598077,
"min": 2.3542779389599997,
"max": 2.68343253496
},
{
"command": "pnpr@HEAD",
"mean": 1.47851317936,
"stddev": 0.09669537502669023,
"median": 1.4691989249600002,
"user": 1.40869486,
"system": 1.6553331999999998,
"min": 1.33630320696,
"max": 1.67822455896
},
{
"command": "pnpr@main",
"mean": 1.4922331003600005,
"stddev": 0.12301816249503013,
"median": 1.4456531354600002,
"user": 1.44281866,
"system": 1.6298196999999999,
"min": 1.3603283729600002,
"max": 1.7231647399600003
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.23840316671999995,
"stddev": 0.030270287072672437,
"median": 0.22701986452,
"user": 0.27734052,
"system": 0.5581812399999999,
"min": 0.21987893002,
"max": 0.31838118102
},
{
"command": "pacquet@main",
"mean": 0.29890514402,
"stddev": 0.07129064643609347,
"median": 0.28142780652,
"user": 0.34355642,
"system": 0.7554597399999999,
"min": 0.22964648602,
"max": 0.40956850602
},
{
"command": "pnpr@HEAD",
"mean": 0.24889341202,
"stddev": 0.008015056630430228,
"median": 0.24879848052,
"user": 0.27905862000000003,
"system": 0.58406784,
"min": 0.23449988702,
"max": 0.26255255602
},
{
"command": "pnpr@main",
"mean": 0.24556853701999998,
"stddev": 0.006726547240900584,
"median": 0.24731643752,
"user": 0.27444221999999996,
"system": 0.5831776399999999,
"min": 0.23525692402,
"max": 0.25454816902
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.01207334400779221,
"stddev": 0.001898071684815538,
"median": 0.012367077800000001,
"user": 0.006026823116883118,
"system": 0.007132164155844154,
"min": 0.0076397343,
"max": 0.0183704963
},
{
"command": "pacquet@main",
"mean": 0.00788711400989762,
"stddev": 0.0004788691986692014,
"median": 0.0078286583,
"user": 0.0048469163139931715,
"system": 0.003899100341296928,
"min": 0.006873955300000001,
"max": 0.0112720023
},
{
"command": "pnpr@HEAD",
"mean": 0.008006640173333333,
"stddev": 0.0006338629893739107,
"median": 0.0078331518,
"user": 0.004795275999999996,
"system": 0.004050908133333332,
"min": 0.006976509300000001,
"max": 0.0108878413
},
{
"command": "pnpr@main",
"mean": 0.007764054905504596,
"stddev": 0.0005099969731477301,
"median": 0.007686351300000001,
"user": 0.0047214913761467895,
"system": 0.0037952031804281347,
"min": 0.006885809300000001,
"max": 0.0098348443
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.008069571466870226,
"stddev": 0.0003812619906619507,
"median": 0.00802394536,
"user": 0.0045964954198473304,
"system": 0.004297787786259541,
"min": 0.007259946360000001,
"max": 0.010652453360000001
},
{
"command": "pacquet@main",
"mean": 0.007905359614416957,
"stddev": 0.0003246883211662825,
"median": 0.007883587360000001,
"user": 0.004950117314487634,
"system": 0.0037409763250883387,
"min": 0.0071134323600000006,
"max": 0.009990580360000001
},
{
"command": "pnpr@HEAD",
"mean": 0.00789561652666667,
"stddev": 0.00030792448318883,
"median": 0.00786716636,
"user": 0.004772268055555553,
"system": 0.003754007986111114,
"min": 0.007216666360000001,
"max": 0.009971415360000001
},
{
"command": "pnpr@main",
"mean": 0.007851293516794425,
"stddev": 0.0003638248257738858,
"median": 0.00783011636,
"user": 0.004557849477351914,
"system": 0.00390815331010453,
"min": 0.007199092360000001,
"max": 0.01149889236
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5147008696599995,
"stddev": 0.06884065266880746,
"median": 2.4921248496599997,
"user": 1.80836498,
"system": 1.6312361,
"min": 2.46595877466,
"max": 2.68815347966
},
{
"command": "pacquet@main",
"mean": 2.5007279555599995,
"stddev": 0.06073363155447968,
"median": 2.48321045566,
"user": 1.78811908,
"system": 1.5528163999999998,
"min": 2.46251099666,
"max": 2.66879039066
},
{
"command": "pnpr@HEAD",
"mean": 1.50329885656,
"stddev": 0.10685180927571736,
"median": 1.4737163661600001,
"user": 1.1389408799999998,
"system": 1.2169580999999998,
"min": 1.38994224766,
"max": 1.6900883176600001
},
{
"command": "pnpr@main",
"mean": 1.5898018550599997,
"stddev": 0.10092147736624395,
"median": 1.5789075161600001,
"user": 1.1264372799999998,
"system": 1.2550137,
"min": 1.41861944766,
"max": 1.7947669056600002
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4466579385,
"stddev": 0.023708128428291002,
"median": 0.44712804520000005,
"user": 0.6264228999999999,
"system": 0.7569208599999999,
"min": 0.4098404167,
"max": 0.4852897707
},
{
"command": "pacquet@main",
"mean": 0.5527257968,
"stddev": 0.12009137694708202,
"median": 0.5383647327000001,
"user": 0.8060329000000002,
"system": 0.96004816,
"min": 0.42826231670000003,
"max": 0.7185488837000001
},
{
"command": "pnpr@HEAD",
"mean": 0.2922920924,
"stddev": 0.00994668935055182,
"median": 0.2961785002,
"user": 0.2571796,
"system": 0.5668705599999999,
"min": 0.2718358877,
"max": 0.30254675470000003
},
{
"command": "pnpr@main",
"mean": 0.2966268077,
"stddev": 0.012912222183044417,
"median": 0.2991007747,
"user": 0.26124400000000003,
"system": 0.5557643599999998,
"min": 0.2709821207,
"max": 0.3110991557
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.66807420048,
"stddev": 0.016693734055091603,
"median": 1.6703416395800001,
"user": 1.10335846,
"system": 1.0902896600000003,
"min": 1.63076775208,
"max": 1.68767871508
},
{
"command": "pacquet@main",
"mean": 1.7805419411800003,
"stddev": 0.272219987514188,
"median": 1.67948798508,
"user": 1.28924636,
"system": 1.30938516,
"min": 1.6211869350800001,
"max": 2.5332715560800003
},
{
"command": "pnpr@HEAD",
"mean": 0.33141132087999997,
"stddev": 0.01436843448880862,
"median": 0.32650885108,
"user": 0.30478116,
"system": 0.62114026,
"min": 0.31626059708,
"max": 0.35564436908
},
{
"command": "pnpr@main",
"mean": 0.33217908348,
"stddev": 0.012323118492146717,
"median": 0.32695457608,
"user": 0.30971825999999997,
"system": 0.63307766,
"min": 0.32069676408,
"max": 0.36020673308
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.22226087774857142,
"stddev": 0.01262149527676705,
"median": 0.22178913332,
"user": 0.19302196571428573,
"system": 0.08901556857142855,
"min": 0.20183554532,
"max": 0.24181704132
},
{
"command": "pacquet@main",
"mean": 0.2202968199033333,
"stddev": 0.014939322560966943,
"median": 0.22016514832,
"user": 0.1855672633333333,
"system": 0.08691822333333332,
"min": 0.19313728032,
"max": 0.24806530632
},
{
"command": "pnpr@HEAD",
"mean": 0.08824448291375,
"stddev": 0.001393620375993448,
"median": 0.08800457882,
"user": 0.029916867499999996,
"system": 0.011732307499999997,
"min": 0.08578590032,
"max": 0.09322865132
},
{
"command": "pnpr@main",
"mean": 0.09026775235333334,
"stddev": 0.002256395494746777,
"median": 0.08987627532,
"user": 0.03138921333333333,
"system": 0.014829506666666662,
"min": 0.08604159032,
"max": 0.09490683932
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2265062534488889,
"stddev": 0.012499184017991737,
"median": 0.22531513656000002,
"user": 0.22460469777777772,
"system": 0.05135722222222222,
"min": 0.21178714956,
"max": 0.25091835756
},
{
"command": "pacquet@main",
"mean": 0.22105939655999998,
"stddev": 0.006691118165335466,
"median": 0.22086948656000002,
"user": 0.21932603111111107,
"system": 0.05415733333333333,
"min": 0.21202668056,
"max": 0.22985180756
},
{
"command": "pnpm@HEAD",
"mean": 3.4650334327822225,
"stddev": 0.09277787062408879,
"median": 3.43040564056,
"user": 5.351212919999999,
"system": 0.34211911111111104,
"min": 3.3701885045599997,
"max": 3.63968135056
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
Confirmation (reversed target order)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.31938992324000004,
"stddev": 0.05561334404126582,
"median": 0.32905159574000004,
"user": 0.24864528,
"system": 0.12405382000000001,
"min": 0.20073095574,
"max": 0.38692925674
},
{
"command": "pacquet@main",
"mean": 0.19934069066857146,
"stddev": 0.004671712990207644,
"median": 0.19732507824,
"user": 0.1597960657142857,
"system": 0.07432932,
"min": 0.19274605974,
"max": 0.20975250774
}
],
"confirmation": {
"results": [
{
"command": "pacquet@main",
"mean": 0.1979497452866667,
"stddev": 0.0036023638067770483,
"median": 0.19651918222,
"user": 0.15558888666666668,
"system": 0.07864034,
"min": 0.19395914122000002,
"max": 0.20444528822000002
},
{
"command": "pacquet@HEAD",
"mean": 0.19870831768666672,
"stddev": 0.0076614638664591625,
"median": 0.19987301322,
"user": 0.16032888666666667,
"system": 0.07480907333333332,
"min": 0.18863521522,
"max": 0.21089909522000003
}
]
}
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.07323895674380951,
"stddev": 0.003832356751262566,
"median": 0.07212273522000001,
"user": 0.02573275904761905,
"system": 0.052633255238095235,
"min": 0.06865129422,
"max": 0.08068730722
},
{
"command": "pacquet@main",
"mean": 0.07133143224857143,
"stddev": 0.005481927978230548,
"median": 0.06915943122,
"user": 0.026031168571428568,
"system": 0.049468917142857144,
"min": 0.06817094022,
"max": 0.09752284122
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.616245673220001,
"stddev": 0.15775165678558803,
"median": 4.55762298902,
"user": 1.6997705,
"system": 2.03675526,
"min": 4.41218234952,
"max": 4.874597319519999
},
{
"command": "pacquet@main",
"mean": 4.48264739542,
"stddev": 0.07393756952689727,
"median": 4.45382193802,
"user": 1.6153704999999998,
"system": 1.9546030600000002,
"min": 4.4049996695199996,
"max": 4.61549058752
},
{
"command": "pnpr@HEAD",
"mean": 3.5840591817200007,
"stddev": 0.11295009875510809,
"median": 3.56329464152,
"user": 1.5546164999999998,
"system": 1.8447799600000003,
"min": 3.45533943552,
"max": 3.88028021652
},
{
"command": "pnpr@main",
"mean": 3.6057969555200002,
"stddev": 0.1184588677595486,
"median": 3.5609120345200003,
"user": 1.5275284999999996,
"system": 1.81357486,
"min": 3.47735256252,
"max": 3.8203513295200002
}
]
}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. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.11707437441826088,
"stddev": 0.0042668733812126726,
"median": 0.11671679494000001,
"user": 0.1441982730434783,
"system": 0.11972546521739132,
"min": 0.10996186794,
"max": 0.12552407894
},
{
"command": "pacquet@main",
"mean": 0.11466353812181818,
"stddev": 0.005843822199017184,
"median": 0.11256222044,
"user": 0.14101836,
"system": 0.12082008181818181,
"min": 0.10842876594,
"max": 0.13454520494
},
{
"command": "pnpr@HEAD",
"mean": 0.12400918308285716,
"stddev": 0.004145694215174959,
"median": 0.12343707594,
"user": 0.1508203123809524,
"system": 0.12342989999999998,
"min": 0.11724263294000001,
"max": 0.13433119294
},
{
"command": "pnpr@main",
"mean": 0.12834770014,
"stddev": 0.001754511119491472,
"median": 0.12821268794000001,
"user": 0.15756690999999998,
"system": 0.12509214999999999,
"min": 0.12600760794000002,
"max": 0.13259969894
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.12622645306,
"stddev": 0.019390951936690045,
"median": 1.12658412306,
"user": 0.5187473999999999,
"system": 0.21154744,
"min": 1.09502776056,
"max": 1.15189222056
},
{
"command": "pacquet@main",
"mean": 1.13174752446,
"stddev": 0.016792109837462037,
"median": 1.13288327706,
"user": 0.5403594999999999,
"system": 0.21479524000000003,
"min": 1.10311919256,
"max": 1.16227086456
}
]
} |
|
@coderabbitai review |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoAvoid repeated release-age metadata fetches for lowest-version picks
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can see how risky a PR is at a glance with blast radius labels |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Summary
Fourth step of pnpm/tasks#146 (Related to pnpm/tasks#146). Consolidating the
minimumReleaseAgeupgrade's follow-up work turned up a shipped v12 bug, so this PR is a fix.Bug. The upgrade marks the document it settled on, so later picks of the same package don't ask for the full document again. That matters when the registry's full form is no more complete than its abbreviated one. Three call sites persisted and marked the upgrade, each in its own copy:
handle_cache_hitfetch_and_pick→persist_release_age_upgradePickState::upgraded_metaresolutionMode: lowest-direct/time-based)So with
minimumReleaseAgeand a lowest-version direct pick, a registry whose metadata lacks a completetimemap was asked for the full document once per pick of that package. The third copy came in with #15860 (12.8.0).Fix.
PickState::upgrade_for_release_ageruns the upgrade, persists an upgraded document unless this is a dry run, and marks the document it returns. It matches v11'supgradeMetaForCache. All three callers use it and keep only their own caching rule.handle_cache_hitnow takes thePickStatein place of seven of its fields.v11. Not affected. Every v11 path goes through
upgradeMetaForCache, which marks.Tests.
published_by_upgrade_of_a_lowest_version_mirror_pick_is_remembered_across_picksruns two lowest-version picks over a warm abbreviated mirror. Before the fix it saw 2 full-document requests (Expected 1 request(s) ... but received 2), and now it sees 1. Removing the mark fails it, along with 2 existing release-age tests. All 625 tests ofpnpm-resolving-npm-resolverpass.Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
minimumReleaseAgeis set andresolutionModeislowest-directortime-based, including when registry metadata lacks publish times for some versions.