Repository navigation
fix(deps-restorer): materialize each global-virtual-store slot once - #13669
Conversation
The link pass spawned one CreateVirtualDirBySnapshot per snapshot key. Under the global virtual store, peer variants of a package whose recursive dependency hashes are equal map to one slot directory - that sharing is the point of the hashing - so hash-equal variants raced concurrent imports against a single path. Immutable packages tolerate this (their import is marker-gated and safe to skip), but a mutable `file:` source forces a stage-and-swap, whose remove-then-rename assumes an exclusive owner: one worker's `remove_dir_all` interleaves with another's rename and the install fails with `Directory not empty` or `NotFound` depending on timing. Injected workspace packages in a peer-heavy monorepo hit this on every install. pnpm v11 never faces the race because `lockfileToDepGraph` keys its graph by directory, so one node per location survives graph construction. Restore that invariant here by grouping slot links by `slot_dir` before the rayon pass: the first variant materializes the directory, the rest only report progress, and obsolete-child aliases recorded against any variant are unioned so stale links still get removed no matter which variant runs. Without the global virtual store every group is a singleton and the pass is unchanged. Co-Authored-By: Claude Fable 5 <[email protected]>
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe virtual-store restorer groups slots that resolve to the same directory, materializes each directory once, merges cleanup aliases, preserves progress reporting, and adds tests for grouped and ungrouped variants. ChangesGlobal virtual-store slot deduplication
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CreateVirtualStore
participant SlotGrouping
participant LinkTasks
participant VirtualStore
CreateVirtualStore->>SlotGrouping: group slots by virtual-store directory
SlotGrouping->>LinkTasks: create one task per unique directory
LinkTasks->>VirtualStore: materialize representative slot
LinkTasks->>CreateVirtualStore: report representative and duplicate progress
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 GVS install race by deduplicating slot directory materialization
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Confidence Score: 5/5The PR appears safe to merge. The previously reported changeset issue is fixed at the current HEAD, and no blocking failure remains. Reviews (3): Last reviewed commit: "docs(deps-restorer): let the tests carry..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 @.changeset/gvs-dedup-slot-materialization.md:
- Around line 2-6: Update the changeset frontmatter to release only pacquet by
removing the pnpm patch entry. Revise the description to focus solely on the
observed installation failure under enableGlobalVirtualStore, omitting
link-pass, slot materialization, and force-mode import implementation details.
In `@pnpm/crates/deps-restorer/src/create_virtual_store/tests.rs`:
- Around line 554-600: Extend the regression coverage beyond group_slots_by_dir
by adding a fixture-based link-pass test using two peer variants that resolve to
the same slot directory. Execute link_slots_parallel with a LinkConcurrencyProbe
and assert the shared directory is materialized exactly once. Use
RecordingReporter to verify the event sequence contains one warm-progress event
for each warm variant.
🪄 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: a33b018e-1e46-4580-9e2c-51e1044fc811
📒 Files selected for processing (3)
.changeset/gvs-dedup-slot-materialization.mdpnpm/crates/deps-restorer/src/create_virtual_store.rspnpm/crates/deps-restorer/src/create_virtual_store/tests.rs
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13669 +/- ##
==========================================
+ Coverage 88.08% 88.10% +0.01%
==========================================
Files 608 608
Lines 99033 99080 +47
==========================================
+ Hits 87231 87292 +61
+ Misses 11802 11788 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Release only pacquet: the race lives in the Rust link pass; pnpm v11 keys its graph by directory and never runs duplicate imports, so the TypeScript CLI has nothing to release. - Skip grouping work when the global virtual store is off: project-local slot names embed the peer-suffixed key, every group is a singleton, and the common layout should not pay per-slot path construction and map bookkeeping for an identity transform. - Cover the wiring, not just the grouping function: a lifetime counter on LinkConcurrencyProbe records one enter() per link task, and a new end-to-end test drives CreateVirtualStore::run over two hash-equal peer variants plus a distinct package under the global virtual store, asserting exactly two link tasks execute and the shared slot is materialized. The test fails against the ungrouped pass, which a unit test of group_slots_by_dir alone cannot. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 9236789 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/deps-restorer/src/create_virtual_store/tests.rs (1)
333-338: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAssert that the
soloslot is also materialized.The test asserts
total_entered() == 2and that thesharedslot manifest exists. It does not assert that the second link task produced thesoloslot. A regression that ran two tasks but materialized only one directory would still pass. Add the symmetric check to make the "distinct packages run separately" claim explicit.♻️ Proposed assertion for the distinct slot
assert!(shared_manifest.is_file(), "the shared slot must be materialized: {shared_manifest:?}"); + let solo_manifest = layout + .slot_dir(&key("solo", "1.0.0")) + .join("node_modules") + .join("solo") + .join("package.json"); + assert!(solo_manifest.is_file(), "the distinct slot must be materialized: {solo_manifest:?}"); }🤖 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/deps-restorer/src/create_virtual_store/tests.rs` around lines 333 - 338, In the test assertions alongside the existing shared_manifest check, add a symmetric is_file assertion for the solo slot’s node_modules/solo/package.json using the appropriate solo key and a message confirming that the solo slot must be materialized. Keep the existing total_entered and shared-slot assertions unchanged.
🤖 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/deps-restorer/src/create_virtual_store/tests.rs`:
- Around line 333-338: In the test assertions alongside the existing
shared_manifest check, add a symmetric is_file assertion for the solo slot’s
node_modules/solo/package.json using the appropriate solo key and a message
confirming that the solo slot must be materialized. Keep the existing
total_entered and shared-slot assertions unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2f9b2cac-9e81-452f-b67d-c1a6c8b11c9b
📒 Files selected for processing (4)
.changeset/gvs-dedup-slot-materialization.mdpnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot/tests.rspnpm/crates/deps-restorer/src/create_virtual_store.rspnpm/crates/deps-restorer/src/create_virtual_store/tests.rs
💤 Files with no reviewable changes (1)
- .changeset/gvs-dedup-slot-materialization.md
🚧 Files skipped from review as they are similar to previous changes (1)
- pnpm/crates/deps-restorer/src/create_virtual_store.rs
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.85288958126,
"stddev": 0.19848033074983928,
"median": 2.85289368706,
"user": 2.5775349,
"system": 1.8902157599999998,
"min": 2.5975217095599996,
"max": 3.12610366856,
"times": [
2.5975217095599996,
3.05713745656,
3.0690630945599997,
2.7724027745599997,
2.93338459956,
3.12610366856,
2.70918093256,
2.95148761156,
2.70932748756,
2.6032864775599998
]
},
{
"command": "pacquet@main",
"mean": 2.90422021276,
"stddev": 0.16660496317603615,
"median": 2.90995094006,
"user": 2.7743143,
"system": 2.0852080600000003,
"min": 2.56338343056,
"max": 3.11761739556,
"times": [
2.88910851856,
2.80505692256,
2.9961956915599997,
2.56338343056,
2.75473498256,
2.99438854756,
2.90963925756,
3.11761739556,
2.91026262256,
3.1018147585599998
]
},
{
"command": "pnpr@HEAD",
"mean": 1.7822547251600003,
"stddev": 0.15770244984979112,
"median": 1.7368154285600002,
"user": 2.0170991,
"system": 2.19844496,
"min": 1.6305706075600002,
"max": 2.14456109756,
"times": [
2.14456109756,
1.73902366956,
1.7346071875600002,
1.6305706075600002,
1.65542031356,
1.66497399856,
1.9292626815600002,
1.75138452056,
1.8669241495600002,
1.70581902556
]
},
{
"command": "pnpr@main",
"mean": 1.7931135407599998,
"stddev": 0.1495124661023066,
"median": 1.8287125900600003,
"user": 1.7668433999999997,
"system": 1.9002100599999998,
"min": 1.6063558515600003,
"max": 1.98097227656,
"times": [
1.90751054256,
1.93404735656,
1.98097227656,
1.6106528525600001,
1.6578416365600002,
1.7773968825600002,
1.6063558515600003,
1.9271376695600002,
1.64919204156,
1.8800282975600002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.34049841428,
"stddev": 0.027184021821635797,
"median": 0.33989245448,
"user": 0.29100055999999996,
"system": 0.6455105399999999,
"min": 0.29614107648,
"max": 0.37394601148,
"times": [
0.33646188548,
0.30726732248,
0.32033436748,
0.33086129648,
0.34332302348,
0.35971221248,
0.29614107648,
0.37394601148,
0.36960105348,
0.36733589348
]
},
{
"command": "pacquet@main",
"mean": 0.35966181708,
"stddev": 0.0271324379819469,
"median": 0.35079555098000004,
"user": 0.31184855999999994,
"system": 0.6754327399999999,
"min": 0.32765452648,
"max": 0.40863524348,
"times": [
0.34259316148,
0.37486522948,
0.32765452648,
0.35120572148,
0.33897519948,
0.33777720648,
0.36502815548,
0.35038538048,
0.39949834648,
0.40863524348
]
},
{
"command": "pnpr@HEAD",
"mean": 0.39862167047999997,
"stddev": 0.04029090448037713,
"median": 0.39118647598,
"user": 0.33859066,
"system": 0.7023559399999998,
"min": 0.35194567248,
"max": 0.46581289048,
"times": [
0.44181152148,
0.36558161648,
0.36095096148,
0.36071753248,
0.38453130948,
0.43619636548,
0.39784164248000004,
0.42082719248,
0.46581289048,
0.35194567248
]
},
{
"command": "pnpr@main",
"mean": 0.35650669308,
"stddev": 0.026227954651906322,
"median": 0.35979694298,
"user": 0.29975516,
"system": 0.64760014,
"min": 0.30937501448,
"max": 0.38815091348,
"times": [
0.37149508248,
0.37202987948,
0.38815091348,
0.35981001748,
0.31507711348,
0.30937501448,
0.35577311948,
0.38341200648,
0.35978386848,
0.35015991548000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0142558824999997,
"stddev": 0.11112441181648273,
"median": 2.9963190824,
"user": 2.499935979999999,
"system": 2.0236509,
"min": 2.8625898709,
"max": 3.1929066619,
"times": [
2.9140026869,
2.9321960798999998,
2.9390101589,
3.1185574518999997,
3.1929066619,
2.8625898709,
2.9328311789,
3.0536280059,
3.1149560489,
3.0818806809
]
},
{
"command": "pacquet@main",
"mean": 2.8862690764999996,
"stddev": 0.06979665505788558,
"median": 2.8887179684,
"user": 2.26910558,
"system": 1.8610992999999998,
"min": 2.7874513799,
"max": 2.9997796829,
"times": [
2.9579035558999998,
2.9125244019,
2.8649115349,
2.7874513799,
2.8279398329,
2.8129944619,
2.9338741039,
2.9997796829,
2.8387596709,
2.9265521399
]
},
{
"command": "pnpr@HEAD",
"mean": 1.740720199,
"stddev": 0.16758416521088784,
"median": 1.6755386019,
"user": 1.50105728,
"system": 1.5786175,
"min": 1.5567104889,
"max": 2.0394308689,
"times": [
1.9187220369,
1.8742235689,
1.6028557609,
2.0394308689,
1.6378037059,
1.6834092649,
1.5710112399,
1.8553671159,
1.5567104889,
1.6676679389
]
},
{
"command": "pnpr@main",
"mean": 1.7546366589999998,
"stddev": 0.1656083811141056,
"median": 1.7700512944,
"user": 1.5299298799999999,
"system": 1.6990621999999997,
"min": 1.5374412329,
"max": 2.0047174548999998,
"times": [
1.5374412329,
1.9497571379,
2.0047174548999998,
1.5593317989,
1.7753443889,
1.8214335849,
1.8542030599000001,
1.7386163339,
1.7647581999,
1.5407633979
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6691295167,
"stddev": 0.10312400465203692,
"median": 0.6391530606,
"user": 0.9263878,
"system": 0.96577366,
"min": 0.5503216886,
"max": 0.8656118826,
"times": [
0.5503216886,
0.5902084946,
0.6615716376,
0.6762443866,
0.6253132326,
0.6200696316,
0.6105957996,
0.6529928886,
0.8656118826,
0.8383655246
]
},
{
"command": "pacquet@main",
"mean": 0.6291370732000001,
"stddev": 0.10255505485265905,
"median": 0.6229951011,
"user": 0.854554,
"system": 0.9493826599999998,
"min": 0.48351571060000004,
"max": 0.8481123046,
"times": [
0.8481123046,
0.48351571060000004,
0.6152895006,
0.6487214796,
0.6307007016,
0.5959748496,
0.6320831406,
0.5271205186,
0.5772139196,
0.7326386066
]
},
{
"command": "pnpr@HEAD",
"mean": 0.4428144871,
"stddev": 0.04670975041679743,
"median": 0.45688950860000005,
"user": 0.34068060000000006,
"system": 0.69779726,
"min": 0.3713331206,
"max": 0.5150517646,
"times": [
0.3713331206,
0.4028990096,
0.5150517646,
0.4314716416,
0.47008472260000006,
0.3760414046,
0.45337491960000004,
0.4687305956,
0.46040409760000006,
0.47875359460000005
]
},
{
"command": "pnpr@main",
"mean": 0.43387537639999996,
"stddev": 0.022074866362520762,
"median": 0.42798322610000006,
"user": 0.3176822,
"system": 0.71952096,
"min": 0.40822369360000005,
"max": 0.4790951366,
"times": [
0.41776081860000003,
0.4248899346,
0.45394558360000004,
0.40822369360000005,
0.4284330666,
0.42753338560000004,
0.4790951366,
0.41282397460000003,
0.45440900460000005,
0.43163916560000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.1715936675199994,
"stddev": 0.11333675935420653,
"median": 2.1515376892199995,
"user": 1.47119504,
"system": 1.2005264599999999,
"min": 2.04095659622,
"max": 2.3923149162199997,
"times": [
2.3923149162199997,
2.07291741922,
2.2053553572199998,
2.17667154822,
2.16799933122,
2.04095659622,
2.0973971732199996,
2.1350760472199997,
2.33307233122,
2.09417595522
]
},
{
"command": "pacquet@main",
"mean": 2.16307147712,
"stddev": 0.16662457411685747,
"median": 2.10446067522,
"user": 1.46338124,
"system": 1.2479856599999999,
"min": 1.9748671552200001,
"max": 2.51730708322,
"times": [
2.21456622922,
2.51730708322,
2.35551319022,
2.11675762922,
2.21014804022,
1.9748671552200001,
2.0398462082199997,
2.09216372122,
2.07980979922,
2.0297357152199997
]
},
{
"command": "pnpr@HEAD",
"mean": 0.44290879062000005,
"stddev": 0.03255019463934222,
"median": 0.44114413672,
"user": 0.33685334,
"system": 0.6949945599999999,
"min": 0.41399551522,
"max": 0.5274249582200001,
"times": [
0.44364486922,
0.42230415922000003,
0.44473302622,
0.41399551522,
0.44795066722000004,
0.44998458122,
0.5274249582200001,
0.41888006922000004,
0.43864340422000003,
0.42152665622
]
},
{
"command": "pnpr@main",
"mean": 0.48757152212,
"stddev": 0.040662439640470616,
"median": 0.48891614372000003,
"user": 0.35433254,
"system": 0.7798445599999999,
"min": 0.43250210622,
"max": 0.5611950322200001,
"times": [
0.49703709422000003,
0.46058620922000004,
0.44253806822,
0.49329110922,
0.45705144022,
0.43250210622,
0.5611950322200001,
0.5272868792200001,
0.5196861042200001,
0.48454117822000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25432349698,
"stddev": 0.02784527905733934,
"median": 0.24897579888,
"user": 0.24400313999999995,
"system": 0.08959935999999999,
"min": 0.22528166438000002,
"max": 0.30057383538,
"times": [
0.26843128738,
0.22528166438000002,
0.22781510038000002,
0.22806763438000002,
0.23017538238000002,
0.30057383538,
0.28083297738,
0.23963309538000002,
0.25831850238,
0.28410549038
]
},
{
"command": "pacquet@main",
"mean": 0.23583733110727276,
"stddev": 0.016758848108463266,
"median": 0.23831571238000002,
"user": 0.2177002309090909,
"system": 0.09176157818181818,
"min": 0.20956603238000002,
"max": 0.26504171438,
"times": [
0.25215436137999997,
0.24315047838000003,
0.21689261738,
0.20956603238000002,
0.22408643038000003,
0.24408221738000002,
0.23831571238000002,
0.22300008138000002,
0.24871691838,
0.22920407838000004,
0.26504171438
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09795337993999999,
"stddev": 0.005406164496873337,
"median": 0.09740695438000001,
"user": 0.026753500000000003,
"system": 0.012982039999999999,
"min": 0.09044333138,
"max": 0.11445598938,
"times": [
0.11445598938,
0.10053208038,
0.09761907138,
0.10391602338,
0.10132568038,
0.09179858538,
0.09640661638,
0.10105382038,
0.09364764738,
0.09527963038000001,
0.09592397038,
0.10880725638000001,
0.10135839138,
0.09740695438000001,
0.09490005838,
0.09180529838,
0.09621057838,
0.09868318038,
0.09803258838000001,
0.09855923738,
0.09880364638,
0.09580252138,
0.09457253338,
0.09148980738,
0.09044333138
]
},
{
"command": "pnpr@main",
"mean": 0.09851714386275862,
"stddev": 0.0032589205319544247,
"median": 0.09814888638,
"user": 0.026234312413793107,
"system": 0.013028285517241377,
"min": 0.09231725038000001,
"max": 0.10520649538,
"times": [
0.09473613038,
0.09693507738,
0.10088955238,
0.09231725038000001,
0.09861121538,
0.09688428338,
0.10214811438,
0.10209159838,
0.09789101338,
0.09659269638,
0.09302321438,
0.10302500038,
0.10295289538,
0.09943945038,
0.10230365638,
0.09886489038,
0.10001543038,
0.10072000438,
0.09814888638,
0.09258645438,
0.10520649538,
0.10141102138000001,
0.09566601638,
0.09862829638000001,
0.09564572738,
0.09806906738,
0.09797520138,
0.09613044838,
0.09808808338
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.1450563661355557,
"stddev": 0.3591855602279567,
"median": 1.09662400758,
"user": 1.0852734799999997,
"system": 0.21711637777777776,
"min": 0.66726014258,
"max": 1.74562061358,
"times": [
1.74562061358,
1.27492050158,
1.65299620758,
0.8578307875800001,
1.1205496505800001,
0.9814045935800001,
1.09662400758,
0.90830079058,
0.66726014258
]
},
{
"command": "pacquet@main",
"mean": 0.9569867502466667,
"stddev": 0.2023718082707899,
"median": 0.92710693458,
"user": 0.8871794799999999,
"system": 0.20637271111111113,
"min": 0.60194627258,
"max": 1.27941542958,
"times": [
1.07595416558,
0.60194627258,
0.88349683858,
1.11847369458,
1.07986623858,
1.27941542958,
0.92710693458,
0.81195396458,
0.8346672135800001
]
},
{
"command": "pnpm@HEAD",
"mean": 3.308389414913333,
"stddev": 0.15846173328463986,
"median": 3.24833615858,
"user": 5.077280924444445,
"system": 0.31411048888888893,
"min": 3.1390204275799998,
"max": 3.54933051558,
"times": [
3.54933051558,
3.39865079358,
3.48513489458,
3.15333211458,
3.22723150058,
3.42799204558,
3.24833615858,
3.1464762835799998,
3.1390204275799998
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.63421498234,
"stddev": 0.12043138099608346,
"median": 4.60903022344,
"user": 2.0225307799999994,
"system": 1.56986184,
"min": 4.49680767094,
"max": 4.85194110894,
"times": [
4.58223879494,
4.57386234094,
4.85194110894,
4.53168840994,
4.69002764994,
4.6627359969399995,
4.63582165194,
4.51311626594,
4.80390993294,
4.49680767094
]
},
{
"command": "pacquet@main",
"mean": 4.56837807184,
"stddev": 0.13745053049779557,
"median": 4.52873715994,
"user": 2.01588848,
"system": 1.5951923399999997,
"min": 4.48499935394,
"max": 4.95262667794,
"times": [
4.51573636294,
4.52340873694,
4.55186750094,
4.51374876294,
4.95262667794,
4.53406558294,
4.57050648994,
4.4938228879399995,
4.54299836194,
4.48499935394
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5427353860400004,
"stddev": 0.07602297563917539,
"median": 3.5180286284399997,
"user": 1.4015478799999999,
"system": 1.36550234,
"min": 3.47330545794,
"max": 3.72999751694,
"times": [
3.59121519294,
3.48162729394,
3.49633921194,
3.47330545794,
3.52968191694,
3.54211050494,
3.72999751694,
3.5726977069399997,
3.50637533994,
3.50400371794
]
},
{
"command": "pnpr@main",
"mean": 3.6191496012399993,
"stddev": 0.14424382395457205,
"median": 3.57508897494,
"user": 1.2843499799999998,
"system": 1.3196683399999998,
"min": 3.4656375749399997,
"max": 3.85910957994,
"times": [
3.7811400419399996,
3.80961984694,
3.55880113294,
3.5235118549399997,
3.5939411999399997,
3.4656375749399997,
3.46572002994,
3.59137681694,
3.54263793394,
3.85910957994
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13669 |
| 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,556.71 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 414.00 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 371.33 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 90.44 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,630.57 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,473.31 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 351.95 ms |
The grouping's contract is specified by its four tests; keep the code comments to what a reader needs at the site and leave the race narrative to the changeset and PR. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit d8bde85 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…ript rc.1 carries the slot-materialization dedup (pnpm/pnpm#13669), the last engine change the global virtual store needed from a checkout, so the script that installed a locally built engine over the released one goes away as promised. It also adds `allowUnusedPatches`, which unblocks the version-scoped patch approach parked in teambit#10572 if it is ever wanted over the packageExtensions built-ins. Verified on the released engine: two consecutive self-hosted global-virtual-store installs of this repo (the workload whose peer variants previously raced the link pass on every install), zero race errors, lint green. Co-Authored-By: Claude Fable 5 <[email protected]>
…ript rc.1 carries the slot-materialization dedup (pnpm/pnpm#13669), the last engine change the global virtual store needed from a checkout, so the script that installed a locally built engine over the released one goes away as promised. It also adds `allowUnusedPatches`, which unblocks the version-scoped patch approach parked in teambit#10572 if it is ever wanted over the packageExtensions built-ins. Verified on the released engine: two consecutive self-hosted global-virtual-store installs of this repo (the workload whose peer variants previously raced the link pass on every install), zero race errors, lint green. Co-Authored-By: Claude Fable 5 <[email protected]>
…ript rc.1 carries the slot-materialization dedup (pnpm/pnpm#13669), the last engine change the global virtual store needed from a checkout, so the script that installed a locally built engine over the released one goes away as promised. It also adds `allowUnusedPatches`, which unblocks the version-scoped patch approach parked in teambit#10572 if it is ever wanted over the packageExtensions built-ins. Verified on the released engine: two consecutive self-hosted global-virtual-store installs of this repo (the workload whose peer variants previously raced the link pass on every install), zero race errors, lint green. Co-Authored-By: Claude Fable 5 <[email protected]>
Opt-in support for pnpm's global virtual store: dependency directories are created once in a store shared by every workspace on the machine, instead of being re-created inside each `node_modules/.pnpm`. Capsules deliberately keep the project-local layout — see below. Every engine dependency is in a published `@pnpm/napi`: the settings surface (pnpm/pnpm#13648) and the `link:` slot fix (pnpm/pnpm#13658) in 12.0.0-rc.0, and the slot-materialization dedup (pnpm/pnpm#13669) in 12.0.0-rc.1, which this branch pins. The local-engine bootstrap script is gone. ## Effect After a fresh install the project-local virtual store holds nothing but `lock.yaml` and the hoisted `node_modules` — every dependency directory, including injected workspace components, lives in the shared store: | workspace | `node_modules/.pnpm` entries, no GVS | with GVS | |---|---|---| | a Bit Cloud workspace | 20832 | 0 | | the bit repo itself | 6441 | 0 | | bitdev-envs | 4017 | 0 | Bit uses pnpm's own `<storeDir>/links`, so slots are reused across bit versions and shared with every other pnpm project on the machine, upgrades stay incremental, and `pnpm store prune` accounts for them. Migration note: switching an existing workspace over does not remove what the previous project-local store already contains — pnpm does not prune it once the effective virtual store points elsewhere — so the old directories linger until `node_modules/.pnpm` is deleted. New workspaces never see them. ## Turning it on Off by default. Per workspace under `teambit.dependencies/dependency-resolver`, machine-wide with `bit config set enable_global_virtual_store true`, or per run with `BIT_ENABLE_GLOBAL_VIRTUAL_STORE=true`. It has no effect when `nodeLinker` is `hoisted`, which uses no virtual store at all. ## What it took to behave identically A shared store breaks one assumption that runs through Bit: that a package can walk *up* out of `node_modules/.pnpm` into the workspace. Consequences: - **Core aspects (CJS).** Bit deliberately does not declare `@teambit/*` core aspects as dependencies of the envs and aspects that use them — they have to be the single copy from the running installation, and declaring them would install duplicates. Project-locally they resolved by walking up into the workspace root; nothing in a shared store can. This branch uses pnpm's documented mechanism for hoisted dependencies in this layout: the privately hoisted directory stays project-local at `node_modules/.pnpm/node_modules` even under the global virtual store, the core aspects are linked there, and `bootstrap` puts that directory on `NODE_PATH` before any aspect loads. Nothing is written inside the store itself, which is what allows the shared `<storeDir>/links` to be used at all. - **Core aspects (ESM).** Node ignores `NODE_PATH` for ESM, and bit supports ESM components, so the same hoisted-directory fallback is provided to the ESM resolver via a `module.register()` loader (adapted from pnpm's `@pnpm/plugin-esm-node-path`, MIT), installed at bootstrap and propagated to child processes through `NODE_OPTIONS`. - **Phantom `tsconfig` `extends` in published envs.** TypeScript resolves `extends` with its own resolver — neither `NODE_PATH` nor the ESM loader applies — and several published envs extend a package they never declare (`@teambit/react/typescript/tsconfig.json` from the node mocha envs, `base-react-env`, `rspack.envs.react-env` and `react-env` 1.x; `rspack.envs.react-env/config/tsconfig.json` from `cloud-react`). Project-locally the walk up out of `.pnpm` passed the privately hoisted directory and caught these by accident. Fixed with pnpm's documented remedy: built-in `packageExtensions` declaring the missing dependency for the known envs, merged under the workspace's own `packageExtensions` so users can cover third-party envs the same way. Extensions only add what a manifest lacks, an unmatched entry is not an error (react-env's is scoped to `@1` — 2.x inlined the config), and none of these envs import their extends-target at runtime, so the added copy cannot shadow the host-provided singletons. (#10572 explored a `patchedDependencies`-based variant for react-env 1.x and is closed — the extensions cover it.) - **The bit repo itself.** A workspace that *authors* the core aspects bridges them into the hoisted store only until they compile, then removes the bridge. Right project-locally, fatal from a shared store. The bridge now persists, repointed at the compiled workspace copy. - **Injected dirs.** `getInjectedDirs` reports an injected copy absolute when it cannot be made relative to the lockfile dir — under a shared store, always. `compiler.task.ts` joined it onto the capsule root regardless, hard-linking build artifacts into a path that does not exist. (`node-modules-linker` and `workspace-compiler` already guarded this; only that one site did not.) - **`bit deps diagnose`.** Its duplicate-copy counts came from scanning `node_modules/.pnpm`. The shared store holds every workspace's packages, so it cannot answer that question for one workspace; the counts now come from the current lockfile pnpm writes next to the hoisted directory, whose dep paths map one-to-one onto the project-local directory names. - **Capsules stay project-local.** A capsule is a self-contained build sandbox and TypeScript's declaration emit depends on that: it names an inferred type through the package that declares it, which it can only do while that package sits inside the capsule. Moving env/aspect packages out made `bit build` of any custom env fail with `TS2742`. Workspace installs — the ones users wait on repeatedly — still get the shared store. ## Also here: `patchedDependencies` The branch adds pnpm's `patchedDependencies` as a dependency-resolver setting (it began as the vehicle for the react-env `tsconfig` fix above, and is useful on its own): ```json { "teambit.dependencies/dependency-resolver": { "patchedDependencies": { "[email protected]": "patches/is-positive.patch" } } } ``` Paths are relative to the workspace root. pnpm resolves a relative patch path from the directory it is installing in, so capsule installs — which run in the capsules directory — get the paths resolved against the workspace root first; workspace installs keep the configured spelling, which pnpm records in `pnpm-lock.yaml` and which must stay machine-independent there. ## Self-hosting: a workspace whose node_modules provides the running bit Both layouts are safe in steady state: repeat installs preserve the top-level package directories the running process resolves from (verified by sampling them through live installs), and the end-of-install compile refreshes the per-variant copies. A layout *switch* is different — it relocates every injected component package, rebuilding the top-level directories from source, so their compiled `dist` disappears mid-install and a bit running from them dies before reaching the compile that would restore it, leaving `node_modules` unusable. The installer now detects the combination (current layout read off `.modules.yaml`, self-hosting by realpath of the running module) and refuses up front with instructions to run the one-time transition from an external bit installation. With that and the engine fix, the bit repo itself runs under the global virtual store: full install + compile of all 332 components, repeat self-hosted installs in ~50s, `npm run lint` green. The repo's own tsc needed the type-layer counterpart of the runtime bridges — `tsconfig.json` `paths` routing react typings and `@teambit/*` through the workspace's `node_modules`, since a published package's `.d.ts` cannot reach undeclared `@types`/core aspects from a store slot either. ## Phantom dependencies, generally A shared store makes an under-declared package fail loudly: it lives outside the project, so nothing the project hoisted is on its resolution path any more. That is a real constraint, not a bug to work around, and it applies to pnpm generally rather than to Bit. Every failure this branch hit was a genuine phantom dependency — an env's undeclared `tsconfig` base, a fixture env with detection switched off (`@bit-no-check` removed so the dependency gets declared), `@teambit/webpack.webpack-bundler` requiring `events/` without declaring it (covered by `packageExtensions`, documented in the aspect docs), and the repo's own undeclared `@types/graceful-fs` (now declared). ## One CI change `bit_pr` now runs on a temp lane (dropped `--keep-lane`). A reused PR lane serves components unchanged since an earlier export with artifacts from older commits, so capsules mix generations of `@teambit` packages and cross-copy `instanceof` checks start failing — deterministic red that looks exactly like branch breakage and defeats bisection (on this branch: run 1 green on a fresh lane, every later push red, across 11 runs and 2 lanes). Filed as #10583; the temp-lane flow is self-consistent per run. ## Testing - New e2e: `global-virtual-store.e2e.ts` (nothing materialized in the workspace, dependencies linked from the shared store, component loads and compiles, patched dependencies under the store) and `patched-dependencies.e2e.ts` (a workspace-relative patch applies both in the workspace and in the capsule — verified to fail before the capsule-path fix). - The bit repo (332 components): full global-virtual-store install, repeat self-hosted installs, transition guard verified in both directions (clean refusal, workspace intact), lint green. Runs on the released rc.1 engine. - A Bit Cloud workspace, 105 components: wiped-`node_modules` install + compile, slot reuse verified (a repeat install creates 0 of 30766 slots), core-aspect resolution through `NODE_PATH` verified positively and negatively, `bit start` working. - bitdev-envs (609 components, 20 apps): `bit app list` byte-identical to the non-GVS baseline, apps running — against an earlier revision of the core-aspect mechanism. - The full e2e suite under `BIT_ENABLE_GLOBAL_VIRTUAL_STORE=true` was run locally against an earlier revision: no GVS-specific failures (the `validate command` failures reproduce with the store off). CI runs the suite in its default store-off configuration, where this branch has been green including the 40-shard e2e. The first commit (`fix(doctor)`) is unrelated to the rest and can be split out — it surfaced because the e2e temp dir contains a dot, which is why `doctor-infra.e2e.ts` fails locally but passes on CI. --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Installs with
enableGlobalVirtualStorefailed nondeterministically on projects with injectedfile:dependencies in peer-heavy graphs:(or
No such file or directory (os error 2), depending on interleaving — a different package each run.)Cause
The link pass spawns one
CreateVirtualDirBySnapshotper snapshot key. Under the global virtual store, peer variants of a package whose recursive dependency hashes are equal map to one slot directory — that sharing is the point of the hashing. Immutable packages tolerate the duplicate imports (marker-gated,safe_to_skip), but a mutablefile:source forcesstage_and_swapon every install, and its remove-then-rename assumes an exclusive owner (see the step-5 comment inimport_indexed_dir.rs). Two rayon workers targeting the same slot race: one'sremove_dir_allinterleaves with the other's rename.pnpm v11 never faces this because
lockfileToDepGraphkeys its graph by directory (graph[dir] = ...), so one node per location survives graph construction.Fix
Group slot links by
layout.slot_dir(key)before the rayon pass (group_slots_by_dir): the first variant materializes the directory, the remaining variants only emit their progress events (package counts stay in step with the lockfile), andremoved_aliasesrecorded against any variant are unioned so obsolete-child cleanup still covers all of them. Without the global virtual store every group is a singleton and the pass is unchanged.Found running Bit's own repository (334 injected components, 5 peer variants each of the racing packages) under the global virtual store — it failed on every install, on a different package each time, and passes reliably with this fix.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit