feat(package-manager): write .modules.yaml after install#407
Conversation
Mirror upstream pnpm's `writeModulesManifest` call at the end of a successful install (deps-installer/src/install/index.ts L1608-L1630 on commit 086c5e91e8) so `node_modules/.modules.yaml` is persisted with the resolved layout: `layoutVersion`, `nodeLinker`, the `included` set derived from the dispatched dependency groups, the store and virtual-store directories, the `default` registry, and the `pacquet@<version>` package-manager identifier. This is the contract a follow-up install (or another tool) keys off to detect a layout change and prune accordingly. Adds a focused test that runs an empty-snapshot frozen install and asserts the on-disk manifest fields, mirroring upstream's `installing/modules-yaml/test/index.ts` style.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (2)📚 Learning: 2026-05-01T10:01:33.766ZApplied to files:
📚 Learning: 2026-05-07T23:19:08.272ZApplied to files:
🔇 Additional comments (8)
📝 WalkthroughWalkthroughThis PR adds ChangesModules Manifest Persistence
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Address KSXGitHub's review on #407: thread the `modules_dir` path through `pipe_as_ref` instead of the bare function call, matching the pipe-trait style used in `crates/modules-yaml/tests/index.rs`.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #407 +/- ##
==========================================
+ Coverage 82.34% 82.49% +0.14%
==========================================
Files 65 65
Lines 3705 3741 +36
==========================================
+ Hits 3051 3086 +35
- Misses 654 655 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
Pull request overview
This PR mirrors pnpm’s post-install behavior by persisting node_modules/.modules.yaml at the end of a successful install, so subsequent installs/tools can detect layout changes and prune accordingly.
Changes:
- Write
node_modules/.modules.yamlafterimporting_doneusingpacquet-modules-yaml::write_modules_manifest. - Populate the manifest with layout/linker metadata, included dependency-group flags, registry/store paths, and
pacquet@<version>. - Add an install test asserting key
.modules.yamlfields are persisted on disk.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/package-manager/src/install.rs | Writes .modules.yaml on successful install; adds manifest assembly helpers and error plumbing. |
| crates/package-manager/src/install/tests.rs | Adds a focused integration test verifying .modules.yaml contents after a frozen install. |
| crates/package-manager/Cargo.toml | Adds pacquet-modules-yaml and httpdate dependencies needed for manifest writing. |
| Cargo.lock | Updates lockfile for the added dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| hoist_pattern: Some(config.hoist_pattern.clone()), | ||
| included, | ||
| layout_version: Some(LayoutVersion), | ||
| node_linker: Some(map_node_linker(&config.node_linker)), |
There was a problem hiding this comment.
it is ok as it is. No need to change.
Integrated-Benchmark Report (Linux)Scenario: Frozen Lockfile
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4893071277199996,
"stddev": 0.03778976077576028,
"median": 2.48801144742,
"user": 2.3753783200000003,
"system": 3.36489756,
"min": 2.42810304392,
"max": 2.5575729479200002,
"times": [
2.52316059892,
2.46451462392,
2.47858697992,
2.42810304392,
2.49743591492,
2.51086128192,
2.5575729479200002,
2.5102452679200002,
2.45727061492,
2.46532000292
]
},
{
"command": "pacquet@main",
"mean": 2.4111535662200003,
"stddev": 0.06379447916434569,
"median": 2.42247320542,
"user": 2.39112862,
"system": 3.38241746,
"min": 2.31181046692,
"max": 2.47961142292,
"times": [
2.46517937092,
2.3309840799200003,
2.47673802092,
2.4233362459200003,
2.34722215092,
2.47961142292,
2.38542668492,
2.42161016492,
2.46961705392,
2.31181046692
]
},
{
"command": "pnpm",
"mean": 6.22328802892,
"stddev": 0.09818946555315908,
"median": 6.18564593392,
"user": 9.01279572,
"system": 4.48764126,
"min": 6.10132038692,
"max": 6.43915123092,
"times": [
6.19051080792,
6.24078210892,
6.16611539092,
6.32172352492,
6.17129887592,
6.10132038692,
6.43915123092,
6.26594780092,
6.15524910192,
6.18078105992
]
}
]
}Scenario: Frozen Lockfile (Hot Cache)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.71147247968,
"stddev": 0.03973354536960486,
"median": 0.69915582528,
"user": 0.24434402,
"system": 1.38205258,
"min": 0.68469674478,
"max": 0.81950639578,
"times": [
0.81950639578,
0.70084386078,
0.72952994278,
0.70095215778,
0.68469674478,
0.69641861878,
0.69270433278,
0.69176109278,
0.69909597378,
0.69921567678
]
},
{
"command": "pacquet@main",
"mean": 0.77440743028,
"stddev": 0.08566570037403819,
"median": 0.76706276728,
"user": 0.24646102,
"system": 1.3750902800000002,
"min": 0.67764001278,
"max": 0.94593922578,
"times": [
0.94593922578,
0.69876728778,
0.79311861478,
0.82704566378,
0.71563719278,
0.67764001278,
0.83814049978,
0.74100691978,
0.82010955278,
0.68666933278
]
},
{
"command": "pnpm",
"mean": 2.59766507688,
"stddev": 0.08264555105272708,
"median": 2.58873502628,
"user": 3.1241152199999997,
"system": 2.26331228,
"min": 2.47722099178,
"max": 2.80528396978,
"times": [
2.61349385178,
2.60148889078,
2.55241293378,
2.60199523578,
2.47722099178,
2.58363174378,
2.59383830878,
2.56462109378,
2.58266374878,
2.80528396978
]
}
]
} |
Mirror upstream pnpm's
writeModulesManifestcall at the end of a successful install (deps-installer/src/install/index.ts L1608-L1630 on commit 086c5e91e8) sonode_modules/.modules.yamlis persisted with the resolved layout:layoutVersion,nodeLinker, theincludedset derived from the dispatched dependency groups, the store and virtual-store directories, thedefaultregistry, and thepacquet@<version>package-manager identifier. This is the contract a follow-up install (or another tool) keys off to detect a layout change and prune accordingly.Adds a focused test that runs an empty-snapshot frozen install and asserts the on-disk manifest fields, mirroring upstream's
installing/modules-yaml/test/index.tsstyle.Summary by CodeRabbit
Release Notes
New Features
Bug Fixes