Repository navigation
fix(lockfile): match pnpm's runtime dependency lockfile format - #12277
Conversation
A `runtime:` dependency (`node@runtime:<ver>`, a `Variations` resolution)
diverged from pnpm's `pnpm-lock.yaml` in three ways. Reconcile all three
toward pnpm so the runtime entry round-trips byte-for-byte:
- The importer recorded `node@runtime:<ver>` instead of the prefix-stripped
`runtime:<ver>`. `real_name` returned `None` for `Variations` resolutions
(the name lives only in the fetched manifest), so `importer_dep_version`
could not strip the `node@` prefix. Read the manifest name for
`Variations`, matching the existing http-tarball path and pnpm's
`depPathToRef`.
- Each variant's `bin` was a bare string (`bin/node`) rather than pnpm's
named map (`{ node: bin/node }`). `bin_spec_for_platform` now returns the
`BinarySpec::Map` form.
- The `packages:` entry omitted `version: <ver>`. pnpm's
`toLockfileDependency` emits it whenever the depPath carries a `:`, the
manifest declares a version, and the resolution isn't a directory. Add a
`version` field to `PackageMetadata` populated under the same condition.
Verified byte-identical against pnpm 11.5.2 on a `node@runtime:26.3.0`
fixture; the whole-monorepo diff is unaffected (no runtime deps there).
Ports the lockfile-shape assertions of
`installing/deps-installer/test/install/nodeRuntime.ts:236-269`.
|
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 selected for processing (20)
📜 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). (9)
🧰 Additional context used📓 Path-based instructions (1)pacquet/**/*.rs📄 CodeRabbit inference engine (pacquet/AGENTS.md)
Files:
🧠 Learnings (7)📚 Learning: 2026-05-20T19:40:55.051ZApplied to files:
📚 Learning: 2026-05-22T00:08:44.646ZApplied to files:
📚 Learning: 2026-05-20T23:07:58.444ZApplied to files:
📚 Learning: 2026-05-24T21:10:50.292ZApplied to files:
📚 Learning: 2026-05-24T21:10:50.292ZApplied to files:
📚 Learning: 2026-06-06T18:58:37.156ZApplied to files:
📚 Learning: 2026-05-20T23:23:40.606ZApplied to files:
🔇 Additional comments (22)
📝 WalkthroughWalkthroughThis PR adds support for recording package versions in pnpm's lockfile for non-registry packages (runtime dependencies) while also changing the node resolver's binary representation from a single value to a named map keyed by ChangesRuntime Binary Specification Format
Package Metadata Version Field and Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related issues
Possibly related PRs
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)
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 |
Micro-Benchmark ResultsLinux |
Integrated-Benchmark Report (Linux)Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 10.03585612822,
"stddev": 0.16201711961200313,
"median": 9.991206822319999,
"user": 3.12621152,
"system": 3.2339257600000004,
"min": 9.85219207682,
"max": 10.367058562819999,
"times": [
10.077132817819999,
10.02009366982,
10.06242290382,
9.85219207682,
10.367058562819999,
9.96231997482,
9.88350878382,
9.93249648482,
9.95496501882,
10.246370988819999
]
},
{
"command": "pacquet@main",
"mean": 10.01863485782,
"stddev": 0.1770847725235578,
"median": 9.95164590132,
"user": 3.12182282,
"system": 3.2358116600000004,
"min": 9.83365772082,
"max": 10.31662810982,
"times": [
9.89278205382,
9.92184573282,
10.30453869782,
10.030238301819999,
9.92966495082,
10.31662810982,
9.84896349382,
9.83365772082,
9.973626851819999,
10.13440266482
]
},
{
"command": "pnpr@HEAD",
"mean": 5.36538390902,
"stddev": 0.05832905708646105,
"median": 5.35334945382,
"user": 2.5754322199999997,
"system": 2.92339986,
"min": 5.3007417418200005,
"max": 5.4766853298200004,
"times": [
5.367331834820001,
5.361472469820001,
5.35548871982,
5.4587571958200005,
5.4766853298200004,
5.32366312182,
5.3007417418200005,
5.311014520820001,
5.34747396782,
5.3512101878200005
]
},
{
"command": "pnpr@main",
"mean": 5.38978304102,
"stddev": 0.06280204282843649,
"median": 5.3993351058200005,
"user": 2.57653052,
"system": 2.90158476,
"min": 5.299364033820001,
"max": 5.5222341128200005,
"times": [
5.299364033820001,
5.3407454768200004,
5.5222341128200005,
5.43526370182,
5.343790690820001,
5.342041191820001,
5.39340789682,
5.40646476782,
5.409256222820001,
5.405262314820001
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.65764736918,
"stddev": 0.00949244877102304,
"median": 0.6576116483800001,
"user": 0.37293696000000004,
"system": 1.3252711799999999,
"min": 0.64478174988,
"max": 0.6790540928800001,
"times": [
0.6591448078800001,
0.6790540928800001,
0.65450572588,
0.66282074388,
0.65844372988,
0.64599159388,
0.64478174988,
0.65512977888,
0.65982190188,
0.65677956688
]
},
{
"command": "pacquet@main",
"mean": 0.68169799238,
"stddev": 0.04354047925481083,
"median": 0.6651722233799999,
"user": 0.39177786000000003,
"system": 1.32831418,
"min": 0.65134680688,
"max": 0.76622532788,
"times": [
0.65473152088,
0.66777804288,
0.76622532788,
0.65326320188,
0.67318747388,
0.65598038688,
0.75965454588,
0.66256640388,
0.65134680688,
0.67224621288
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7763216259799999,
"stddev": 0.0633461689182838,
"median": 0.75651433538,
"user": 0.39042816,
"system": 1.3177053799999998,
"min": 0.73622314388,
"max": 0.95059982688,
"times": [
0.78765637788,
0.73622314388,
0.7619386368800001,
0.73806858188,
0.75938163688,
0.75198497488,
0.95059982688,
0.75364703388,
0.74568014388,
0.77803590288
]
},
{
"command": "pnpr@main",
"mean": 0.7952245605800001,
"stddev": 0.07962998828062343,
"median": 0.7602132043800001,
"user": 0.40832686,
"system": 1.33983408,
"min": 0.75039630688,
"max": 1.00922827788,
"times": [
0.77301436388,
0.75039630688,
0.82629333588,
0.75619586588,
0.75703020688,
0.75152137488,
1.00922827788,
0.76339620188,
0.75449476188,
0.81067490988
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 9.241336027280003,
"stddev": 0.03585802219375344,
"median": 9.23805475328,
"user": 3.6724097799999997,
"system": 3.2656121,
"min": 9.20643568728,
"max": 9.32350872328,
"times": [
9.24193655628,
9.23496257328,
9.32350872328,
9.24114693328,
9.27454318328,
9.20689694628,
9.20643568728,
9.22528925128,
9.210270898280001,
9.24836952028
]
},
{
"command": "pacquet@main",
"mean": 9.247822922680001,
"stddev": 0.049464866662033896,
"median": 9.23895826228,
"user": 3.65366968,
"system": 3.2607392999999996,
"min": 9.18647358528,
"max": 9.33174111628,
"times": [
9.20362633828,
9.277452374280001,
9.24876985428,
9.296527192280001,
9.22914667028,
9.33174111628,
9.29306830928,
9.199877390280001,
9.18647358528,
9.211546396280001
]
},
{
"command": "pnpr@HEAD",
"mean": 5.12550227038,
"stddev": 0.10012715756012498,
"median": 5.10919047628,
"user": 2.387242079999999,
"system": 2.7994607,
"min": 5.01006773728,
"max": 5.378438941280001,
"times": [
5.1350304082800005,
5.076299483280001,
5.01006773728,
5.0700783102800004,
5.13932251028,
5.08746569628,
5.13091525628,
5.06175096028,
5.378438941280001,
5.16565340028
]
},
{
"command": "pnpr@main",
"mean": 5.219331598479999,
"stddev": 0.20537551815722768,
"median": 5.10260633028,
"user": 2.3637888799999995,
"system": 2.7863534,
"min": 5.06338320228,
"max": 5.56045440728,
"times": [
5.12730694728,
5.06750560528,
5.17772082028,
5.46664547728,
5.0777240722800006,
5.07790571328,
5.50551955728,
5.06338320228,
5.0691501822800005,
5.56045440728
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3874152157999997,
"stddev": 0.005300526624597984,
"median": 1.3870931445999999,
"user": 1.5176676400000002,
"system": 1.8102484799999998,
"min": 1.3795262461,
"max": 1.3978396321,
"times": [
1.3919079741,
1.3795262461,
1.3978396321,
1.3843338181,
1.3896902120999999,
1.3871936680999999,
1.3869926210999999,
1.3904389921,
1.3825073761,
1.3837216180999998
]
},
{
"command": "pacquet@main",
"mean": 1.4329656436999998,
"stddev": 0.011818683848778907,
"median": 1.4344778021,
"user": 1.5672379399999998,
"system": 1.85493438,
"min": 1.4109599781,
"max": 1.4462416131,
"times": [
1.4451451211,
1.4318148470999998,
1.4213193521,
1.4214558580999999,
1.4351777761,
1.4445558411,
1.4392082221,
1.4109599781,
1.4337778281,
1.4462416131
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6721611371,
"stddev": 0.01007616092200756,
"median": 0.6681495426,
"user": 0.33825324,
"system": 1.2665025799999996,
"min": 0.6561459921,
"max": 0.6923814631,
"times": [
0.6923814631,
0.6670546271000001,
0.6685257931,
0.6667230061,
0.6753800311,
0.6561459921,
0.6673825861,
0.6797097661,
0.6677732921,
0.6805348141
]
},
{
"command": "pnpr@main",
"mean": 0.6889348451,
"stddev": 0.04312342020768817,
"median": 0.6726631911000001,
"user": 0.35031034000000005,
"system": 1.27189688,
"min": 0.6614997821,
"max": 0.8039108711,
"times": [
0.6937551991,
0.6850648501000001,
0.6614997821,
0.8039108711,
0.6728420991,
0.6724842831000001,
0.6666015461,
0.7074081041000001,
0.6630764641000001,
0.6627052521000001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.98941566436,
"stddev": 0.02155960339894522,
"median": 4.98216660686,
"user": 1.6962412399999998,
"system": 1.9723600599999997,
"min": 4.96782185536,
"max": 5.0390445573600005,
"times": [
4.96782185536,
4.97543331736,
4.98143148036,
5.0390445573600005,
4.98290173336,
5.0100865713600005,
4.99437094636,
4.99288562836,
4.98133643736,
4.96884411636
]
},
{
"command": "pacquet@main",
"mean": 5.03052162546,
"stddev": 0.031214316257665038,
"median": 5.03053458586,
"user": 1.7456494399999998,
"system": 2.0199338599999996,
"min": 4.98122582436,
"max": 5.08976060036,
"times": [
5.02844149936,
5.08976060036,
5.0478952253600005,
5.03262767236,
5.01922059136,
4.99097396636,
4.98122582436,
5.04051570836,
5.01944268736,
5.05511247936
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6735912686600001,
"stddev": 0.013202074336060743,
"median": 0.6701260938600001,
"user": 0.33372073999999996,
"system": 1.26845966,
"min": 0.65989812936,
"max": 0.7047692673600001,
"times": [
0.7047692673600001,
0.67672008236,
0.6663412333600001,
0.67313988436,
0.6626623203600001,
0.65989812936,
0.6725140353600001,
0.6677381523600001,
0.66659301536,
0.68553656636
]
},
{
"command": "pnpr@main",
"mean": 0.6931772192600001,
"stddev": 0.059851256315547184,
"median": 0.6748397023600001,
"user": 0.35137184,
"system": 1.26262696,
"min": 0.6588163333600001,
"max": 0.86136974336,
"times": [
0.69648085136,
0.66948324536,
0.6760757983600001,
0.6741552173600001,
0.67295887336,
0.86136974336,
0.6782038503600001,
0.6687040923600001,
0.6755241873600001,
0.6588163333600001
]
}
]
} |
PR Summary by Qodo
Fix runtime dependency lockfile shape to match pnpm byte-for-byte
🐞 Bug fix🧪 Tests📝 Documentation🕐 20-40 MinutesWalkthroughs
User Description
What
Part of the pacquet ↔ pnpm lockfile-parity effort (#12266). A
runtime:dependency (node@runtime:<ver>, aVariationsresolution) diverged from thepnpm-lock.yamlpnpm produces in three independent ways. This reconciles all three toward pnpm so a runtime entry round-trips byte-for-byte.1. Importer version kept the
node@prefixpacquet recorded the importer dep as
node@runtime:<ver>; pnpm writes the prefix-strippedruntime:<ver>.real_namereturnedNoneforVariationsresolutions (the canonical name lives only in the fetched manifest), soimporter_dep_versioncouldn't strip thenode@prefix. It now reads the manifest name forVariations, matching the existing remote-http-tarball path and pnpm'sdepPathToRef.2. Variant
binwas a bare stringEach variant serialized
bin: bin/node(string) instead of pnpm's named mapbin: { node: bin/node }.bin_spec_for_platformnow returns theBinarySpec::Mapform ({ node: node.exe }on win32).3. Missing
versionfield on the package entryThe
packages:entry omittedversion: <ver>. pnpm'stoLockfileDependencyemits it whenever the depPath carries a:, the manifest declares a version, and the resolution isn't a directory. Aversionfield was added toPackageMetadata, populated under the same condition (and ordered by the existingsortLockfileKeysport, so it lands afterresolution).Verification
{ "node": "runtime:26.3.0" }fixture (diffis empty).pacquet install --lockfile-onlydiff is unaffected (the monorepo has no runtime deps); the only remaining gaps there staypnpmfileChecksum/patchedDependencies.dependencies_graph_to_lockfile::tests::runtime_dependency_strips_importer_prefix_and_records_package_versionnode_resolver::tests::bin_spec_is_a_named_mappacquet-lockfile(193) + affectedpacquet-package-managermodule suites (173) pass;fmt/clippy/cargo doc -D warnings/dylintclean.Test porting
Ports the lockfile-shape assertions of
installing/deps-installer/test/install/nodeRuntime.ts:236-269(importerversion: runtime:<ver>,packages[node@runtime:<ver>].version,variants[].resolution.bin: { node }). The full download-and-reinstall integration tests remain unported (they fetch real runtime artifacts); tracked inpacquet/plans/TEST_PORTING.md.Written by an agent (Claude Code, claude-opus-4-8).
AI Description
• Align runtime: dependency importer refs with pnpm by stripping the name@ prefix • Serialize runtime variant bin as a named map ({ node: … }) instead of a string • Emit packages[*].version for non-registry, non-directory entries when manifests declare itDiagram
graph TD PM["package-manager"] --> DG2LF["graph→lockfile"] --> LF[("Lockfile model")] --> YAML["YAML output"] NR["Node runtime resolver"] --> DG2LF T[["Regression tests"]] --> NR T --> DG2LF subgraph Legend direction LR _mod["Module"] ~~~ _db[("Data model")] ~~~ _test[["Tests"]] endHigh-Level Assessment
The following are alternative approaches to this PR:
1. Post-process lockfile output for runtime entries
2. Introduce a shared `depPathToRef`-style utility for all non-registry deps
Recommendation: Keep the PR’s approach: encode pnpm parity where the data is produced (resolver/graph→lockfile) and where the schema is modeled (PackageMetadata). It minimizes special-casing in serialization while matching pnpm’s documented conditions (manifest-derived names for Variations, named-bin map, conditional
versionemission). A broaderdepPathToRefutility is worth considering later when expanding parity beyond runtime/http-tarball cases.File Changes
Enhancement (1)
Bug fix (2)
Refactor (2)
Tests (14)
Documentation (1)
Summary by CodeRabbit