Repository navigation
refactor(store-dir): share the store-index open and drain helpers - #13647
Conversation
Four call sites branched on `frozenStore` to pick between `shared_immutable_in` and `shared_readonly_in`, three of them wrapping it in the same `spawn_blocking` plus warn-on-join-failure. Four more repeated the writer drain verbatim, and two more branched to pick between `spawn` and `spawn_disabled`. None of it is install logic — it is how any caller opens the store index and closes its writer. `pacquet-store-dir` owns those types, so it now owns the four helpers: - `StoreIndex::shared_for` — the `frozenStore` branch. - `StoreIndex::open_shared` — the same, off the reactor thread, degrading a join failure to `None` because every lookup then simply misses. - `StoreIndexWriter::spawn_for` — the `spawn` / `spawn_disabled` branch. - `StoreIndexWriter::drain` — await the final flush, warning rather than propagating, since the rows describe work already on disk. They take `frozen_store: bool` rather than `&Config`, which keeps `store-dir` free of a dependency on the config crate that sits above it. The `warn!` target moves from whichever caller copied the block (`pacquet::install`, `pacquet::patch`, `pacquet::pnpr`) to `pacquet::store_index`, which names the subsystem the event is actually about. `RUST_LOG` filters aimed at the old targets will no longer match these two lines. No behaviour change otherwise. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
📝 WalkthroughWalkthroughChangesThe PR adds shared APIs for store-index access and writer lifecycle handling. Dedupe, install, patch, and tarball flows now use these APIs instead of local frozen-store branching and task-result handling. Store-index lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes 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 QodoRefactor: centralize StoreIndex open/drain helpers in store-dir
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTo customize comments, go to the Qodo configuration screen, or learn more in the docs. |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Confidence Score: 5/5The PR appears safe to merge, with the migrated call sites retaining their previous store-index behavior and lifecycle ordering. The extracted helpers reproduce the prior frozen-store branches, blocking-task handling, sender-drop-before-drain sequence, warning text, and error-degradation policy; the only observable difference is the tracing target change already documented by the author. Reviews (1): Last reviewed commit: "refactor(store-dir): share the store-ind..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm/crates/store-dir/src/store_index.rs (1)
175-188: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winComplete the
spawn_forrustdoc contract.The rustdoc begins with a sentence fragment. State the selected writer mode and the common handle/task return contract.
As per coding guidelines, “Use rustdoc comments for public API contracts.” As per path instructions, public helper documentation must describe contracts and edge cases.
🤖 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/store-dir/src/store_index.rs` around lines 175 - 188, Complete the rustdoc for StoreIndexWriter::spawn_for by stating that frozen_store selects the disabled writer and otherwise selects the normal writer, and document that both paths return an Arc<StoreIndexWriter> together with a JoinHandle whose task resolves to Result<(), StoreIndexError>. Ensure the opening text is a complete sentence and covers the read-only edge case.Sources: Coding guidelines, Path instructions
pnpm/crates/deps-restorer/src/create_virtual_store.rs (1)
309-309: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove delegated index-open details from this caller.
StoreIndex::open_sharedowns the blocking-task and join-failure contract. Lines 272–283 repeat that behavior and nameshared_readonly_in, which this caller no longer invokes. Keep the caller-specific cache-use rationale only.As per coding guidelines, “Do not write comments that merely restate code, repeat callee documentation, [or] describe removed implementation history.”
🤖 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.rs` at line 309, Remove the caller comments around StoreIndex::open_shared in the store-opening flow that describe blocking-task, join-failure, or shared_readonly_in details. Keep only the caller-specific rationale for using the cache, leaving the delegated index-open behavior documented by StoreIndex::open_shared itself.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/crates/deps-restorer/src/create_virtual_store.rs`:
- Line 309: Remove the caller comments around StoreIndex::open_shared in the
store-opening flow that describe blocking-task, join-failure, or
shared_readonly_in details. Keep only the caller-specific rationale for using
the cache, leaving the delegated index-open behavior documented by
StoreIndex::open_shared itself.
In `@pnpm/crates/store-dir/src/store_index.rs`:
- Around line 175-188: Complete the rustdoc for StoreIndexWriter::spawn_for by
stating that frozen_store selects the disabled writer and otherwise selects the
normal writer, and document that both paths return an Arc<StoreIndexWriter>
together with a JoinHandle whose task resolves to Result<(), StoreIndexError>.
Ensure the opening text is a complete sentence and covers the read-only edge
case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fb504210-68e2-401e-9444-521da18b86d4
📒 Files selected for processing (8)
pnpm/crates/cli/src/cli_args/dedupe.rspnpm/crates/deps-restorer/src/create_virtual_store.rspnpm/crates/deps-restorer/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rspnpm/crates/package-manager/src/patch.rspnpm/crates/package-manager/src/tarball_prefetch.rspnpm/crates/store-dir/src/store_index.rs
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13647 +/- ##
==========================================
+ Coverage 88.08% 88.09% +0.01%
==========================================
Files 582 582
Lines 98620 98601 -19
==========================================
- Hits 86866 86865 -1
+ Misses 11754 11736 -18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.7476278067999997,
"stddev": 0.12138650826817902,
"median": 2.7599333474999996,
"user": 2.13713094,
"system": 1.7084056,
"min": 2.5591557369999998,
"max": 2.915973454,
"times": [
2.582092185,
2.5591557369999998,
2.719547087,
2.868308094,
2.757607893,
2.86618294,
2.762258802,
2.650563089,
2.915973454,
2.794588787
]
},
{
"command": "pacquet@main",
"mean": 2.6989931513999994,
"stddev": 0.20719112127452016,
"median": 2.598147828,
"user": 2.2907295399999996,
"system": 1.7975426999999997,
"min": 2.511955551,
"max": 3.050255125,
"times": [
2.511955551,
2.526571313,
2.578447287,
2.617848369,
2.528707958,
2.539323485,
2.937758529,
2.9503191579999997,
3.050255125,
2.7487447389999997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6674180675000003,
"stddev": 0.17253915535399417,
"median": 1.6561634245000003,
"user": 1.5187437400000001,
"system": 1.6033303999999997,
"min": 1.436358955,
"max": 1.9108349980000001,
"times": [
1.5997118590000001,
1.7962026870000003,
1.7646331900000003,
1.436358955,
1.7126149900000003,
1.506233326,
1.5662882180000002,
1.9108349980000001,
1.4840873760000002,
1.8972150760000002
]
},
{
"command": "pnpr@main",
"mean": 1.6773320668,
"stddev": 0.14778221273903475,
"median": 1.6882363935000002,
"user": 1.7980660400000001,
"system": 2.0309511,
"min": 1.451632534,
"max": 1.9118009630000001,
"times": [
1.813188865,
1.451632534,
1.831102443,
1.526142555,
1.7175741080000002,
1.6742588200000001,
1.9118009630000001,
1.7022139670000003,
1.6004273840000003,
1.544979029
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.37864044548,
"stddev": 0.02058901268237005,
"median": 0.37695623778000004,
"user": 0.33994868,
"system": 0.6517267199999999,
"min": 0.35064725978,
"max": 0.41325952578,
"times": [
0.39069304378,
0.36813848478,
0.35064725978,
0.41325952578,
0.36899643678000005,
0.40020676978,
0.35734486378,
0.36007578578000005,
0.38491603878,
0.39212624578000005
]
},
{
"command": "pacquet@main",
"mean": 0.37438676128000004,
"stddev": 0.028112962313072778,
"median": 0.38174290178000003,
"user": 0.31916668,
"system": 0.69790672,
"min": 0.31578415278,
"max": 0.39904474778000004,
"times": [
0.37753053178,
0.39898193878000004,
0.37282607178000005,
0.34491058078000003,
0.39904474778000004,
0.39857602578,
0.35433701278,
0.31578415278,
0.38595527178,
0.39592127878
]
},
{
"command": "pnpr@HEAD",
"mean": 0.36787296098,
"stddev": 0.024273603327481914,
"median": 0.36557183728,
"user": 0.32811767999999997,
"system": 0.64562672,
"min": 0.32847382678000003,
"max": 0.40511326778,
"times": [
0.38397864778,
0.34454401178,
0.34852375978,
0.32847382678000003,
0.40511326778,
0.36938683078,
0.35770899878,
0.38266856678,
0.36175684378,
0.39657485578
]
},
{
"command": "pnpr@main",
"mean": 0.51523330768,
"stddev": 0.08715434244177075,
"median": 0.5568974357800001,
"user": 0.45744408000000003,
"system": 0.7623431199999999,
"min": 0.38215447078000003,
"max": 0.6121641297800001,
"times": [
0.44048463078000005,
0.42282341578000004,
0.38215447078000003,
0.56670210878,
0.5501028887800001,
0.5857591757800001,
0.6121641297800001,
0.60350363778,
0.5636919827800001,
0.42494663578
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0728008619000002,
"stddev": 0.2669753185557745,
"median": 3.0139250303000003,
"user": 2.6014327600000002,
"system": 2.1135526,
"min": 2.8382948968000004,
"max": 3.7597424008,
"times": [
3.7597424008,
3.1628564058000004,
3.0174351558000003,
3.1389853128,
3.0978150458,
2.9620552578000003,
2.8609273328000002,
2.8382948968000004,
3.0104149048,
2.8794819058
]
},
{
"command": "pacquet@main",
"mean": 2.9849421988,
"stddev": 0.22754891324456034,
"median": 2.9219562533000003,
"user": 2.44616246,
"system": 1.9774897,
"min": 2.7556005968000004,
"max": 3.4579175048,
"times": [
3.3311328808000003,
2.9284428128,
2.7962187788,
2.9268583938000003,
3.4579175048,
2.8683253928,
2.9800949838000004,
2.9170541128000003,
2.8877765308,
2.7556005968000004
]
},
{
"command": "pnpr@HEAD",
"mean": 1.7777887320999999,
"stddev": 0.13981069356688158,
"median": 1.8081198073,
"user": 1.4276387600000002,
"system": 1.5850617999999996,
"min": 1.5479136188,
"max": 1.9650750898,
"times": [
1.6613482688,
1.9650750898,
1.6067344928,
1.7156108268,
1.8058745688,
1.8535914458,
1.5479136188,
1.9281423847999999,
1.8103650458,
1.8832315788
]
},
{
"command": "pnpr@main",
"mean": 1.7620277509000002,
"stddev": 0.13867090135830157,
"median": 1.7968100613,
"user": 1.51792596,
"system": 1.6339261999999999,
"min": 1.5324448848,
"max": 1.9511010128,
"times": [
1.5844731838,
1.7753179528,
1.5324448848,
1.7257428838,
1.8717949708000001,
1.9511010128,
1.8257395537999999,
1.6406922968,
1.8183021698000001,
1.8946685998
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.51809134224,
"stddev": 0.03626227836338616,
"median": 0.50807519794,
"user": 0.69387794,
"system": 0.8284805800000001,
"min": 0.48266687594,
"max": 0.60680071894,
"times": [
0.5014911159400001,
0.50150296894,
0.48674819494,
0.51510622794,
0.49759070694,
0.51464742694,
0.53910631294,
0.48266687594,
0.60680071894,
0.53525287294
]
},
{
"command": "pacquet@main",
"mean": 0.47426759803999996,
"stddev": 0.027287495574267785,
"median": 0.47516439444,
"user": 0.65084914,
"system": 0.75532728,
"min": 0.43333006394,
"max": 0.51009522294,
"times": [
0.48168992994000004,
0.45685779194000004,
0.46863885894,
0.43333006394,
0.45267261894,
0.51009522294,
0.50274106494,
0.49559447494000003,
0.44231269194,
0.49874326194
]
},
{
"command": "pnpr@HEAD",
"mean": 0.4104891147400001,
"stddev": 0.040034751777365526,
"median": 0.41928834044,
"user": 0.28571453999999996,
"system": 0.66767098,
"min": 0.34740106694,
"max": 0.45645349094000004,
"times": [
0.45638110594000003,
0.37611247394,
0.34740106694,
0.36739757894,
0.37908353694,
0.43512909494,
0.45645349094000004,
0.42091562794000004,
0.41766105294,
0.44835611794
]
},
{
"command": "pnpr@main",
"mean": 0.39174591714,
"stddev": 0.029352284932407362,
"median": 0.38245351444000003,
"user": 0.2831941399999999,
"system": 0.63859078,
"min": 0.35983327694,
"max": 0.42722466194000003,
"times": [
0.38627605194000003,
0.36384116794,
0.37863097694000003,
0.41899001794,
0.42541407094,
0.36816059294000003,
0.36253994294,
0.35983327694,
0.42654841094,
0.42722466194000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.99219339626,
"stddev": 0.07978667627623161,
"median": 2.00858744886,
"user": 1.1863334,
"system": 1.0249621999999998,
"min": 1.8730385523600002,
"max": 2.09035843836,
"times": [
2.0492861753600002,
1.98465472536,
2.0841452243600003,
2.04025100736,
1.95952808436,
2.09035843836,
2.03252017236,
1.88004263336,
1.8730385523600002,
1.92810894936
]
},
{
"command": "pacquet@main",
"mean": 2.0504319162600004,
"stddev": 0.25386437329864264,
"median": 1.96150395586,
"user": 1.3137428,
"system": 1.090341,
"min": 1.86399006136,
"max": 2.67769574336,
"times": [
2.30713715836,
1.99893403536,
1.89102194236,
1.86399006136,
1.9095582323600002,
2.00908912636,
2.67769574336,
1.92407387636,
1.9141258043600002,
2.00869318236
]
},
{
"command": "pnpr@HEAD",
"mean": 0.39760336595999995,
"stddev": 0.04908867061730417,
"median": 0.38082404336,
"user": 0.26540480000000005,
"system": 0.631501,
"min": 0.33518183836000004,
"max": 0.47412540836000006,
"times": [
0.37671241336,
0.38493567336,
0.35416219136000004,
0.33518183836000004,
0.36790144836,
0.44955280636,
0.45947281536,
0.35685072336,
0.41713834136,
0.47412540836000006
]
},
{
"command": "pnpr@main",
"mean": 0.42739827106000006,
"stddev": 0.07533772006064492,
"median": 0.41808291586,
"user": 0.2944242,
"system": 0.6841234,
"min": 0.33568502436000003,
"max": 0.5515987963600001,
"times": [
0.37528732436,
0.44914662336000005,
0.37342056736,
0.39121937936,
0.33568502436000003,
0.34762748236,
0.53313831036,
0.5515987963600001,
0.47191275036,
0.44494645236
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.21957537732545457,
"stddev": 0.022188880568866153,
"median": 0.21131384478,
"user": 0.20122772181818183,
"system": 0.0849477909090909,
"min": 0.19759000878000002,
"max": 0.27043010178000004,
"times": [
0.24653751878000002,
0.21094047478,
0.21878567378000002,
0.20284500278,
0.27043010178000004,
0.21131384478,
0.22397437378,
0.19759000878000002,
0.20220005178,
0.20218893878000002,
0.22852316078
]
},
{
"command": "pacquet@main",
"mean": 0.24230496942285715,
"stddev": 0.02467489357165706,
"median": 0.23651022278,
"user": 0.22356696857142858,
"system": 0.09619255714285714,
"min": 0.20702922478000002,
"max": 0.29846676178000003,
"times": [
0.20702922478000002,
0.25025465378,
0.22772031078000002,
0.23342680478000002,
0.25734453478,
0.28298989178,
0.23778677578000001,
0.23523366978000002,
0.22184398978,
0.23398892978000002,
0.23968798878,
0.29846676178000003,
0.21664657378000002,
0.24984946178
]
},
{
"command": "pnpr@HEAD",
"mean": 0.11739883017285717,
"stddev": 0.026738174679090673,
"median": 0.10889328978000001,
"user": 0.03633186142857143,
"system": 0.01981573571428571,
"min": 0.09198847678000001,
"max": 0.20870239878000002,
"times": [
0.10014764778,
0.09198847678000001,
0.09732971378000001,
0.10957069378,
0.11594692378,
0.10956731678000001,
0.10273244378,
0.10844131078000001,
0.09861109078000001,
0.12272949778,
0.10556330278,
0.12402896978000001,
0.10800233678,
0.12002515678,
0.10384726878,
0.10934526878,
0.11902282478000001,
0.09664687978,
0.10378135478,
0.18506637678,
0.20870239878000002,
0.16416768878000002,
0.13332165078,
0.12078049578000001,
0.10178304978000001,
0.10510171678,
0.10179232778000001,
0.11912306078000001
]
},
{
"command": "pnpr@main",
"mean": 0.10479983794,
"stddev": 0.01043000785883845,
"median": 0.10373662178000001,
"user": 0.03099774,
"system": 0.01432118,
"min": 0.09001354578000001,
"max": 0.13107254478,
"times": [
0.11241190178,
0.09317592778,
0.10876464878,
0.10082468078000001,
0.11571848478,
0.12015596278,
0.10808807678,
0.09500678778,
0.09442554578000001,
0.09971562578000001,
0.13107254478,
0.10527564378000001,
0.09001354578000001,
0.09384902278,
0.10015277878,
0.09246219678,
0.10373662178000001,
0.10688624978000001,
0.11196910078000001,
0.10083098178000001,
0.11795627878,
0.09494798778,
0.09583803078,
0.11031006278000001,
0.11640725878000001
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.0523123308444444,
"stddev": 0.20388537340175295,
"median": 0.9840092924000001,
"user": 0.9824999577777778,
"system": 0.18973443333333334,
"min": 0.8041611034,
"max": 1.3938376044,
"times": [
0.9338506464,
1.3938376044,
1.1698519534,
0.8932502684000001,
0.9840092924000001,
1.2557116494,
0.8555820324000001,
0.8041611034,
1.1805564274
]
},
{
"command": "pacquet@main",
"mean": 1.1935793518444444,
"stddev": 0.405818248342149,
"median": 1.0343111974,
"user": 1.1351786244444444,
"system": 0.18649354444444446,
"min": 0.7883741314,
"max": 2.1532370473999998,
"times": [
1.2602646554,
1.3656489594,
1.2549377054,
0.9501333004000001,
0.9050577154,
1.0302494544,
2.1532370473999998,
0.7883741314,
1.0343111974
]
},
{
"command": "pnpm@HEAD",
"mean": 4.0455086514000005,
"stddev": 0.5481395815616157,
"median": 4.0323470334,
"user": 6.123863180000001,
"system": 0.3687441,
"min": 3.3124999373999997,
"max": 5.1403373044,
"times": [
5.1403373044,
4.4930947614,
4.2865209164,
3.7364944274,
4.0323470334,
4.1033190984,
3.6783622294,
3.6266021543999996,
3.3124999373999997
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.710818376259999,
"stddev": 0.1368115809958842,
"median": 4.68175406576,
"user": 2.4164696,
"system": 1.8046389599999997,
"min": 4.55199271276,
"max": 4.93116179776,
"times": [
4.67279456576,
4.93116179776,
4.85895630676,
4.88077681676,
4.61604537676,
4.56262265676,
4.55199271276,
4.69071356576,
4.60842205276,
4.7346979107600005
]
},
{
"command": "pacquet@main",
"mean": 4.92769813396,
"stddev": 0.19385310820659243,
"median": 4.95713811176,
"user": 2.5149599999999994,
"system": 1.8769476600000001,
"min": 4.56090886776,
"max": 5.24826701976,
"times": [
4.87996678476,
4.80857384976,
4.56090886776,
4.95321141876,
4.96106480476,
4.73369868276,
5.07537845476,
5.06752148276,
5.24826701976,
4.98838997376
]
},
{
"command": "pnpr@HEAD",
"mean": 3.8637120415600004,
"stddev": 0.1464157171809337,
"median": 3.86244686676,
"user": 2.0257687,
"system": 1.9692079599999996,
"min": 3.66377043576,
"max": 4.15078410576,
"times": [
3.96284593776,
3.94372797176,
3.78616470976,
3.92797356776,
4.15078410576,
3.66377043576,
3.80191457376,
3.91123516376,
3.8136585697600003,
3.6750453797600002
]
},
{
"command": "pnpr@main",
"mean": 3.7246933450600004,
"stddev": 0.1136392329129636,
"median": 3.6868070187599997,
"user": 1.7855471,
"system": 1.68157046,
"min": 3.61708905876,
"max": 3.99612005476,
"times": [
3.7541798227600003,
3.78966434276,
3.99612005476,
3.65138791276,
3.61708905876,
3.77783269876,
3.71541655076,
3.6440179817600002,
3.65819748676,
3.64302754076
]
}
]
} |
Picks up the store-index helper sharing (#13647) and the headless-install bin shim for publicly hoisted workspace packages (#13644), which moves the linking and materialization-plan modules from `package-manager` into `deps-restorer`. Neither touches the mtime helpers or the workspace-state clock seam this branch changes, so the merge is clean.
Summary
Ten call sites repeated the same store-index setup and teardown. None of it is install logic — it is how any caller opens the store index and closes its writer — so it moves to
pacquet-store-dir, which already owns those types.frozenStorebranch →shared_immutable_in/shared_readonly_inStoreIndex::shared_forspawn_blocking+ warn on join failureStoreIndex::open_sharedfrozenStorebranch →spawn/spawn_disabledStoreIndexWriter::spawn_formatch writer_task.await, warn both arms)StoreIndexWriter::drainCallers:
create_virtual_store,install_frozen_lockfile,install_with_fresh_lockfile,patch,tarball_prefetch,dedupe. Two local wrappers that existed only to hold a copy —open_store_index_for_patchandresolver_setup::drain_store_index_writer— are gone.Net −132 / +103, and the duplicated blocks drop to zero outside
store-dir.Design notes
frozen_store: bool, not&Config.store-dirsits below the config crate, and taking a bool keeps it that way rather than inverting the dependency for one field.Degradation policy is now stated once.
open_sharedreturnsNoneon a join failure because every lookup then simply misses — which callers already handle for the empty-store case — anddrainwarns rather than propagating because by that point the rows describe work already on disk, so a missed index write only costs a re-fetch next install. Both rationales previously existed as comments in several copies, with the risk of one copy drifting.One observable change
The
warn!target moves from whichever caller copied the block —pacquet::install,pacquet::patch,pacquet::pnpr— topacquet::store_index, which names the subsystem the event is about rather than whoever happened to trigger it. ARUST_LOGfilter aimed at the old targets will no longer match these two lines.These are
tracingdiagnostics, not reporter events, so nothing parses them and no changeset is needed. Flagging it because it is the only thing in this PR a user could notice.Verification
pacquet-store-dir+pacquet-deps-restorer+pacquet-package-manager— 960 passed.pacquet-clisuite — 2418 passed.cargo clippy --workspace --all-targets -- -D warnings;cargo docwithRUSTDOCFLAGS=-D warnings --document-private-items;cargo dylint --all— all clean.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
Refactor