Repository navigation
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 (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe resolver preserves lockfile-pinned child subtrees when fresh dependency walks compete with reused resolutions. Tests cover peer-shadowing conditions, declined re-recording, and both completion orders. A patch changeset documents the fix. ChangesLockfile-pinned child preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
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 resolver: preserve pinned children when a fresh walk reaches reused subtree
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (3): Last reviewed commit: "fix(resolver): keep the children a reuse..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In
`@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs`:
- Around line 1392-1401: In workspace_ctx.rs lines 1392-1401, check
recorded.context.pins_children_over(&context) before accepting the equal-edge
branch so pinned children remain protected and the result returns Declined. In
workspace_ctx/tests.rs lines 631-644, after recording pinned, add a fresh
[email protected] recording assertion expecting Declined, while retaining the existing
differing-edge assertion and verifying stored children remain pinned.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d826f066-af1f-4206-a356-4fc45ec9ead7
📒 Files selected for processing (4)
.changeset/pinned-children-survive-a-fresh-walk.mdpnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rspnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13839 +/- ##
==========================================
- Coverage 88.25% 88.23% -0.02%
==========================================
Files 625 627 +2
Lines 103024 103279 +255
==========================================
+ Hits 90920 91130 +210
- Misses 12104 12149 +45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Both addressed in 74e549c. Preserve the pin before accepting equal child edges — correct, and a real hole in the fix as posted. A fresh walk that lands on the same edges took the equal-edge arm, republished, and carried its unpinned context onto the record; the pin marker was gone, so the next fresh walk with different edges found nothing holding it back and overwrote the locked children. The check now runs before the equal-edge arm, with the reason recorded there. The unit test gained the case that catches it: after the pinned recording, a fresh walk with equal edges must also be declined. Putting the equal-edge arm back in front fails on that assertion — the differing-edge one alone does not, which is why the hole survived my first pass. Duplicated test narration — trimmed. The test's comment keeps only what the code cannot say (why publishing over pins is wrong, plus the issue anchor), and the helper's is down to what Re-verified after both changes: the partially stale Written by an agent (Claude Code, claude-opus-5[1m]). |
|
Code review by qodo was updated up to the latest commit 74e549c |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
`record_children` documents that "a recording the prior lockfile pinned outlives a fresh walk's different answer", and then inserts the fresh answer over it. The arm only suppressed the staleness signal, so the occurrences that realized the pinned subtree went on holding children the record no longer listed, and the lockfile took whichever answer landed last. Instrumented on a partially stale `@teambit/bit` lockfile, 22 recordings per run were replaced this way, every one of them a pinned recording overwritten by a fresh walk: `enhanced-resolve` lost its pinned `[email protected]` for `4.2.11`, `subscriptions-transport-ws` its `[email protected]` for `7.5.13`, and `@types/express-serve-static-core` moved a major version. A plain install re-resolved 24 edges nothing had asked it to. Make the rule the comment describes: a walk whose context carries no prior key publishes nothing over a pinned recording, and reads the pinned children like every occurrence that reused the subtree. The gate that decides whether to walk at all applies the same rule, so the fresh subtree is not resolved and thrown away. An update policy still re-resolves pins — that is what it is for. Related to issue #13837. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Pins ignore peer shadow — taken, in 74e549c (amended). Worth recording why it is worth taking even though the failure mode cannot fire through the path that motivated the fix: a reuse-made recording always carries an empty shadow set, and Measured before adopting: with the shadow sets required to agree, the partially stale Covered by Changeset missing pnpm bump — not applicable. 8135 tests and the pre-push gates pass. Written by an agent (Claude Code, claude-opus-5[1m]). |
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Code review by qodo was updated up to the latest commit c334e04 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.68384332096,
"stddev": 0.22478547937909682,
"median": 2.7341245805599996,
"user": 2.4785825600000004,
"system": 1.84088852,
"min": 2.3847362895599997,
"max": 3.04271223256,
"times": [
2.89316639756,
2.77901130756,
2.6914104595599997,
2.40524434656,
2.3847362895599997,
2.79966711256,
2.67116964956,
3.04271223256,
2.77683870156,
2.39447671256
]
},
{
"command": "pacquet@main",
"mean": 2.7036226806599997,
"stddev": 0.18445847783126962,
"median": 2.73444230306,
"user": 2.30535756,
"system": 1.76733302,
"min": 2.45578999356,
"max": 2.9418355795599997,
"times": [
2.45578999356,
2.56390021656,
2.86397282456,
2.66273586256,
2.88800851456,
2.9418355795599997,
2.45641927956,
2.80614874356,
2.83190721256,
2.56550857956
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5822100478599999,
"stddev": 0.11398911809739762,
"median": 1.58825682806,
"user": 1.7970310600000001,
"system": 1.59768112,
"min": 1.4492675325600002,
"max": 1.83978184756,
"times": [
1.61693224756,
1.45658584356,
1.64844814656,
1.58483330256,
1.55401076056,
1.5916803535600001,
1.4492675325600002,
1.83978184756,
1.48052162056,
1.60003882356
]
},
{
"command": "pnpr@main",
"mean": 1.5541508590600004,
"stddev": 0.14588900445151476,
"median": 1.51879714106,
"user": 1.5744306599999995,
"system": 1.43520102,
"min": 1.41874132156,
"max": 1.7999660765600003,
"times": [
1.42014334156,
1.7893583545600003,
1.48423354956,
1.7999660765600003,
1.5795611035600001,
1.41874132156,
1.62712488656,
1.4378985825600001,
1.4311206415600002,
1.55336073256
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2855266263800001,
"stddev": 0.007999343242914514,
"median": 0.28538438088000007,
"user": 0.24646999999999997,
"system": 0.5606355599999999,
"min": 0.27636911788,
"max": 0.30012616288000005,
"times": [
0.28139504888000005,
0.27826940188000004,
0.27638679188000004,
0.29081869188000004,
0.28554492888000005,
0.27636911788,
0.28522383288000003,
0.28573221388000003,
0.29540007288000003,
0.30012616288000005
]
},
{
"command": "pacquet@main",
"mean": 0.29083862408,
"stddev": 0.010694876570702174,
"median": 0.29149207438,
"user": 0.2648517,
"system": 0.55401446,
"min": 0.27683383188000005,
"max": 0.31255030088,
"times": [
0.29266766088,
0.28295718088000005,
0.27683383188000005,
0.28115817488000006,
0.29330256388000003,
0.29031648788000003,
0.29627065888000004,
0.28203628788,
0.31255030088,
0.30029309288000006
]
},
{
"command": "pnpr@HEAD",
"mean": 0.33664528248000003,
"stddev": 0.013236411295902905,
"median": 0.33516817888000006,
"user": 0.2913603,
"system": 0.6332989600000001,
"min": 0.31445411788000005,
"max": 0.35538817988000004,
"times": [
0.33319420188000004,
0.33257068088,
0.34949934188000004,
0.31445411788000005,
0.34489475088000004,
0.31820532988000005,
0.35538817988000004,
0.33517282388,
0.34790986388000006,
0.33516353388000003
]
},
{
"command": "pnpr@main",
"mean": 0.34337832388,
"stddev": 0.046160361854497026,
"median": 0.32444846538000005,
"user": 0.28230659999999996,
"system": 0.6851596600000001,
"min": 0.31084813688,
"max": 0.46624434488000005,
"times": [
0.46624434488000005,
0.35847622488,
0.34051028388000004,
0.32354889788,
0.35430821188000006,
0.32534803288,
0.32075032288000005,
0.31288294288,
0.32086583988000006,
0.31084813688
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.7959136235599997,
"stddev": 0.030709448287575464,
"median": 2.78727744926,
"user": 2.06420012,
"system": 1.63076416,
"min": 2.7625382842599997,
"max": 2.86090582826,
"times": [
2.80768271026,
2.78430970226,
2.8200539702599996,
2.76982940426,
2.77858214426,
2.86090582826,
2.7625382842599997,
2.79024519626,
2.81756973126,
2.76741926426
]
},
{
"command": "pacquet@main",
"mean": 2.7305604983599996,
"stddev": 0.02562420736394646,
"median": 2.72688945376,
"user": 1.8525150200000002,
"system": 1.4863164599999998,
"min": 2.6964950382599997,
"max": 2.76997991626,
"times": [
2.7441487302599996,
2.76997991626,
2.7029935202599997,
2.7120465932599997,
2.6964950382599997,
2.73321176326,
2.74580332226,
2.76647987126,
2.72056714426,
2.71387908426
]
},
{
"command": "pnpr@HEAD",
"mean": 1.74201084866,
"stddev": 0.13980263277255361,
"median": 1.7988041517600002,
"user": 1.3236887199999998,
"system": 1.30510456,
"min": 1.55531912126,
"max": 1.89634581626,
"times": [
1.89634581626,
1.65760371526,
1.55531912126,
1.57651633026,
1.7670763142600001,
1.83117419026,
1.83053198926,
1.85466427426,
1.88832244026,
1.56255429526
]
},
{
"command": "pnpr@main",
"mean": 1.73893178376,
"stddev": 0.15133550824775485,
"median": 1.75675926026,
"user": 1.50154992,
"system": 1.4621712600000003,
"min": 1.48892189026,
"max": 1.93302430826,
"times": [
1.6781509162600001,
1.48892189026,
1.9177646652600002,
1.76869540426,
1.51379790926,
1.74482311626,
1.69032086126,
1.93302430826,
1.80665381526,
1.8471649512600001
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5208630897,
"stddev": 0.049087618715483526,
"median": 0.5175551513000001,
"user": 0.6957120800000001,
"system": 0.83802836,
"min": 0.4653735923,
"max": 0.6045217163000001,
"times": [
0.5626004143000001,
0.5802210243000001,
0.6045217163000001,
0.5128573593000001,
0.5306019233000001,
0.5222529433,
0.49179192430000007,
0.4653735923,
0.4692842313000001,
0.4691257683000001
]
},
{
"command": "pacquet@main",
"mean": 0.4506760811,
"stddev": 0.01899077335981581,
"median": 0.44851039930000003,
"user": 0.57350308,
"system": 0.72288486,
"min": 0.42966813630000006,
"max": 0.48345300830000004,
"times": [
0.45287367030000003,
0.44476440530000005,
0.45225639330000006,
0.43186747230000005,
0.47988421430000006,
0.42966813630000006,
0.48345300830000004,
0.43149507530000003,
0.45775773430000005,
0.44274070130000004
]
},
{
"command": "pnpr@HEAD",
"mean": 0.31054941020000004,
"stddev": 0.01633084111578699,
"median": 0.3066665478,
"user": 0.21661397999999998,
"system": 0.51407336,
"min": 0.29139662930000004,
"max": 0.33678237930000005,
"times": [
0.2942756483,
0.2938870733,
0.33678237930000005,
0.29139662930000004,
0.32934974730000005,
0.32606608630000006,
0.30076708630000004,
0.30695050130000007,
0.31963635630000004,
0.30638259430000003
]
},
{
"command": "pnpr@main",
"mean": 0.3293754004000001,
"stddev": 0.012276201575602986,
"median": 0.33214965180000006,
"user": 0.22745727999999996,
"system": 0.5759258600000001,
"min": 0.31010058730000006,
"max": 0.34534100230000003,
"times": [
0.33645409130000004,
0.34534100230000003,
0.33511381730000006,
0.32519008230000007,
0.31010058730000006,
0.3202107813,
0.32918548630000005,
0.3374882303,
0.31198566330000005,
0.34268426230000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.96465824874,
"stddev": 0.04830165049151708,
"median": 1.96915151464,
"user": 1.02217612,
"system": 0.9519992799999999,
"min": 1.88400144614,
"max": 2.04131063214,
"times": [
1.91417807014,
2.01892746814,
2.04131063214,
1.92944953914,
1.99088728914,
1.9752418621399999,
1.96306116714,
1.94151665114,
1.88400144614,
1.98800836214
]
},
{
"command": "pacquet@main",
"mean": 1.92219048764,
"stddev": 0.04191118825314634,
"median": 1.92735373164,
"user": 0.9019591199999999,
"system": 0.9234756799999998,
"min": 1.86424041414,
"max": 1.98854161814,
"times": [
1.93957013414,
1.88566343814,
1.90891408014,
1.86424041414,
1.8644030331399999,
1.91955393814,
1.93515352514,
1.94881197014,
1.9670527251399998,
1.98854161814
]
},
{
"command": "pnpr@HEAD",
"mean": 0.33847922034,
"stddev": 0.020446898872350912,
"median": 0.34248848714,
"user": 0.24791742,
"system": 0.56900118,
"min": 0.30658081914,
"max": 0.36687144314,
"times": [
0.36687144314,
0.35473816514,
0.34188601514,
0.35095274814,
0.34309095914,
0.35561846414,
0.33676090914,
0.31578246214,
0.30658081914,
0.31251021814
]
},
{
"command": "pnpr@main",
"mean": 0.33266558234000004,
"stddev": 0.010548137881300091,
"median": 0.33344300814,
"user": 0.23904152,
"system": 0.5683516799999999,
"min": 0.31826529414,
"max": 0.35133321314,
"times": [
0.34488975114,
0.33264341714,
0.33556800714,
0.32411939814,
0.33544005414,
0.33175804614,
0.35133321314,
0.33424259914,
0.31826529414,
0.31839604314
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2608549254,
"stddev": 0.03383144321827674,
"median": 0.24589172990000002,
"user": 0.20887403999999998,
"system": 0.09089598,
"min": 0.2196767329,
"max": 0.3055970369,
"times": [
0.27782352590000003,
0.30281603790000006,
0.30441946890000005,
0.3055970369,
0.2421552969,
0.2420219779,
0.2431520489,
0.24863141090000002,
0.2196767329,
0.2222557169
]
},
{
"command": "pacquet@main",
"mean": 0.24330668223333332,
"stddev": 0.017523152289407328,
"median": 0.24043560790000001,
"user": 0.19387835666666667,
"system": 0.07429036333333332,
"min": 0.2241177039,
"max": 0.28708415890000005,
"times": [
0.2371252929,
0.2656825359,
0.2419329829,
0.2265621419,
0.2326311439,
0.2319074679,
0.2462010049,
0.2389382329,
0.2435622569,
0.2241177039,
0.2439352639,
0.28708415890000005
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10248089862413792,
"stddev": 0.005925747050895344,
"median": 0.10143699390000001,
"user": 0.02866100896551724,
"system": 0.016151711034482756,
"min": 0.0946041229,
"max": 0.11534151090000001,
"times": [
0.0957209259,
0.1107770339,
0.1017673629,
0.10638678890000001,
0.10085150590000001,
0.09821334590000001,
0.0970247089,
0.0976538289,
0.09498572190000001,
0.09591087590000001,
0.1056036369,
0.09688186890000001,
0.0967408579,
0.09676850290000001,
0.11061950290000001,
0.11534151090000001,
0.11132919790000001,
0.10143699390000001,
0.1053984879,
0.10483938690000001,
0.11419616190000001,
0.1026885349,
0.1074588669,
0.10464003190000001,
0.10117863590000001,
0.10363418890000001,
0.0996608729,
0.09963259790000001,
0.0946041229
]
},
{
"command": "pnpr@main",
"mean": 0.1064421824862069,
"stddev": 0.007091316350844333,
"median": 0.10589932390000001,
"user": 0.02877414689655173,
"system": 0.01936243517241379,
"min": 0.0949638019,
"max": 0.12097086990000001,
"times": [
0.09826813290000001,
0.09638367490000001,
0.0949638019,
0.0979948419,
0.1017033209,
0.09900716890000001,
0.1000189199,
0.1065163989,
0.09836879590000001,
0.1050945729,
0.11018273690000001,
0.1104095469,
0.1094638579,
0.09886805890000001,
0.1054718909,
0.10478201790000001,
0.1038575399,
0.1014946599,
0.10918157190000001,
0.1089728679,
0.11811830390000001,
0.1139418969,
0.11314816590000001,
0.11711639790000002,
0.12097086990000001,
0.1165935899,
0.10589932390000001,
0.10732330790000001,
0.1127070579
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.8060777783466667,
"stddev": 0.06876718733208399,
"median": 0.77761491668,
"user": 0.8079054777777777,
"system": 0.18279393333333332,
"min": 0.74686796268,
"max": 0.9559798256800001,
"times": [
0.74686796268,
0.9559798256800001,
0.74893443268,
0.75852539768,
0.77761491668,
0.78696736168,
0.84770294968,
0.77592029568,
0.85618686268
]
},
{
"command": "pacquet@main",
"mean": 0.7132228009022222,
"stddev": 0.13688698429490076,
"median": 0.6914286456800001,
"user": 0.7113394777777776,
"system": 0.15098237777777776,
"min": 0.44254698968,
"max": 0.85577266068,
"times": [
0.80122409268,
0.67275963968,
0.6914286456800001,
0.85577266068,
0.85231500768,
0.8321986826800001,
0.44254698968,
0.6148730476800001,
0.65588644168
]
},
{
"command": "pnpm@HEAD",
"mean": 3.7445045749022228,
"stddev": 0.2701644358903244,
"median": 3.77496378768,
"user": 5.4460106999999995,
"system": 0.38991504444444447,
"min": 3.39396635468,
"max": 4.06105537468,
"times": [
4.06105537468,
3.9784314646800003,
4.017034997680001,
3.96179605968,
3.39396635468,
3.42306116268,
3.77496378768,
3.52445604068,
3.5657759316799997
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.65656159666,
"stddev": 0.14731939315171522,
"median": 4.60764974986,
"user": 2.7739945599999993,
"system": 1.95575722,
"min": 4.51972572786,
"max": 4.97906927186,
"times": [
4.60787277586,
4.64279905086,
4.59725480786,
4.607426723860001,
4.61356350786,
4.57246555386,
4.97906927186,
4.51972572786,
4.86903927786,
4.55639926886
]
},
{
"command": "pacquet@main",
"mean": 4.7573714778600005,
"stddev": 0.20578109868929684,
"median": 4.69032572886,
"user": 2.785498059999999,
"system": 2.07138942,
"min": 4.54270054186,
"max": 5.12367413886,
"times": [
4.9359356968600006,
5.12367413886,
4.71132384886,
4.63193879786,
4.61052557186,
5.04097940986,
4.669327608860001,
4.753277074860001,
4.54270054186,
4.5540320888600005
]
},
{
"command": "pnpr@HEAD",
"mean": 3.7004704628600003,
"stddev": 0.1440615244228845,
"median": 3.63356451736,
"user": 1.93280016,
"system": 1.72869772,
"min": 3.56306918886,
"max": 3.9526559908600003,
"times": [
3.63418827886,
3.8076438388600002,
3.9526559908600003,
3.58927044686,
3.63003718586,
3.56306918886,
3.9338500938600003,
3.59668735786,
3.63294075586,
3.66436149086
]
},
{
"command": "pnpr@main",
"mean": 3.5791154601599997,
"stddev": 0.07966696434009986,
"median": 3.53762988336,
"user": 1.6562036599999999,
"system": 1.4979694199999998,
"min": 3.51588927886,
"max": 3.74982144886,
"times": [
3.6771577948600003,
3.53896122186,
3.51906618286,
3.52738536486,
3.53629854486,
3.56576748786,
3.5331702488600003,
3.62763702786,
3.74982144886,
3.51588927886
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13839 |
| 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,555.32 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 306.58 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 291.40 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 94.60 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,449.27 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,563.07 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 314.45 ms |
…ges a peer A children owner with no prior lockfile key reads the children the lockfile pinned for its package (#13839). When the owner's scope provides a name a pinned package lists both as a dependency and as an optional peer, the split the pins record no longer applies, but the lockfile entry cannot say so: an entry that kept the dependency omits the peer. So adding a dependency whose optional peers hoist a parent of such a package kept the old split, while installing everything at once, and pnpm v11 in both cases, wrote the peer. Before reading the pins, such an owner walks the pinned subtree. For a package with a locked dependency or peer whose presence in scope differs from the scope the pins were recorded under, it reads the package's metadata and compares the split under the new scope with the locked one. When any differs, the owner resolves its children instead of reading the pins. A plain reinstall has no such owner; adding a dependency to the reproduction from #16901 checked 14 owners and read the metadata of one package. Closes the follow-up of #16901.
…comes a peer (#16912) A newly resolved package reads the children the prior lockfile pinned for it (#13839). When the scope it resolves them in provides a name that a pinned package lists both as a dependency and as an optional peer, the pinned split no longer applies, but the lockfile entry cannot say so: an entry that kept the dependency omits the peer. So installing in two steps kept the old split, while installing everything at once, and pnpm v11 in both cases, wrote the peer. Before reading the pins, the owner walks the pinned subtree. For a package with a locked dependency or peer whose presence in scope differs from the scope the pins were recorded under, it reads the package's metadata and compares the split under the new scope with the locked one. When any differs, the owner resolves its children instead. A plain reinstall has no such owner.
Summary
Investigating the lockfile-reuse half of #13837 turned up a live bug rather than the ordering question I went looking for.
record_childrensays:The arm implementing it returns
Published— which only suppresses the staleness signal — and then falls through tochildren.insert(...)like every other arm. So the fresh answer does replace the pinned children, and because no occurrence is flagged stale, the ones that realized the pinned subtree go on holding children the record no longer lists.What it costs
Instrumented every recording that replaced an existing one with different edges, on a partially stale
@teambit/bitlockfile (install --lockfile-only --no-prefer-frozen-lockfile, offline). 22 replacements per run, every one a pinned recording overwritten by a fresh walk (standing_prior=Some(…) incoming_prior=None):The resulting lockfile moved 24 edges nothing had asked it to move, including
@types/express-serve-static-corefrom4.19.9to5.1.3— a major version bump of a transitive dependency on a plain install.The fix
A walk whose context carries no prior key publishes nothing over a pinned recording and reads the pinned children, like every occurrence that reused the subtree. The gate that decides whether to walk at all applies the same rule, so the fresh subtree is not resolved and then discarded. A walk under an update policy is exempt — re-resolving pins is what
pnpm updateis for.On the ordering question in #13837
This also closes the reuse↔fresh contest the issue asks about: those recordings are no longer replaced, so there is nothing left for the two walks to race over. What I could not produce is a pinned-vs-pinned replacement — across three instrumented runs, all 22 replacements had
incoming_prior=None. The hoist-wave and cross-importer half of the issue is unchanged and stays open there.Measurements
@teambit/bitlockfile: 3/3 identical lockfiles before the fix and 3/3 after; the 24 edges above now keep their pins.mainproduces — this path has no pins to protect.Tests
re_recording_reports_whether_the_child_edges_movedassertedPublishedfor exactly this case while its own message said "a fresh walk does not unpin the subtree the lockfile-reusing occurrences realized". It never checked the stored edges, which is why the bug sat under a passing test. It now asserts the recording is declined and that the pinned children are what stands.a_pinned_subtree_keeps_its_children_against_a_fresh_walkresolves a package reached both from a pinned subtree and from a fresh edge, under both interleavings, and asserts the pins stand and that the range they pinned is never re-resolved. It fails onmain.Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
children_by_idand the recorded-children context are pacquet's own machinery;resolveDependencyTree.tskeeps a package's children perdepPathwith no equivalent replacement path, so there is nothing to mirror.Written by an agent (Claude Code, claude-opus-5[1m]).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
pnpm installcould re-resolve dependencies within pinned subtrees.Documentation