Repository navigation
fix(resolving-deps-resolver): keep synthesized reuse results out of the wanted-dep cache - #13122
Conversation
|
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 (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughThe resolver no longer stores synthesized reused resolutions in the shared wanted-dependency cache. New fixtures and an end-to-end test verify that denied reuse preserves dependency-bearing lockfile snapshots instead of producing empty entries. ChangesDenied reuse lockfile preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
PR Summary by QodoFix lockfile corruption by excluding reused-node synth results from wanted-dep cache
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. Changeset missing pnpm entry
|
Confidence Score: 5/5Safe to merge — the change is a targeted deletion of incorrect code with no behaviour change on the happy path, backed by a deterministic regression test. The fix removes exactly the code that caused the corruption and leaves the only legitimate resolved_by_wanted write (on the fresh-resolve path) intact. All fixture packages needed by the new test exist in the mock registry. The changeset accurately describes the user-visible impact. No files require special attention. Reviews (2): Last reviewed commit: "fix(resolving-deps-resolver): keep synth..." | Re-trigger Greptile |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm/crates/cli/tests/lockfile_resolution_reuse.rs (1)
154-189: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse regular comments for test descriptions.
As per coding guidelines, use rustdoc comments (
///) for public API contracts and regular comments (//) for implementation rationale and internal descriptions. Since tests are not public APIs, consider using regular comments for this scenario description.♻️ Proposed refactor
-/// An edge denied subtree reuse re-resolves from the registry instead of -/// reading another edge's reused resolution out of the wanted-dep cache. -/// -/// The synthesized `ResolveResult` a reused node is built from carries a -/// manifest without `dependencies` (a reused node's children come from -/// the snapshot graph), so it must never satisfy a fresh-resolve cache -/// lookup: a fresh edge walks children from the manifest, and the -/// dependency-less manifest would make it record the package as a leaf. -/// When that leaf occurrence sits at a shallower depth than the healthy -/// reused occurrence it wins children ownership, so the package's -/// snapshot collapses to `{}`, its peer suffix is dropped, and its -/// dependents re-point at the bare instance -/// (`'`@yarnpkg/shell`@4.0.0': {}` in the original report). -/// -/// Scenario, driven by the `@pnpm.e2e/reuse-chain-*` fixtures -/// (`grand → parent → target`, where `target` deps `@pnpm.e2e/abc` + -/// `@pnpm.e2e/dep-of-pkg-with-1-dep`): -/// -/// * `pkg-a` deps `grand`, so its unchanged walk reuses `target` at -/// depth 2 and caches the synthesized resolution under the exact-pin -/// wanted key. -/// * `pkg-b` deps `parent` plus `dep-of-pkg-with-1-dep` directly. The -/// test bumps that direct dep; `target`'s snapshot also depends on -/// it, so pkg-b's transitive edge to `target` (depth 1) is denied -/// reuse by the changed-direct-dep gate and resolves fresh — with -/// the same wanted key pkg-a already cached. -/// -/// Importers resolve in order, so pkg-a's cache entry exists when -/// pkg-b's denied edge looks up; the depth-1 occurrence out-ranks the -/// depth-2 one for children ownership, making the corruption (before -/// the fix) deterministic rather than a race. -/// -/// `target`'s dep `@pnpm.e2e/abc` wants peers nothing in the subtree -/// provides, so auto-install-peers suffixes `target` — the corrupted -/// instance is then visible as a distinct bare-key `{}` snapshot rather -/// than colliding with the healthy suffixed one. +// An edge denied subtree reuse re-resolves from the registry instead of +// reading another edge's reused resolution out of the wanted-dep cache. +// +// The synthesized `ResolveResult` a reused node is built from carries a +// manifest without `dependencies` (a reused node's children come from +// the snapshot graph), so it must never satisfy a fresh-resolve cache +// lookup: a fresh edge walks children from the manifest, and the +// dependency-less manifest would make it record the package as a leaf. +// When that leaf occurrence sits at a shallower depth than the healthy +// reused occurrence it wins children ownership, so the package's +// snapshot collapses to `{}`, its peer suffix is dropped, and its +// dependents re-point at the bare instance +// (`'`@yarnpkg/shell`@4.0.0': {}` in the original report). +// +// Scenario, driven by the `@pnpm.e2e/reuse-chain-*` fixtures +// (`grand → parent → target`, where `target` deps `@pnpm.e2e/abc` + +// `@pnpm.e2e/dep-of-pkg-with-1-dep`): +// +// * `pkg-a` deps `grand`, so its unchanged walk reuses `target` at +// depth 2 and caches the synthesized resolution under the exact-pin +// wanted key. +// * `pkg-b` deps `parent` plus `dep-of-pkg-with-1-dep` directly. The +// test bumps that direct dep; `target`'s snapshot also depends on +// it, so pkg-b's transitive edge to `target` (depth 1) is denied +// reuse by the changed-direct-dep gate and resolves fresh — with +// the same wanted key pkg-a already cached. +// +// Importers resolve in order, so pkg-a's cache entry exists when +// pkg-b's denied edge looks up; the depth-1 occurrence out-ranks the +// depth-2 one for children ownership, making the corruption (before +// the fix) deterministic rather than a race. +// +// `target`'s dep `@pnpm.e2e/abc` wants peers nothing in the subtree +// provides, so auto-install-peers suffixes `target` — the corrupted +// instance is then visible as a distinct bare-key `{}` snapshot rather +// than colliding with the healthy suffixed one.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs` around lines 154 - 189, Convert the test scenario documentation preceding the lockfile reuse test from rustdoc comments (`///`) to regular comments (`//`). Preserve the existing explanatory content and formatting, changing only the comment style because this is internal test rationale rather than a public API contract.Source: Coding guidelines
.changeset/reuse-denied-edge-empty-snapshot.md (1)
5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify the release note to focus on the user-visible bug.
As per path instructions, changesets should be accurate and concise for users, while implementation rationale (such as explanations of the "wanted-dependency cache" and "dependency-less resolution") belongs in commits. Consider simplifying the text to remove these internal details.
♻️ Proposed refactor
-Fixed a lockfile corruption during non-frozen re-installs: when one workspace project reused a package's resolution from the lockfile and another project's edge to the same package was denied reuse (for example because it also depends on a direct dependency whose specifier changed), the denied edge could read the reused, dependency-less resolution from the shared wanted-dependency cache and record the package as a leaf. Its lockfile snapshot became empty (`{}`), its peer suffix was dropped, and none of its dependencies were linked, which later broke installs and builds consuming that lockfile [`#13070`](https://github.com/pnpm/pnpm/pull/13070). +Fixed a lockfile corruption during non-frozen re-installs: when one workspace project reused a package's resolution from the lockfile and another project's edge to the same package was denied reuse (e.g., due to a changed direct dependency), the package's lockfile snapshot could become empty (`{}`), dropping its peer suffix and dependencies, which broke subsequent installs [`#13070`](https://github.com/pnpm/pnpm/pull/13070).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.changeset/reuse-denied-edge-empty-snapshot.md at line 5, Rewrite the changeset entry to concisely describe the user-visible outcome: non-frozen reinstalls could produce an incomplete lockfile when resolving shared dependencies, causing later installs and builds to fail. Remove internal implementation details about caches, denied edges, resolutions, peer suffixes, and dependency linking while retaining the issue reference.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.changeset/reuse-denied-edge-empty-snapshot.md:
- Line 5: Rewrite the changeset entry to concisely describe the user-visible
outcome: non-frozen reinstalls could produce an incomplete lockfile when
resolving shared dependencies, causing later installs and builds to fail. Remove
internal implementation details about caches, denied edges, resolutions, peer
suffixes, and dependency linking while retaining the issue reference.
In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs`:
- Around line 154-189: Convert the test scenario documentation preceding the
lockfile reuse test from rustdoc comments (`///`) to regular comments (`//`).
Preserve the existing explanatory content and formatting, changing only the
comment style because this is internal test rationale rather than a public API
contract.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b6f473b1-5536-4b63-a81f-5e0d2af45ce5
📒 Files selected for processing (6)
.changeset/reuse-denied-edge-empty-snapshot.mdpnpm/crates/cli/tests/lockfile_resolution_reuse.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpr/.fixtures/packages/@pnpm.e2e/reuse-chain-grand/1.0.0/package.jsonpnpr/.fixtures/packages/@pnpm.e2e/reuse-chain-parent/1.0.0/package.jsonpnpr/.fixtures/packages/@pnpm.e2e/reuse-chain-target/1.0.0/package.json
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13122 +/- ##
=======================================
Coverage 85.66% 85.66%
=======================================
Files 505 505
Lines 83555 83535 -20
=======================================
- Hits 71574 71557 -17
+ Misses 11981 11978 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. 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.4997674412400004,
"stddev": 0.16392983665116517,
"median": 2.43406623194,
"user": 1.6697030800000001,
"system": 1.2827762,
"min": 2.34092416544,
"max": 2.75910372644,
"times": [
2.37849991344,
2.42861380744,
2.36825121444,
2.39472397444,
2.34092416544,
2.45810253844,
2.43951865644,
2.67445582644,
2.75910372644,
2.75548058944
]
},
{
"command": "pacquet@main",
"mean": 2.49418159484,
"stddev": 0.13465045761194283,
"median": 2.4931141619400004,
"user": 1.6160705800000001,
"system": 1.2866126999999998,
"min": 2.35020968744,
"max": 2.73165233444,
"times": [
2.50832630844,
2.47790201544,
2.38491717044,
2.53079404844,
2.36731418844,
2.51178434844,
2.37851215944,
2.73165233444,
2.70040368744,
2.35020968744
]
},
{
"command": "pnpr@HEAD",
"mean": 1.56038329204,
"stddev": 0.16081096486101168,
"median": 1.56143049494,
"user": 1.1617274800000001,
"system": 1.1605596,
"min": 1.37141370944,
"max": 1.73389824444,
"times": [
1.7216079844399998,
1.43810167044,
1.6908559914399999,
1.3801955774399999,
1.6771229724399999,
1.7296510764400002,
1.41524767644,
1.44573801744,
1.73389824444,
1.37141370944
]
},
{
"command": "pnpr@main",
"mean": 1.5003644612399998,
"stddev": 0.14690820160179663,
"median": 1.46422290444,
"user": 1.1929161799999999,
"system": 1.143369,
"min": 1.34924986644,
"max": 1.7751204194399999,
"times": [
1.5102765064399999,
1.47647623344,
1.7751204194399999,
1.59137794344,
1.34924986644,
1.3736444214399999,
1.7031464564399998,
1.41234414844,
1.3600390414399999,
1.45196957544
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24543539056000002,
"stddev": 0.006857926568913409,
"median": 0.24746313006000004,
"user": 0.19488938,
"system": 0.4939494000000001,
"min": 0.23327779656000003,
"max": 0.25300445556,
"times": [
0.25191077656000005,
0.23677023456000001,
0.25070430656000003,
0.24583570356000004,
0.24942242856000002,
0.24818862356000002,
0.25300445556,
0.23850194356000004,
0.24673763656000003,
0.23327779656000003
]
},
{
"command": "pacquet@main",
"mean": 0.24583005966000004,
"stddev": 0.004506289127411957,
"median": 0.24683991006000003,
"user": 0.20316857999999996,
"system": 0.48990619999999996,
"min": 0.23876685356000002,
"max": 0.25071996756000003,
"times": [
0.25071996756000003,
0.23885831156000004,
0.23876685356000002,
0.25016070356000003,
0.25049198156,
0.24351769356000003,
0.24382976556000002,
0.24572222356000004,
0.24827549956000003,
0.24795759656000002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.25989805326000004,
"stddev": 0.0042681826283294646,
"median": 0.2608865905600001,
"user": 0.20038647999999998,
"system": 0.5018399,
"min": 0.25296093756000004,
"max": 0.26568990556000005,
"times": [
0.25296093756000004,
0.26313216056000005,
0.25504199156,
0.26071843056000005,
0.26105475056000005,
0.26568990556000005,
0.26410655056000004,
0.25689099756,
0.26280665756000005,
0.25657815056000005
]
},
{
"command": "pnpr@main",
"mean": 0.25456504946,
"stddev": 0.0051512950290063,
"median": 0.25258432506000006,
"user": 0.19206048,
"system": 0.5184649,
"min": 0.24881182456000003,
"max": 0.26671118256000004,
"times": [
0.25702735756,
0.25267809056,
0.25682057556000004,
0.26671118256000004,
0.24881182456000003,
0.25249055956000005,
0.25039195356000005,
0.25704557056000005,
0.25123488756,
0.25243849256
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6802239211200005,
"stddev": 0.007965100928916722,
"median": 2.68159509842,
"user": 1.7394789400000001,
"system": 1.2735720799999999,
"min": 2.6672149954199997,
"max": 2.6968690024199997,
"times": [
2.6741421924199997,
2.68259586842,
2.6672149954199997,
2.67541500242,
2.68190104842,
2.68128914842,
2.68329489942,
2.67500753742,
2.6968690024199997,
2.68450951642
]
},
{
"command": "pacquet@main",
"mean": 2.6618080139199995,
"stddev": 0.022943258958668736,
"median": 2.67236219442,
"user": 1.7150372400000002,
"system": 1.28573928,
"min": 2.63057867942,
"max": 2.69116918742,
"times": [
2.69116918742,
2.64780449442,
2.6306799764199997,
2.63684305442,
2.66909233142,
2.67689314242,
2.6756320574199997,
2.67926328542,
2.63057867942,
2.6801239304199997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5939552444199998,
"stddev": 0.17282539238498784,
"median": 1.6196229954199999,
"user": 1.12635234,
"system": 1.10501738,
"min": 1.38735322742,
"max": 1.82341000942,
"times": [
1.68119927542,
1.76637308942,
1.65268911242,
1.82341000942,
1.38735322742,
1.44117463642,
1.4017842874200002,
1.7896461944200002,
1.40936573342,
1.58655687842
]
},
{
"command": "pnpr@main",
"mean": 1.5090615172200004,
"stddev": 0.13783693625030083,
"median": 1.44105540292,
"user": 1.1398757400000001,
"system": 1.08010828,
"min": 1.37446406042,
"max": 1.7354841594200001,
"times": [
1.37446406042,
1.44106590142,
1.38068942342,
1.5246127794200002,
1.44104490442,
1.42066161042,
1.7354841594200001,
1.65827758842,
1.41410109142,
1.70021365342
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.53531606146,
"stddev": 0.008910531511385596,
"median": 0.5348383246599999,
"user": 0.6720642199999999,
"system": 0.6310432400000001,
"min": 0.51868730466,
"max": 0.54626604966,
"times": [
0.52782260666,
0.53402958366,
0.53200843666,
0.5299375066600001,
0.54626604966,
0.5457328836600001,
0.54569914366,
0.51868730466,
0.53564706566,
0.53733003366
]
},
{
"command": "pacquet@main",
"mean": 0.5259630472600001,
"stddev": 0.00787640492049623,
"median": 0.5275271051600001,
"user": 0.6518833199999998,
"system": 0.6269634399999999,
"min": 0.51323021366,
"max": 0.53877241166,
"times": [
0.51323021366,
0.51909288966,
0.5324396476600001,
0.53133425666,
0.5190416666600001,
0.53877241166,
0.53047527666,
0.52557107566,
0.5201898996600001,
0.5294831346600001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.28065684925999995,
"stddev": 0.007008041426038309,
"median": 0.27980416516,
"user": 0.16456511999999998,
"system": 0.49372153999999996,
"min": 0.27046819266,
"max": 0.29187144566,
"times": [
0.27848311866000003,
0.29000246766,
0.28130439666,
0.28013730966,
0.27404245966,
0.27046819266,
0.27947102066,
0.28649274966,
0.27429533166000003,
0.29187144566
]
},
{
"command": "pnpr@main",
"mean": 0.28417036955999997,
"stddev": 0.00375113677230441,
"median": 0.28503583966,
"user": 0.16980672000000002,
"system": 0.49143033999999997,
"min": 0.27836045066,
"max": 0.28972084766,
"times": [
0.28730806666,
0.28497147566000003,
0.27836045066,
0.28536198566,
0.28972084766,
0.28510020366,
0.28136847066,
0.28753665466,
0.28320862966,
0.27876691066000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.8460559754,
"stddev": 0.008421170698352326,
"median": 1.8464670586,
"user": 0.88703164,
"system": 0.73282114,
"min": 1.8353606481,
"max": 1.8604177161,
"times": [
1.8357214511,
1.8466683231,
1.8604177161,
1.8399732101,
1.8391570721000001,
1.8500801841,
1.8533725651000001,
1.8535427901,
1.8462657941,
1.8353606481
]
},
{
"command": "pacquet@main",
"mean": 1.8268404847,
"stddev": 0.009762133201016347,
"median": 1.8256974796,
"user": 0.8715273399999999,
"system": 0.7182286400000001,
"min": 1.8075588241,
"max": 1.8436305761,
"times": [
1.8225223491,
1.8242465681,
1.8274234351,
1.8377569771,
1.8238417571,
1.8436305761,
1.8321307330999999,
1.8221452361000001,
1.8271483911,
1.8075588241
]
},
{
"command": "pnpr@HEAD",
"mean": 0.28557266119999997,
"stddev": 0.009070922941313618,
"median": 0.2878121041,
"user": 0.15968043999999998,
"system": 0.50174004,
"min": 0.27382597410000004,
"max": 0.30041609610000003,
"times": [
0.2773013831,
0.29167138410000004,
0.27382597410000004,
0.29130454710000003,
0.30041609610000003,
0.27489758810000003,
0.2860563601,
0.2928760141,
0.2778094171,
0.2895678481
]
},
{
"command": "pnpr@main",
"mean": 0.281381048,
"stddev": 0.008360632197951893,
"median": 0.2797782956,
"user": 0.17352524,
"system": 0.4870830399999999,
"min": 0.2702690351,
"max": 0.2950328501,
"times": [
0.27161831610000003,
0.2833225991,
0.2702690351,
0.2821597361,
0.2773008381,
0.27653766310000005,
0.2876344361,
0.2773968551,
0.2950328501,
0.29253815110000003
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32418065676,
"stddev": 0.006584388631094896,
"median": 0.32421927256000005,
"user": 0.30794256000000003,
"system": 0.07299053999999999,
"min": 0.31442679956,
"max": 0.33656548556000004,
"times": [
0.31702786056000004,
0.32782045856,
0.31442679956,
0.32794787156000005,
0.33656548556000004,
0.32482721556000005,
0.32897327856,
0.32245737756000004,
0.31814889056000006,
0.32361132956000005
]
},
{
"command": "pacquet@main",
"mean": 0.32282383826,
"stddev": 0.007679083877741812,
"median": 0.32217752006,
"user": 0.31285046,
"system": 0.06448113999999999,
"min": 0.31405813156000006,
"max": 0.33535408756000007,
"times": [
0.31728850356000005,
0.33535408756000007,
0.31415999856000004,
0.32299597156000004,
0.32135906856,
0.32590813456000006,
0.31405813156000006,
0.32975689456,
0.31561806056,
0.33173953156
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08464736168121213,
"stddev": 0.0038130242937935177,
"median": 0.08373529656,
"user": 0.016985626666666667,
"system": 0.010900328484848483,
"min": 0.08002792756000002,
"max": 0.09469523856,
"times": [
0.08485038556000002,
0.08857605756,
0.08369187255999999,
0.08002792756000002,
0.08336202456,
0.08018643056,
0.08183243056,
0.08644322956,
0.08019065656000002,
0.08463044556000002,
0.08373529656,
0.08003270356,
0.09006911856,
0.08330431356000001,
0.08992230856,
0.09407008656000002,
0.08349842156000001,
0.08167947256,
0.08510306056,
0.08741005256,
0.08127279656,
0.08854661856000001,
0.08422839456,
0.08026427856000001,
0.08218421356,
0.08707937656,
0.08239140355999999,
0.08558284156000001,
0.08092511856000001,
0.08231140456,
0.08495561056,
0.09469523856,
0.08630934456
]
},
{
"command": "pnpr@main",
"mean": 0.08299516556000003,
"stddev": 0.0021093201762368377,
"median": 0.08231301856,
"user": 0.016901929696969693,
"system": 0.00919274181818182,
"min": 0.08085220556,
"max": 0.08934388656,
"times": [
0.08305053456,
0.08143410556,
0.08139430556000002,
0.08149276156000002,
0.08231301856,
0.08119700556000001,
0.08162550556,
0.08198432056000002,
0.08290082756,
0.08238160656000001,
0.08383235356000002,
0.08196192056000001,
0.08274945355999999,
0.08497342356000001,
0.08257208056000001,
0.08610210656,
0.08275417956,
0.08196154756000001,
0.08095849156000001,
0.08643950556000002,
0.08171715056000001,
0.08095385256000001,
0.08696928856,
0.08085220556,
0.08183424656000002,
0.08248716655999999,
0.08744814856,
0.08934388656,
0.08162393856,
0.08480917256,
0.08200256456000002,
0.08287497956,
0.08184480856000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.559140439079999,
"stddev": 0.15776587117295407,
"median": 4.4984931355799995,
"user": 1.7729950199999998,
"system": 1.39292262,
"min": 4.39965584658,
"max": 4.84645770858,
"times": [
4.5376298215799995,
4.39965584658,
4.588230201579999,
4.4593564495799995,
4.84645770858,
4.44186316358,
4.792520801579999,
4.45207653758,
4.42708520558,
4.64652865458
]
},
{
"command": "pacquet@main",
"mean": 4.500869117880001,
"stddev": 0.12869133674825556,
"median": 4.44325256608,
"user": 1.7851472199999996,
"system": 1.3995057199999998,
"min": 4.4212629325799995,
"max": 4.78649485358,
"times": [
4.4212629325799995,
4.69162602558,
4.42527705658,
4.42731426758,
4.4775678035799995,
4.436309748579999,
4.45019538358,
4.432326949579999,
4.78649485358,
4.460316157579999
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5530338071800003,
"stddev": 0.15061625726386452,
"median": 3.49349520358,
"user": 1.2936174200000001,
"system": 1.22209272,
"min": 3.44090157858,
"max": 3.84523359958,
"times": [
3.44090157858,
3.4575438105800003,
3.4466220125800002,
3.4694583955800002,
3.51753201158,
3.45259879858,
3.55458630158,
3.81200944758,
3.84523359958,
3.5338521155800002
]
},
{
"command": "pnpr@main",
"mean": 3.568696003179999,
"stddev": 0.1405169948957502,
"median": 3.53379562808,
"user": 1.2690392199999998,
"system": 1.25696372,
"min": 3.43863595358,
"max": 3.83462853858,
"times": [
3.64128233058,
3.56792016258,
3.83462853858,
3.77515386058,
3.45425427558,
3.45858025458,
3.52460466858,
3.54298658758,
3.44891339958,
3.43863595358
]
}
]
} |
|
| Branch | pr/13122 |
| 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) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,387.35 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 273.83 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 270.47 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 80.03 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,371.41 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,440.90 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 252.96 ms |
…he wanted-dep cache During a non-frozen re-install, a node reused from the prior lockfile registered its synthesized ResolveResult in the workspace-shared resolved_by_wanted cache. That result's manifest deliberately omits dependencies (a reused node's children come from the snapshot graph), so when another edge with the identical wanted key was denied reuse — by the changed-direct-dep gate in a different importer, or by subtree_fully_reusable's provisional-false cycle guard racing a concurrent check — its fresh resolve read the dependency-less result back, classified the package as a leaf, and (when that occurrence was shallow enough to win children ownership) recorded it with no children: the package's lockfile snapshot collapsed to an empty map, its peer suffix was dropped, its dependents were re-pointed at the bare instance, and none of its dependencies were linked. This is what broke the Compile & Lint job on the [email protected] bump PR (#13070): the alpha.14 per-importer freshness check regression (since fixed by #13117) pushed CI's plain install onto the re-resolution path, which then emptied the snapshots of `@yarnpkg/[email protected]` and `[email protected]`, leaving `pnpm/dist` bundling unable to resolve their dependencies. The corruption itself predates alpha.14 (reproducible on alpha.13 by forcing a re-resolution with any manifest change). Drop the cache insert: only the fresh-resolve path ever read it, and a denied edge must see the real registry manifest to walk its children. The regression test drives the deterministic cross-importer variant using new reuse-chain-* registry fixtures: an unchanged importer reuses the target at depth 2 (caching the synthesized result under the exact-pin wanted key), then a later importer whose changed direct dep overlaps the target's snapshot is denied reuse at depth 1 and must re-resolve fresh. The TypeScript CLI has no equivalent cache of synthesized reuse results, so the fix is pacquet-only.
|
Code review by qodo was updated up to the latest commit 1d1e23a |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Summary
Fixes the resolver bug behind the
TS CI / Compile & Lintfailure on the [email protected] bump PR (related to #13070, failing run).During a non-frozen re-install,
resolve_reused_noderegistered its synthesizedResolveResultin the workspace-sharedresolved_by_wantedcache. That result's manifest deliberately omitsdependencies(a reused node's children come from the snapshot graph), so when another edge with the identical wanted key was denied reuse — by the changed-direct-dep gate in a different importer, or bysubtree_fully_reusable's provisional-falseguard racing a concurrent check — its fresh resolve read the dependency-less result back, classified the package as a leaf, and (when that occurrence won children ownership) recorded it with no children. The package's lockfile snapshot collapsed to{}, its peer suffix was dropped, its dependents were re-pointed at the bare instance, and none of its dependencies were linked.On the bump PR this emptied the snapshots of
@yarnpkg/[email protected]and[email protected](the alpha.14 per-importer freshness regression — since fixed by #13117 — pushed CI's plain install onto the re-resolution path), which leftpnpm/distbundling unable to resolvetslib,@yarnpkg/fslib,chalk, and the rest of@yarnpkg/shell's deps. The corruption itself predates alpha.14: it reproduces on alpha.13 by forcing a re-resolution with any manifest change.The fix drops the cache insert — only the fresh-resolve path ever read it, and a denied edge must see the real registry manifest to walk its children. Verified end-to-end: with the fix, the forced re-resolution of the repo's own lockfile no longer produces any empty snapshot and the global-virtual-store links directory for
@yarnpkg/[email protected]contains all of its dependency links.The regression test drives the deterministic cross-importer variant using new
@pnpm.e2e/reuse-chain-*registry fixtures (an unchanged importer reuses the target at depth 2 and caches the synthesized result under the exact-pin wanted key; a later importer whose changed direct dep overlaps the target's snapshot is denied reuse at depth 1). The test fails on the previous code and passes with the fix.Note: #13070 stays red until a
next-12release carries this fix together with #13117, since its CI runs the released alpha.14 binary.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.(Pacquet-only: the TypeScript resolver has no equivalent cache of
synthesized reuse results — verified pnpm 11.14.0 keeps the snapshots
intact under the same forced re-resolution.)
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-fable-5).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit