Repository navigation
fix(deps-resolver): record an injected workspace dependency as it resolves - #17075
Conversation
…olves A plain install kept a workspace dependency's previously recorded `link:` whenever the run did not target it, even when the injected copy now binds a peer the linked project does not provide. The guard was added for #10433, whose flips came from two spurious mismatches: a same-version peer-suffix decoration, which the dedupe pass now absorbs (#12800), and re-resolution paths the dedupe pass did not reach. With the guard off, the update scenario from #10433 keeps its `link:` in both stacks, so dedupe alone now covers it. The guard's only remaining effect was that an incremental install recorded a stale `link:` that a fresh install does not, which left the injected package unable to find the peer its consumer provides. The guard and the inputs only it consumed are removed in both stacks: v12's `preserved_link_version`, `LockfileImporterReuse` and the install path's `guard_*` fields, and v11's preserve-prior-link branch with its previous-ref and targeted-alias bookkeeping. The importer entry now follows the dedupe pass, which the workspaces docs already describe. The v11 ancestor-divergence test now expects the injected copy, a new v12 CLI test checks that an incremental install records the copy a fresh one does, and the peer convergence harness drops this divergence. The two rows still differing there come from #17058's moved auto-installed peer, whose divergence now owns the injected entries that follow from it. Closes #17057 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
|
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17075 +/- ##
=========================================
Coverage 92.56% 92.57%
=========================================
Files 1788 1803 +15
Lines 229505 230903 +1398
=========================================
+ Hits 212447 213762 +1315
- Misses 17058 17141 +83 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.36230935788,
"stddev": 0.0933952581400964,
"median": 2.33320982798,
"user": 1.41272974,
"system": 1.3612978200000003,
"min": 2.29440437548,
"max": 2.61164727548
},
{
"command": "pacquet@main",
"mean": 2.44040931258,
"stddev": 0.12437629531157368,
"median": 2.41368125048,
"user": 1.42557924,
"system": 1.44091712,
"min": 2.30480316948,
"max": 2.66669365048
},
{
"command": "pnpr@HEAD",
"mean": 1.4674202967800003,
"stddev": 0.12073134790465345,
"median": 1.4349653104800002,
"user": 1.3896544399999997,
"system": 1.3569854200000002,
"min": 1.34148912248,
"max": 1.73268292248
},
{
"command": "pnpr@main",
"mean": 1.4333741678800003,
"stddev": 0.1200424655162851,
"median": 1.39351704148,
"user": 1.23891574,
"system": 1.28171162,
"min": 1.3073990964800002,
"max": 1.67759284648
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.30103832406,
"stddev": 0.010204027808915977,
"median": 0.29953090016000006,
"user": 0.34953819999999997,
"system": 0.7602505599999999,
"min": 0.28505564016000007,
"max": 0.32451062716000006
},
{
"command": "pacquet@main",
"mean": 0.4285568354600001,
"stddev": 0.11400367421743818,
"median": 0.46625322816000003,
"user": 0.524478,
"system": 1.09326646,
"min": 0.29803007916,
"max": 0.55501080116
},
{
"command": "pnpr@HEAD",
"mean": 0.31682900496000005,
"stddev": 0.011399954094674985,
"median": 0.31572165366000005,
"user": 0.3599358,
"system": 0.7776341600000001,
"min": 0.30337205116000004,
"max": 0.33550840016000005
},
{
"command": "pnpr@main",
"mean": 0.31210933986,
"stddev": 0.008641705715586243,
"median": 0.31089690216000004,
"user": 0.36305579999999993,
"system": 0.74508966,
"min": 0.29712338816000006,
"max": 0.32996270916000003
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.008301540917592592,
"stddev": 0.0011170305674949178,
"median": 0.0080049017,
"user": 0.0048987738888888865,
"system": 0.004200951388888891,
"min": 0.0069093672000000005,
"max": 0.0135000402
},
{
"command": "pacquet@main",
"mean": 0.007743918510650891,
"stddev": 0.0005068234287616744,
"median": 0.0076885777,
"user": 0.004590292544378697,
"system": 0.003930873372781066,
"min": 0.0066289612,
"max": 0.010942841200000001
},
{
"command": "pnpr@HEAD",
"mean": 0.008627671354098362,
"stddev": 0.0010352210625300389,
"median": 0.0082986602,
"user": 0.004925192786885241,
"system": 0.004486341639344266,
"min": 0.006680406200000001,
"max": 0.0136362062
},
{
"command": "pnpr@main",
"mean": 0.008271266212738855,
"stddev": 0.000531345180564437,
"median": 0.0081941132,
"user": 0.005053081656050954,
"system": 0.004077763057324843,
"min": 0.007258234200000001,
"max": 0.0109086882
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.009713726304489792,
"stddev": 0.001106529104664491,
"median": 0.00946983208,
"user": 0.005647735918367347,
"system": 0.004879280816326531,
"min": 0.008171438080000001,
"max": 0.014897939080000002
},
{
"command": "pacquet@main",
"mean": 0.014048620060694987,
"stddev": 0.002758743488454596,
"median": 0.014344381080000001,
"user": 0.007511932277992276,
"system": 0.00761135907335907,
"min": 0.00805579208,
"max": 0.022295447080000003
},
{
"command": "pnpr@HEAD",
"mean": 0.013635816523661968,
"stddev": 0.002319441454131725,
"median": 0.01400587658,
"user": 0.00792017943661972,
"system": 0.006845328169014086,
"min": 0.008926995080000001,
"max": 0.018791969080000002
},
{
"command": "pnpr@main",
"mean": 0.009716432348000004,
"stddev": 0.0010936599957002064,
"median": 0.00947137458,
"user": 0.005853139999999995,
"system": 0.004700348000000001,
"min": 0.007991531080000001,
"max": 0.013199524080000002
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5562800447800003,
"stddev": 0.11930944814864977,
"median": 2.51755056198,
"user": 2.02353238,
"system": 1.6793738999999994,
"min": 2.47507820298,
"max": 2.8623857679799998
},
{
"command": "pacquet@main",
"mean": 2.51359140278,
"stddev": 0.028940527975973396,
"median": 2.50897747548,
"user": 1.87031408,
"system": 1.5500079999999998,
"min": 2.48505003398,
"max": 2.5850385549799997
},
{
"command": "pnpr@HEAD",
"mean": 1.56644862398,
"stddev": 0.12560497795441972,
"median": 1.56315797048,
"user": 1.28622758,
"system": 1.2781723,
"min": 1.4008798119800001,
"max": 1.72565178498
},
{
"command": "pnpr@main",
"mean": 1.51612014408,
"stddev": 0.10717292071930709,
"median": 1.46395619648,
"user": 1.17944568,
"system": 1.2720119,
"min": 1.41590894698,
"max": 1.70216988898
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.45907068966000003,
"stddev": 0.023036471238501142,
"median": 0.45806590556000004,
"user": 0.64855084,
"system": 0.75308334,
"min": 0.43167774606000003,
"max": 0.5058452080600001
},
{
"command": "pacquet@main",
"mean": 0.6075704441600001,
"stddev": 0.14238545305757178,
"median": 0.6068612805600001,
"user": 0.8849609399999998,
"system": 0.9907754399999998,
"min": 0.44202022306000005,
"max": 0.8743733820600001
},
{
"command": "pnpr@HEAD",
"mean": 0.30348213185999995,
"stddev": 0.019108944003358205,
"median": 0.31148722556,
"user": 0.27266844,
"system": 0.5717121399999999,
"min": 0.27328742606,
"max": 0.32576309906
},
{
"command": "pnpr@main",
"mean": 0.31368689806,
"stddev": 0.03960716581734326,
"median": 0.30286080156000006,
"user": 0.28784434,
"system": 0.5785489399999999,
"min": 0.28325819406,
"max": 0.41980538906000003
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.6936818179000004,
"stddev": 0.08501939016281371,
"median": 1.6667698887,
"user": 1.10005436,
"system": 1.0973047599999999,
"min": 1.6195295867000001,
"max": 1.9089428807000002
},
{
"command": "pacquet@main",
"mean": 1.6504295719000002,
"stddev": 0.0214532272222284,
"median": 1.6581403772,
"user": 0.9427601600000001,
"system": 0.9935954599999999,
"min": 1.6134366437,
"max": 1.6741027097
},
{
"command": "pnpr@HEAD",
"mean": 0.3228498994000001,
"stddev": 0.01070934265577488,
"median": 0.3257111502,
"user": 0.26929746,
"system": 0.64794956,
"min": 0.30121247970000004,
"max": 0.33673951370000005
},
{
"command": "pnpr@main",
"mean": 0.3304424316000001,
"stddev": 0.007623326462030638,
"median": 0.33206668070000006,
"user": 0.28426725999999997,
"system": 0.64540676,
"min": 0.31960133770000004,
"max": 0.3399729477
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25072425218,
"stddev": 0.05973084947768006,
"median": 0.23400294248,
"user": 0.22684410000000002,
"system": 0.09404471999999998,
"min": 0.19510960498000002,
"max": 0.39997493898
},
{
"command": "pacquet@main",
"mean": 0.2721511396466667,
"stddev": 0.04225035053305688,
"median": 0.28812524898,
"user": 0.2515163666666667,
"system": 0.10572395333333334,
"min": 0.18573820698000001,
"max": 0.33006556298000006
},
{
"command": "pnpr@HEAD",
"mean": 0.09156671749612902,
"stddev": 0.0018611528650539666,
"median": 0.09184561998000002,
"user": 0.03282746774193548,
"system": 0.015757490967741934,
"min": 0.08698210198000002,
"max": 0.09380192798
},
{
"command": "pnpr@main",
"mean": 0.09179835724666668,
"stddev": 0.0019597538345757282,
"median": 0.09203924698000002,
"user": 0.03372666666666667,
"system": 0.014667865999999998,
"min": 0.08688661298000001,
"max": 0.09541905898000001
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2169513106422222,
"stddev": 0.009476326321347185,
"median": 0.22015228442,
"user": 0.21371842000000002,
"system": 0.055056615555555556,
"min": 0.20302457542,
"max": 0.22878159142
},
{
"command": "pacquet@main",
"mean": 0.22021408541999998,
"stddev": 0.008615944827312575,
"median": 0.21793330142,
"user": 0.2219736422222222,
"system": 0.04810850444444444,
"min": 0.21141375142,
"max": 0.23452074742
},
{
"command": "pnpm@HEAD",
"mean": 3.482422074308889,
"stddev": 0.06675173167818989,
"median": 3.5024370174199997,
"user": 5.314214086666667,
"system": 0.38132772666666664,
"min": 3.31839466242,
"max": 3.54245666642
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24025665014333333,
"stddev": 0.009291372488950555,
"median": 0.24034375006000003,
"user": 0.19738051,
"system": 0.09906276666666665,
"min": 0.22670733206000002,
"max": 0.26319804806
},
{
"command": "pacquet@main",
"mean": 0.23626958556000002,
"stddev": 0.008623863246771071,
"median": 0.23672298606000003,
"user": 0.18826876000000003,
"system": 0.10259185,
"min": 0.22621872206000002,
"max": 0.25185932706
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.0889587039618182,
"stddev": 0.021741848203620705,
"median": 0.08011941178,
"user": 0.033608807272727276,
"system": 0.062138463030303015,
"min": 0.07207370578,
"max": 0.14144185878
},
{
"command": "pacquet@main",
"mean": 0.11238584439111114,
"stddev": 0.032396638099936495,
"median": 0.11060660278000001,
"user": 0.04616596888888889,
"system": 0.07501321555555555,
"min": 0.07572509578,
"max": 0.16374642978
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.50205050614,
"stddev": 0.08820483224996246,
"median": 4.48068336464,
"user": 1.73244112,
"system": 1.9577853,
"min": 4.407186193139999,
"max": 4.63874637414
},
{
"command": "pacquet@main",
"mean": 4.55714166894,
"stddev": 0.16670933839663807,
"median": 4.487100634139999,
"user": 1.68166132,
"system": 2.0176935,
"min": 4.41566436914,
"max": 4.87036552214
},
{
"command": "pnpr@HEAD",
"mean": 3.5532362777400004,
"stddev": 0.06829916947933223,
"median": 3.54071217014,
"user": 1.60556932,
"system": 1.8009024,
"min": 3.46974343414,
"max": 3.66701218814
},
{
"command": "pnpr@main",
"mean": 3.58522800804,
"stddev": 0.10181288148482077,
"median": 3.55794473164,
"user": 1.51426432,
"system": 1.8431683999999997,
"min": 3.4731241601400002,
"max": 3.81535705914
}
]
}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.1512218182872727,
"stddev": 0.05645847644367564,
"median": 0.11274086256000002,
"user": 0.17430902,
"system": 0.14648830363636364,
"min": 0.10751805756,
"max": 0.23838868456
},
{
"command": "pacquet@main",
"mean": 0.12463034001454548,
"stddev": 0.009705218942904952,
"median": 0.11906216556000002,
"user": 0.15554165636363637,
"system": 0.11676862181818178,
"min": 0.10955207356,
"max": 0.14537786256000002
},
{
"command": "pnpr@HEAD",
"mean": 0.13764020261555557,
"stddev": 0.007822136181076382,
"median": 0.13714896706000002,
"user": 0.15491818666666668,
"system": 0.13958427333333331,
"min": 0.12605828456,
"max": 0.14729724456
},
{
"command": "pnpr@main",
"mean": 0.13631423728222222,
"stddev": 0.008504765642219907,
"median": 0.13452443506,
"user": 0.1597297422222222,
"system": 0.13420327333333332,
"min": 0.12465448556,
"max": 0.15501167556
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.20822776808,
"stddev": 0.08737803899050864,
"median": 1.17573216298,
"user": 0.7016525600000001,
"system": 0.3123582,
"min": 1.1114754839799998,
"max": 1.32771932898
},
{
"command": "pacquet@main",
"mean": 1.1491016186799998,
"stddev": 0.021600774423738648,
"median": 1.15179109248,
"user": 0.5705571599999999,
"system": 0.2643976,
"min": 1.10893809698,
"max": 1.18433283998
}
]
} |
|
@coderabbitai review |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoRecord injected workspace dependencies according to resolved peers
AI Description
Diagram
High-Level Assessment
Files changed (17)
|
Code Review by Qodo
1. Release notes mix two version targets
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Summary
Closes #17057. Bug in both v11 and v12; both are fixed here.
A plain install kept a workspace dependency's previously recorded
link:whenever the run did not target it. That held even when the injected copy now binds a peer the linked project does not provide. So after a consumer started providing that peer, the importer kept pointing at the project directory, where the peer is missing, while a fresh install records the injected copy.That guard came from #10433 (#13112, gated in #13755). The PRs describe its flips as spurious, with two causes:
What the guard does today
I disabled it in each stack and ran the #10433 scenarios:
pnpm update [email protected] --recursive(v11 test; same scenario run against v12)link:link:foothat diverges from the ancestor's (v11 test)link:file:n(@pnpm.e2e/[email protected])file:n(@pnpm.e2e/[email protected])link:Dedupe alone now keeps #10433's case linked. The guard's only remaining effect was that an incremental install disagrees with a fresh one.
Change
The guard is removed in both stacks, together with the inputs only it consumed:
preserved_link_versionandPreservedLinkLookup;LockfileImporterReuseand itsprevious_importers/ update-scope plumbing; the install path'sguard_*fields (ResolutionReuseGuardbecomesResolutionReuse).updateLockfileImporters.ts, with its previous-ref and targeted-alias bookkeeping.The importer entry now follows the dedupe pass, which is the rule
docs/workspaces.mdalready describes: symlinked "unless multiple dependency graphs are required due to mismatched peer dependencies".User-visible effect: when a consumer starts providing a peer, at a version the injected package's own workspace context lacks, the next install turns that package's
link:into the copy a fresh install writes.Tests
injected_workspace_dep_turns_into_a_copy_when_its_peer_divergeschecks that an incremental install records the same copy as a fresh one. Unit tests that asserted when the guard fires are removed.lib's auto-installedfoomoves, and the injected entries follow that pick. Its divergence entry now owns those paths.deps-resolvertests (228). Thedeps-installersuite passes (1332) except for threecatalogs.tstests. Those fail only alongside the rest of the suite, because other files set@pnpm.e2e/bar'slatestdist-tag concurrently, andcatalogs.tspasses on its own (63).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.
🤖 Generated with Claude Code
Written by an agent (Claude Code, claude-opus-5-5).
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit