Repository navigation
fix(deps-resolver): stop partial installs from rewriting unrelated lockfile entries - #13196
Conversation
…ckfile entries Removing one dev dependency could flip other packages' open-range deps (e.g. jest's `@types/node: '*'`) to their newest versions, as seen in #13193. Three lockfile-resolution-reuse gaps caused still-satisfied lockfile entries to be re-resolved from the registry: 1. Direct deps using the `catalog:` protocol reach record_changed_direct_deps with the protocol already resolved to the catalog's range, while the importer snapshot records the literal `catalog:` form. Every catalog-managed dep therefore looked changed on every install, and the changed-direct-dep gate declined subtree reuse for every package depending on one. The comparison now consults the lockfile's `catalogs:` snapshot, so only a real catalog range change counts as a change. 2. Auto-installed (hoisted) peers were recorded as changed direct deps on every install: they have no importer-snapshot entry to compare against, so they always counted as "new". Recording now runs only for the importer's manifest wave, never for hoist-round installs. 3. A node that resolved freshly but landed on its previously recorded version still disabled reuse for its entire subtree (ReuseSource::PriorOnly). Peer back-edge cycles (browserslist <-> update-browserslist-db, eslint <-> eslint-utils, jest-resolve <-> jest-pnp-resolver) force such fresh resolves on every install, so open-ranged deps below them re-picked the registry's newest version on every partial install. Children of a parent that landed on its prior version now re-enter the reuse gate with their recorded refs, faithful to pnpm's `parentPkg.updated ? undefined : resolvedDependencies` arm, and the PriorOnly variant is removed. The TypeScript CLI is unaffected: catalogs resolve inside its resolver chain so specifiers compare raw-to-raw, and its reuse predicate already keeps child refs alive under a non-updated parent. This change ports that behavior to pacquet.
The TypeScript CLI already preserves still-satisfied lockfile entries when an unrelated dependency is removed, but no test pinned that behavior down as a standalone regression guard, and none covered it for `catalog:` dependencies. Mirror the pacquet regression tests from the sibling commit so both stacks carry matching coverage: - install/update.ts: removing an unrelated dependency keeps an open-range subdep (`^100.0.0` with a newer version tagged latest) at its lockfile-pinned version. - catalogs.ts: the same scenario with the dependent installed through the `catalog:` protocol, guarding both the catalog-resolved direct version and its subdep pin.
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe resolver now preserves reusable dependency subtrees, records direct dependency changes before tree expansion, and recognizes unchanged catalog specifications. Workspace and installer tests cover catalog updates, cycles, and unrelated dependency removal. ChangesLockfile reuse stabilization
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Importer
participant Resolver
participant Lockfile
participant Tests
Importer->>Resolver: Compute wanted direct dependencies
Resolver->>Lockfile: Compare recorded catalog specifiers
Lockfile-->>Resolver: Preserve or mark dependency changes
Resolver->>Lockfile: Seed reusable child subtrees
Tests->>Resolver: Verify catalog, cycle, and unrelated-change reuse
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 reuse to prevent unrelated churn on partial installs
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Confidence Score: 5/5This looks safe to merge.
Reviews (2): Last reviewed commit: "test(deps-resolver): assert every node o..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs (1)
1597-1688: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider asserting the cycle-side versions too.
The test only checks
open's pinned version; assertingcyclic/loopalso land on their expected (recorded) versions would make the regression coverage more complete for the "fresh-resolve-but-conservative-cycle" branch exercised here.🤖 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/resolving-deps-resolver/src/resolve_workspace/tests.rs` around lines 1597 - 1688, Extend fresh_resolved_parent_on_recorded_version_reuses_child_subtrees to assert that both cyclic and loop resolve to their recorded 1.0.0 versions, alongside the existing open assertion. Use graph_versions_of on each cycle-side package without changing the test setup or resolution flow.
🤖 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 `@pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs`:
- Around line 1597-1688: Extend
fresh_resolved_parent_on_recorded_version_reuses_child_subtrees to assert that
both cyclic and loop resolve to their recorded 1.0.0 versions, alongside the
existing open assertion. Use graph_versions_of on each cycle-side package
without changing the test setup or resolution flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6f365949-504c-4c8b-a6b0-50cfc69629a5
📒 Files selected for processing (6)
.changeset/no-unrelated-lockfile-churn.mdpnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-deps-resolver/src/resolve_importer.rspnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rspnpm11/installing/deps-installer/test/catalogs.tspnpm11/installing/deps-installer/test/install/update.ts
Code Review by Qodo
1. Duplicate lockfile test builder
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13196 +/- ##
=======================================
Coverage 86.68% 86.68%
=======================================
Files 522 523 +1
Lines 87872 87948 +76
=======================================
+ Hits 76168 76235 +67
- Misses 11704 11713 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Extends the cycle-next-to-reusable-subtree test to pin the cycle-side and parent versions too, per review feedback on the PR.
|
Addressed CodeRabbit's nitpick in b4670c8b2c33bd137fd7f16d95232e30bfb2e6be: the cycle-adjacent reuse test now asserts every node of the graph ( Written by an agent (Claude Code, claude-fable-5). |
|
Code review by qodo was updated up to the latest commit b4670c8 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
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.6217766612400006,
"stddev": 0.18207780504352597,
"median": 2.5468582485400004,
"user": 1.9224311599999997,
"system": 1.5312628,
"min": 2.4120013995400003,
"max": 2.8671465625400003,
"times": [
2.49178042554,
2.47875001454,
2.4120013995400003,
2.8671465625400003,
2.4962547185400004,
2.4458114615400004,
2.82285257454,
2.59746177854,
2.7611218505400004,
2.8445858265400004
]
},
{
"command": "pacquet@main",
"mean": 2.61931208874,
"stddev": 0.1903818229902626,
"median": 2.57571454204,
"user": 1.94257116,
"system": 1.6246014,
"min": 2.3994549315400002,
"max": 2.92272301154,
"times": [
2.3994549315400002,
2.8961701515400002,
2.5131803075400003,
2.63493382554,
2.61094100054,
2.7859301965400003,
2.4806677985400003,
2.92272301154,
2.4086315805400003,
2.54048808354
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5677624176399998,
"stddev": 0.17561066681342133,
"median": 1.53349229204,
"user": 1.3437705599999998,
"system": 1.3538524999999997,
"min": 1.38565359954,
"max": 1.9201910385399998,
"times": [
1.4142512515399999,
1.5012969975400001,
1.58667609154,
1.56568758654,
1.5966114165399998,
1.4470317635399998,
1.38565359954,
1.44483689354,
1.8153875375400002,
1.9201910385399998
]
},
{
"command": "pnpr@main",
"mean": 1.58781837234,
"stddev": 0.16439490454394748,
"median": 1.59596219454,
"user": 1.3274252599999998,
"system": 1.3947510999999995,
"min": 1.3806018975399998,
"max": 1.8366395205400001,
"times": [
1.8366395205400001,
1.48340510754,
1.79239163754,
1.72325922254,
1.6264432125400001,
1.64614762954,
1.3806018975399998,
1.41109613654,
1.5654811765399999,
1.41271818254
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.28911720788000006,
"stddev": 0.014506470694555518,
"median": 0.28816989868,
"user": 0.24485194,
"system": 0.57384272,
"min": 0.26038010768000003,
"max": 0.30769167768,
"times": [
0.30769167768,
0.30312199968000003,
0.28020138668,
0.28787353568,
0.26038010768000003,
0.28478819668,
0.28846626168,
0.27689413968,
0.30025952168000003,
0.30149525168
]
},
{
"command": "pacquet@main",
"mean": 0.30706212188,
"stddev": 0.024578140748716965,
"median": 0.30355783218,
"user": 0.25462964,
"system": 0.60208802,
"min": 0.26500827568,
"max": 0.36042608468000004,
"times": [
0.32273576868000003,
0.29502227668000003,
0.29799685568,
0.26500827568,
0.30584488468,
0.30127077968,
0.31626721968,
0.36042608468000004,
0.29314103868,
0.31290803468
]
},
{
"command": "pnpr@HEAD",
"mean": 0.33824129138000003,
"stddev": 0.03180237973012418,
"median": 0.32614673018,
"user": 0.28774004,
"system": 0.64213352,
"min": 0.30570950968,
"max": 0.39099372968,
"times": [
0.38761867468,
0.30570950968,
0.31053691368,
0.32897551368,
0.32331794668,
0.31196886368,
0.39099372968,
0.35048918568000004,
0.31518639168,
0.35761618468
]
},
{
"command": "pnpr@main",
"mean": 0.33818417738,
"stddev": 0.018815491661458968,
"median": 0.34251105468,
"user": 0.2895504400000001,
"system": 0.62182792,
"min": 0.30240998668,
"max": 0.36662242968000003,
"times": [
0.36662242968000003,
0.35847993368000003,
0.34527671568,
0.34274662368000003,
0.34227548568,
0.34406461968,
0.32657684168,
0.30240998668,
0.31762348768000004,
0.33576564968
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.9911373443800002,
"stddev": 0.03885711565249335,
"median": 2.98464005548,
"user": 2.27921232,
"system": 1.6631873799999997,
"min": 2.94220974298,
"max": 3.0580863039799997,
"times": [
3.0580863039799997,
3.00145802498,
3.02136274098,
3.03662636398,
2.95527388998,
2.96779288898,
3.00291920598,
2.96782208598,
2.94220974298,
2.95782219598
]
},
{
"command": "pacquet@main",
"mean": 2.9183421045799998,
"stddev": 0.07217446963039852,
"median": 2.92063998298,
"user": 2.07786542,
"system": 1.5248366799999997,
"min": 2.80640894598,
"max": 3.05452051998,
"times": [
2.92241768698,
2.92705967298,
2.91886227898,
2.96114133898,
2.88215819198,
2.98540390198,
3.05452051998,
2.80640894598,
2.83197615198,
2.89347235598
]
},
{
"command": "pnpr@HEAD",
"mean": 1.68658881868,
"stddev": 0.15301459733446557,
"median": 1.7115563339800002,
"user": 1.1289029200000003,
"system": 1.24435328,
"min": 1.4400510339800001,
"max": 1.8718073019800001,
"times": [
1.7550938969800003,
1.45738055798,
1.4400510339800001,
1.66801877098,
1.8012852989800001,
1.6097814519800002,
1.8718073019800001,
1.8656955429800002,
1.64073327098,
1.75604105998
]
},
{
"command": "pnpr@main",
"mean": 1.66070557928,
"stddev": 0.181331916802165,
"median": 1.6496976979800002,
"user": 1.0985333200000003,
"system": 1.20960418,
"min": 1.4478775359800002,
"max": 1.8974441449800001,
"times": [
1.84582785598,
1.74143503998,
1.4528262329800001,
1.55352661898,
1.5579603559800002,
1.4478775359800002,
1.7539307519800003,
1.4790555929800002,
1.8771716629800002,
1.8974441449800001
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.61056615362,
"stddev": 0.02051216279930001,
"median": 0.60806572652,
"user": 0.76318086,
"system": 0.67875028,
"min": 0.58089859952,
"max": 0.65258685852,
"times": [
0.60453661352,
0.59745819252,
0.60697017152,
0.59076993552,
0.6317022775200001,
0.61228315552,
0.58089859952,
0.60916128152,
0.61929445052,
0.65258685852
]
},
{
"command": "pacquet@main",
"mean": 0.6393495541199999,
"stddev": 0.03552585565401909,
"median": 0.64538138852,
"user": 0.7734044599999998,
"system": 0.7204910800000001,
"min": 0.57988058752,
"max": 0.7001830075200001,
"times": [
0.64375694052,
0.58750143452,
0.57988058752,
0.62083155152,
0.66136480852,
0.65947562252,
0.7001830075200001,
0.6448769185200001,
0.64973881152,
0.64588585852
]
},
{
"command": "pnpr@HEAD",
"mean": 0.31319565652000003,
"stddev": 0.012889915982305116,
"median": 0.31298917952000005,
"user": 0.21682165999999997,
"system": 0.54430888,
"min": 0.29003494652,
"max": 0.33580469252,
"times": [
0.31588325852,
0.30376798952,
0.32742159052,
0.31990562052,
0.30946326252,
0.30369684552000004,
0.31307297752,
0.29003494652,
0.33580469252,
0.31290538152
]
},
{
"command": "pnpr@main",
"mean": 0.30852784361999996,
"stddev": 0.007718513434629981,
"median": 0.31095247052,
"user": 0.19991776,
"system": 0.54593498,
"min": 0.29714482152,
"max": 0.32055145652,
"times": [
0.31467547452,
0.31203441252,
0.32055145652,
0.29790488152,
0.30438496052,
0.30987052852,
0.30241180652,
0.31315873852000004,
0.29714482152,
0.31314135552
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.91965869184,
"stddev": 0.016067332390588183,
"median": 1.92014312304,
"user": 0.95756214,
"system": 0.7510335199999998,
"min": 1.88885234054,
"max": 1.9533174015399999,
"times": [
1.9533174015399999,
1.88885234054,
1.92016107154,
1.92619353854,
1.90973550454,
1.91359818654,
1.92122462354,
1.92012517454,
1.91657006054,
1.92680901654
]
},
{
"command": "pacquet@main",
"mean": 1.9160548024400001,
"stddev": 0.023339291691916727,
"median": 1.9179145070399999,
"user": 0.99121034,
"system": 0.7281534199999998,
"min": 1.8836886415399998,
"max": 1.94918357154,
"times": [
1.9213472755399998,
1.8836886415399998,
1.93895176154,
1.89349664354,
1.91448173854,
1.88857095354,
1.92742556254,
1.94918357154,
1.94100610854,
1.90239576754
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30433289154,
"stddev": 0.013224350201661643,
"median": 0.30188505854000003,
"user": 0.20086573999999996,
"system": 0.5306711199999999,
"min": 0.28613181354,
"max": 0.32990249954,
"times": [
0.32990249954,
0.30007558254,
0.29803428054,
0.29131923954,
0.31065226254,
0.30369453454,
0.28613181354,
0.29444490254,
0.31730788154,
0.31176591854
]
},
{
"command": "pnpr@main",
"mean": 0.30127562954,
"stddev": 0.007890111098577167,
"median": 0.30104756254,
"user": 0.18767753999999998,
"system": 0.53112872,
"min": 0.28965732154,
"max": 0.31304591853999997,
"times": [
0.28981273354,
0.28965732154,
0.30152394954,
0.29793840854,
0.31304591853999997,
0.30057117554,
0.29801276954,
0.31103962154,
0.30499489254,
0.30615950454
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.41122005364000014,
"stddev": 0.016750407761222382,
"median": 0.41617742314000006,
"user": 0.39104281999999996,
"system": 0.07559626,
"min": 0.38361199114,
"max": 0.43492688814,
"times": [
0.42161011014,
0.39760320914,
0.41776717614000003,
0.42640964514,
0.43492688814,
0.39905675514,
0.39318371014000003,
0.38361199114,
0.42344338114,
0.41458767014000003
]
},
{
"command": "pacquet@main",
"mean": 0.37315050844000003,
"stddev": 0.015242747700968177,
"median": 0.36855408064000006,
"user": 0.36481292,
"system": 0.059276459999999996,
"min": 0.35869454614,
"max": 0.40459007114,
"times": [
0.37625048414,
0.36908138814,
0.36618963514,
0.36021236314,
0.36802677314000004,
0.36120776714,
0.35869454614,
0.37215259014,
0.40459007114,
0.39509946614
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09075004372064517,
"stddev": 0.002708908017344329,
"median": 0.09136327314,
"user": 0.022112139354838706,
"system": 0.010769479999999996,
"min": 0.08546982914000001,
"max": 0.09682767014000002,
"times": [
0.09136327314,
0.09172249014000002,
0.09180776014000001,
0.09125559114000001,
0.09601324714000001,
0.09410171914000001,
0.08939183314000002,
0.08546982914000001,
0.08710063014000001,
0.08770779314000002,
0.08555347714000001,
0.08759952914000001,
0.09243329814000001,
0.09160810514,
0.09190129714,
0.08971320814000001,
0.09337901814,
0.09279018014000001,
0.08822148014000002,
0.08796868314000002,
0.09161001814000001,
0.09175528114,
0.09169824414000001,
0.09126770414000002,
0.09262097114000001,
0.09682767014000002,
0.09094732114000001,
0.08967301214000001,
0.09197192014000001,
0.09049052114000002,
0.08728624914000001
]
},
{
"command": "pnpr@main",
"mean": 0.08930877401500001,
"stddev": 0.0028364657240389935,
"median": 0.08832386564,
"user": 0.021690657500000002,
"system": 0.010730039375000004,
"min": 0.08592140014,
"max": 0.09754914314000002,
"times": [
0.08799937214,
0.08638761714000001,
0.08706936014000001,
0.08592140014,
0.08623994014000001,
0.08831483514,
0.09074006114000001,
0.08695145914,
0.08722898114000001,
0.09000677014000001,
0.09189797114,
0.08676002914000001,
0.08704697914000001,
0.08787071914000001,
0.09258464314,
0.09029954114000001,
0.08944337014,
0.08717239514000001,
0.08742781614000002,
0.09438578814000001,
0.08978906714000001,
0.09754914314000002,
0.08869316414000002,
0.08614848414000001,
0.08699390514000001,
0.09200387614000001,
0.09267055114000002,
0.09346317314000001,
0.08833289614,
0.09268784214000002,
0.08975692714000001,
0.08804269014
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.475063971179999,
"stddev": 0.06464412623516207,
"median": 4.4407731646799995,
"user": 1.77762332,
"system": 1.3739571800000001,
"min": 4.4156629256799995,
"max": 4.59926851168,
"times": [
4.59926851168,
4.4229426176799995,
4.4156629256799995,
4.517899562679999,
4.42779843668,
4.4495989826799995,
4.49424644168,
4.5594612226799995,
4.4319473466799995,
4.43181366368
]
},
{
"command": "pacquet@main",
"mean": 4.58101768748,
"stddev": 0.15036142937527638,
"median": 4.57493035868,
"user": 1.75788802,
"system": 1.40975648,
"min": 4.42223725868,
"max": 4.83859995368,
"times": [
4.61102323968,
4.43661961968,
4.83859995368,
4.4364190706799995,
4.62616410768,
4.77118022368,
4.44468214468,
4.68441377868,
4.53883747768,
4.42223725868
]
},
{
"command": "pnpr@HEAD",
"mean": 3.51020410948,
"stddev": 0.0596477399993171,
"median": 3.49667539118,
"user": 1.2965742199999997,
"system": 1.27742288,
"min": 3.44750998768,
"max": 3.6433261166800004,
"times": [
3.54625333368,
3.53988650568,
3.4527029326800003,
3.46105184668,
3.44750998768,
3.4801458546800004,
3.51140444868,
3.4819463336800003,
3.6433261166800004,
3.5378137346800003
]
},
{
"command": "pnpr@main",
"mean": 3.6240627288800007,
"stddev": 0.10359414350731812,
"median": 3.6285699421800004,
"user": 1.31272982,
"system": 1.3406426799999998,
"min": 3.4999045836800002,
"max": 3.8271416356800003,
"times": [
3.63310910668,
3.67699262168,
3.4999045836800002,
3.72832148168,
3.63196263268,
3.5175857656800003,
3.8271416356800003,
3.50623604368,
3.59419616568,
3.6251772516800003
]
}
]
} |
|
| Branch | pr/13196 |
| 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,440.05 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 286.13 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 290.03 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.47 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,385.65 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,447.51 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 305.71 ms |
Summary
Fixes the unrelated lockfile churn seen in #13193: removing one dev dependency (
concurrently) rewrote the whole jest cluster's@types/node: '*'deps from 22.20.1 to 26.1.1 and minted a newjest-configpeer-suffix snapshot. Any partial install could drift open-range deps of unrelated, still-satisfied lockfile entries to their newest registry versions.The churn is produced by pacquet (this repo's installs run the pinned
pnpm@12Rust CLI). Three gaps in pacquet's lockfile-resolution reuse compounded:catalog:deps always counted as changed.record_changed_direct_depscompared the catalog-resolved manifest range (^22.19.19) against the importer snapshot's literalcatalog:specifier, so every catalog-managed dep of every importer was marked as a changed direct dep on every install, and the changed-direct-dep gate declined subtree reuse for every package depending on one. The comparison now consults the lockfile'scatalogs:snapshot; a real catalog range bump still counts as changed (covered by a test).ReuseSource::PriorOnlydisabled reuse for every descendant of a freshly-resolved parent. Peer back-edge cycles (browserslist ↔ update-browserslist-db,eslint ↔ eslint-utils,jest-resolve ↔ jest-pnp-resolver) legitimately force fresh resolves via the conservative cycle guard, so*-ranged deps beneath them re-picked latest on every partial install. Children of a parent that landed back on its recorded version now re-enter the reuse gate with their prior refs — faithful to the TypeScript CLI'sparentPkg.updated ? undefined : resolvedDependenciesarm — andPriorOnlyis removed.With the fix, re-running the PR-13193 manifest change produces exactly the intended 29-line removal — zero unrelated lines (previously 51 insertions / 48 deletions of churn).
TypeScript CLI status: not affected, verified empirically with both the published 11.15.1 and a bundle built from this repo's
pnpm11/main — neither produces any drift on the same repro. TS avoids all three gaps by construction: catalogs resolve inside the resolver chain (specifiers compare raw-to-raw), auto-installed peers don't feed a changed-set, and its reuse predicate already keeps child refs alive under a non-updated parent. This PR ports that behavior to pacquet, so there is no TS-side code change — but since TS had no standalone regression test for "an unrelated removal leaves still-satisfied open-range entries untouched" (and none for thecatalog:variant), the second commit adds mirroring tests toinstalling/deps-installer/test/install/update.tsandtest/catalogs.tsso both stacks carry matching coverage.Known follow-ups (out of scope): the repo's
pnpm-lock.yamlonmainstill carries the historical drift (~64@types/[email protected]refs) — it only converges via a deliberate full re-resolution; hoisted-peer subtrees still fresh-resolve every install (perf, not correctness); and TS omits([email protected])from@pnpm/worker-consumer peer suffixes where pacquet keeps it — a separate parity gap.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting. (The bug ispacquet-only; the fix ports the TypeScript CLI's existing behavior, so there
is no TS code change. Matching regression tests are added on both sides.)
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
Bug Fixes
pnpm install/updates from rewriting unrelatedpnpm-lock.yamlentries after small manifest changes.Tests
catalog:dependencies and for removing unrelated workspace dependencies without triggering re-resolution.