Repository navigation
Conversation
`resolveDependency` derived `filter_metadata` from `full_metadata`, so a
caller asking for full metadata got a manifest run through `clear_meta` —
reduced to npm's abbreviated version fields. Registry-custom fields were
dropped, which broke Bit's `componentId` lookups ("the package.json of
version X has no componentId field").
The API this replaces, `createClient({ fullMetadata: true })`, leaves
`filterMetadata` unset and keeps the document whole; only the install
path pairs the two flags, where nothing outside the abbreviated set is
read. Untangle them here.
📝 WalkthroughWalkthrough
ChangesFull metadata preservation
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant MockRegistry
participant resolveDependency
participant Resolver
Test->>MockRegistry: Serve packument with componentId
Test->>resolveDependency: Request full metadata
resolveDependency->>Resolver: Resolve dependency
Resolver->>MockRegistry: Fetch packument
MockRegistry-->>Resolver: Return version manifest
Resolver-->>resolveDependency: Preserve custom fields
resolveDependency-->>Test: Return componentId.name
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 |
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13664 +/- ##
=======================================
Coverage 88.08% 88.08%
=======================================
Files 608 608
Lines 99032 99033 +1
=======================================
+ Hits 87231 87232 +1
Misses 11801 11801 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR Summary by QodoFix napi resolveDependency(fullMetadata) to preserve registry-custom fields
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Confidence Score: 5/5The PR appears safe to merge, with the resolver flags, cache namespaces, and regression coverage aligned with the intended full-metadata contract. The changed NAPI paths consistently request unfiltered full metadata, filtered and unfiltered documents remain isolated in distinct cache slots, and the test exercises the affected registry resolution behavior without introducing a production dependency. Reviews (1): Last reviewed commit: "fix(napi): keep registry-custom fields i..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/napi/src/resolve/tests.rs (1)
120-152: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for the named-registry resolver.
This test configures only the
defaultregistry, so it exercisesNpmResolverbut notNamedRegistryResolverat Line 224. Add a named-registry case that assertsmanifest["componentId"]["name"]remains"button".🤖 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/napi/src/resolve/tests.rs` around lines 120 - 152, Add a separate test case for the named-registry resolution path using the visible `full_metadata_keeps_registry_custom_version_fields` setup as a model, but configure and resolve through a named registry so `NamedRegistryResolver` is exercised. Assert that the returned manifest’s `componentId.name` remains `"button"`, and retain the existing default-registry coverage 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/napi/src/resolve/tests.rs`:
- Around line 120-152: Add a separate test case for the named-registry
resolution path using the visible
`full_metadata_keeps_registry_custom_version_fields` setup as a model, but
configure and resolve through a named registry so `NamedRegistryResolver` is
exercised. Assert that the returned manifest’s `componentId.name` remains
`"button"`, and retain the existing default-registry coverage unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 407d5faa-3516-4b77-a690-76e7fb31549f
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (4)
.changeset/napi-resolve-full-metadata.mdpnpm/crates/napi/Cargo.tomlpnpm/crates/napi/src/resolve.rspnpm/crates/napi/src/resolve/tests.rs
Code Review by Qodo
1. Historical createClient reference comment
|
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.6408072041600006,
"stddev": 0.17350133394401646,
"median": 2.64695133826,
"user": 1.7779978799999996,
"system": 1.4484860999999998,
"min": 2.40967194226,
"max": 2.8951946792600003,
"times": [
2.8951946792600003,
2.4297826812600003,
2.40967194226,
2.80104917926,
2.68336854226,
2.65596175326,
2.60480965126,
2.63794092326,
2.84413912826,
2.44615356126
]
},
{
"command": "pacquet@main",
"mean": 2.6547418367600004,
"stddev": 0.15560162033116073,
"median": 2.69703129176,
"user": 1.80585958,
"system": 1.4059899,
"min": 2.42097119726,
"max": 2.8461508012600003,
"times": [
2.80334275326,
2.69374672126,
2.81120032026,
2.70031586226,
2.8461508012600003,
2.42777022726,
2.72899353726,
2.57335727826,
2.42097119726,
2.5415696692600003
]
},
{
"command": "pnpr@HEAD",
"mean": 1.52397833306,
"stddev": 0.1693534455486789,
"median": 1.4404467357600002,
"user": 1.2710717800000002,
"system": 1.266452,
"min": 1.37209889826,
"max": 1.8575865012600001,
"times": [
1.37209889826,
1.45717128226,
1.63490324526,
1.42027868626,
1.42372218926,
1.74889650226,
1.3954417432600001,
1.5425823742600002,
1.38710190826,
1.8575865012600001
]
},
{
"command": "pnpr@main",
"mean": 1.5753809364600002,
"stddev": 0.15752596440539818,
"median": 1.59667171576,
"user": 1.2626523800000002,
"system": 1.3084241,
"min": 1.3828934722600001,
"max": 1.8129200562600003,
"times": [
1.4514022822600001,
1.70422028126,
1.3975363232600002,
1.8129200562600003,
1.5387461202600001,
1.4139583082600002,
1.7314131972600002,
1.65459731126,
1.3828934722600001,
1.6661220122600002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.28613697386000003,
"stddev": 0.013040725045268391,
"median": 0.28475887716000003,
"user": 0.23943995999999998,
"system": 0.5587359199999999,
"min": 0.26748015066,
"max": 0.31216528066000004,
"times": [
0.31216528066000004,
0.29534365066,
0.28886633766,
0.28240501466000006,
0.29527147466000003,
0.26748015066,
0.28336501366000005,
0.28615274066,
0.28093695566000004,
0.26938311966000006
]
},
{
"command": "pacquet@main",
"mean": 0.28915579216000004,
"stddev": 0.0069884032956233424,
"median": 0.28592666966,
"user": 0.22667436,
"system": 0.5819749200000001,
"min": 0.28448913366000006,
"max": 0.30641737166000005,
"times": [
0.28971885566000005,
0.28492817166000006,
0.28912343166000004,
0.29558290166000006,
0.28616750866,
0.28448913366000006,
0.28568583066000003,
0.28462123266000006,
0.28482348366000004,
0.30641737166000005
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29754690376,
"stddev": 0.016721060184335782,
"median": 0.29185035916,
"user": 0.25133486,
"system": 0.5491571199999999,
"min": 0.27947079166000005,
"max": 0.32809398566000003,
"times": [
0.32809398566000003,
0.30617065666000004,
0.28960157466,
0.31339036966000006,
0.28151902366000003,
0.29409914366000006,
0.27947079166000005,
0.28155046266000006,
0.28809191766000003,
0.31348111166000003
]
},
{
"command": "pnpr@main",
"mean": 0.28682232986,
"stddev": 0.013304341585215549,
"median": 0.28883579916,
"user": 0.22089346,
"system": 0.55397232,
"min": 0.26760352466000004,
"max": 0.30079893866,
"times": [
0.30021256166000004,
0.29197205266000004,
0.28569954566000005,
0.29907901366000006,
0.27525706466000005,
0.26760352466000004,
0.27769418066,
0.29990263766,
0.27000377866,
0.30079893866
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6141057291999994,
"stddev": 0.018426747391926714,
"median": 2.6141308181999996,
"user": 1.5427199999999996,
"system": 1.2676930599999998,
"min": 2.5834802986999996,
"max": 2.6377822307,
"times": [
2.6119125506999996,
2.6377822307,
2.6117622676999996,
2.6163490856999996,
2.6350716817,
2.6310098466999996,
2.5999967877,
2.5908416637,
2.5834802986999996,
2.6228508786999996
]
},
{
"command": "pacquet@main",
"mean": 2.5905349838999996,
"stddev": 0.013262926346156887,
"median": 2.5890154261999996,
"user": 1.4458655,
"system": 1.3021355600000002,
"min": 2.5726507787,
"max": 2.6062830047,
"times": [
2.5748284336999996,
2.6032210336999997,
2.6062830047,
2.5908737836999998,
2.5763078817,
2.6036176416999997,
2.6046644626999997,
2.5726507787,
2.5857457497,
2.5871570687
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5760249220000002,
"stddev": 0.17217568387355883,
"median": 1.4844894592000002,
"user": 1.0258828,
"system": 1.10083646,
"min": 1.4282515837,
"max": 1.8566389827,
"times": [
1.5178036507000001,
1.6540647677000002,
1.8497256037,
1.4383926867,
1.8566389827,
1.4282515837,
1.4434386857000001,
1.4511752677,
1.6812678267,
1.4394901647
]
},
{
"command": "pnpr@main",
"mean": 1.5906926728000002,
"stddev": 0.13890737575228423,
"median": 1.5220041267,
"user": 1.0792433999999997,
"system": 1.19737896,
"min": 1.4348073997000002,
"max": 1.8050677377000002,
"times": [
1.5104383387,
1.7353704617,
1.7837436397000002,
1.4904480037,
1.5117253046999999,
1.6409475146999999,
1.8050677377000002,
1.4348073997000002,
1.5322829487,
1.4620953787000002
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4329735385200001,
"stddev": 0.015999730507888905,
"median": 0.43539666062000004,
"user": 0.5675930200000001,
"system": 0.7393157,
"min": 0.39613859712000005,
"max": 0.45471057512,
"times": [
0.43437994012000003,
0.42738096812000004,
0.44162069612000004,
0.42927893512000004,
0.45471057512,
0.44852706212000004,
0.43641338112,
0.43728796912,
0.39613859712000005,
0.42399726112
]
},
{
"command": "pacquet@main",
"mean": 0.4245019394200001,
"stddev": 0.026145428075361042,
"median": 0.42591939862000006,
"user": 0.5793767200000001,
"system": 0.7235547,
"min": 0.38655858212000005,
"max": 0.47062664212000005,
"times": [
0.43748072312,
0.47062664212000005,
0.44619196112000004,
0.42436292012000004,
0.41570997212000005,
0.44265198912000003,
0.42747587712,
0.39417881412,
0.38655858212000005,
0.39978191312
]
},
{
"command": "pnpr@HEAD",
"mean": 0.34595071152,
"stddev": 0.018681675342860294,
"median": 0.34450286012,
"user": 0.23368751999999998,
"system": 0.5976269999999999,
"min": 0.32193303012,
"max": 0.37903895712,
"times": [
0.35503277212,
0.32374198712,
0.32193303012,
0.34367997412,
0.34614178212,
0.37195700912,
0.33268472212,
0.33997113512000005,
0.34532574612,
0.37903895712
]
},
{
"command": "pnpr@main",
"mean": 0.36045023882000005,
"stddev": 0.025436359460623986,
"median": 0.35136938262,
"user": 0.24677121999999999,
"system": 0.5998528000000001,
"min": 0.32869620612,
"max": 0.41664057512,
"times": [
0.37585959512,
0.34337838612000005,
0.35495664812,
0.41664057512,
0.34778211712,
0.34769481312,
0.34637616712,
0.35870867112000004,
0.38440920912000004,
0.32869620612
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.8538004474599998,
"stddev": 0.03680341426950998,
"median": 1.86531339616,
"user": 0.9537063800000001,
"system": 0.8796217399999999,
"min": 1.79043553716,
"max": 1.8936674201600001,
"times": [
1.8916880301599999,
1.79043553716,
1.86385318916,
1.82682022216,
1.8936674201600001,
1.86847036116,
1.8461709631599998,
1.88823117516,
1.86677360316,
1.80189397316
]
},
{
"command": "pacquet@main",
"mean": 1.7898137887599996,
"stddev": 0.0386249708252859,
"median": 1.76913534766,
"user": 0.8537689800000001,
"system": 0.8062660399999999,
"min": 1.7466011021599999,
"max": 1.86062644716,
"times": [
1.76188725216,
1.77163650716,
1.76531306916,
1.7466011021599999,
1.76663418816,
1.76363341316,
1.8430746171599999,
1.86062644716,
1.81167477816,
1.80705651316
]
},
{
"command": "pnpr@HEAD",
"mean": 0.36218457946000004,
"stddev": 0.04207453754384006,
"median": 0.34651012616,
"user": 0.25776918000000004,
"system": 0.5747542400000001,
"min": 0.32323134316,
"max": 0.43779226716,
"times": [
0.34886155816000003,
0.43779226716,
0.42668189716000005,
0.32437315516000004,
0.37847789716,
0.34415869416,
0.37832413716,
0.33159668816000004,
0.32834815716000004,
0.32323134316
]
},
{
"command": "pnpr@main",
"mean": 0.34090006116000005,
"stddev": 0.010026939228128234,
"median": 0.33920140116,
"user": 0.23561717999999998,
"system": 0.5557350400000001,
"min": 0.32869494016,
"max": 0.36168843316000004,
"times": [
0.35431818316,
0.33347464816,
0.34031963916,
0.33913303216,
0.32869494016,
0.33503989816,
0.34282453016000003,
0.33926977016000004,
0.33423753716000004,
0.36168843316000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.21563349915846158,
"stddev": 0.015315521064582277,
"median": 0.21839709962,
"user": 0.19523102769230766,
"system": 0.08323231076923075,
"min": 0.19165560862,
"max": 0.24091638162,
"times": [
0.22567645962000002,
0.24091638162,
0.22976456362000003,
0.22191045062,
0.22627156062,
0.20680467062000002,
0.20575147562,
0.19165560862,
0.19569423062000002,
0.20103406462,
0.20701445662,
0.21839709962,
0.23234446662000002
]
},
{
"command": "pacquet@main",
"mean": 0.24137367862000003,
"stddev": 0.03204734819170716,
"median": 0.22207697512000002,
"user": 0.22405182000000004,
"system": 0.08540087999999998,
"min": 0.21055858562000002,
"max": 0.29702934762,
"times": [
0.29702934762,
0.22285217562,
0.25696237361999996,
0.26228565662,
0.21979483362000002,
0.28782403062,
0.21055858562000002,
0.21503016362000002,
0.22009784462,
0.22130177462
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09158688062,
"stddev": 0.0023070262351121058,
"median": 0.09164257262,
"user": 0.022830945806451623,
"system": 0.01105755870967742,
"min": 0.08649009162,
"max": 0.09792265862,
"times": [
0.09151876862000001,
0.09174900262,
0.09145272562000001,
0.09032027062,
0.09341028462,
0.09202172762000001,
0.09041329562,
0.09792265862,
0.09660772962000001,
0.09182394462,
0.08999104062,
0.09365403462,
0.09244815062,
0.08976791962000001,
0.09073741662000001,
0.08808624962,
0.09354904562000001,
0.09183041662000001,
0.09061955462,
0.09496029562000001,
0.08922120962,
0.08849580162000001,
0.09202222762000001,
0.09245711862,
0.09128761362000001,
0.09096411462000001,
0.08649009162,
0.08948531662,
0.09189273362,
0.09164257262,
0.09234996662
]
},
{
"command": "pnpr@main",
"mean": 0.0926465842651613,
"stddev": 0.0024236503830666867,
"median": 0.09196832662000001,
"user": 0.023195300645161288,
"system": 0.01097104516129032,
"min": 0.08801327262000001,
"max": 0.09984166562,
"times": [
0.09141061562000001,
0.09446960162000001,
0.09147099862000001,
0.09118633162,
0.09196832662000001,
0.09097389162000001,
0.09066569162,
0.09468323362,
0.09123850062000001,
0.09092806562000001,
0.09076640162,
0.09084381662,
0.09248304662000001,
0.09222391862000001,
0.09301527962,
0.09157530562,
0.09343377862,
0.09048688462000001,
0.09168478262,
0.09075180462,
0.09343757562,
0.08916451262000001,
0.08801327262000001,
0.09358557462,
0.09446776762,
0.09484883562,
0.09984166562,
0.09462373062000001,
0.09514488362000001,
0.09554504862,
0.09711096862
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.1699223548022222,
"stddev": 0.21169186406440307,
"median": 1.09280835858,
"user": 1.082529582222222,
"system": 0.15724466222222222,
"min": 0.9398772745800001,
"max": 1.52013627358,
"times": [
1.48911736458,
1.09280835858,
1.0034041135799998,
0.9398772745800001,
1.0009284725799998,
1.06149771158,
1.52013627358,
1.25392525958,
1.16760636458
]
},
{
"command": "pacquet@main",
"mean": 1.2579050532466665,
"stddev": 0.25322174380903834,
"median": 1.1968738935799998,
"user": 1.1752139155555554,
"system": 0.1853392177777778,
"min": 1.04927067458,
"max": 1.84352555958,
"times": [
1.05365343958,
1.1968738935799998,
1.0860402625799999,
1.33023869958,
1.04927067458,
1.10694353858,
1.2440635065799999,
1.4105359045799999,
1.84352555958
]
},
{
"command": "pnpm@HEAD",
"mean": 5.560396268691111,
"stddev": 0.32121020647474263,
"median": 5.63716593258,
"user": 8.541637693333334,
"system": 0.4773573288888888,
"min": 4.90659418958,
"max": 6.01135753458,
"times": [
5.7982871005800005,
5.63716593258,
5.72364841358,
5.55328415858,
5.45142490658,
6.01135753458,
4.90659418958,
5.68200389558,
5.2798002865800004
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.96020248466,
"stddev": 0.1366499172858255,
"median": 4.91930223186,
"user": 3.1946820999999996,
"system": 2.2656820199999994,
"min": 4.82582681386,
"max": 5.22330471886,
"times": [
4.83362955386,
5.22330471886,
4.93123615886,
4.907368304859999,
5.1855993288599995,
4.9748790418599995,
4.93612653786,
4.82582681386,
4.902831281859999,
4.881223105859999
]
},
{
"command": "pacquet@main",
"mean": 5.0108673131599994,
"stddev": 0.06882856355841734,
"median": 5.02258084936,
"user": 3.2638754,
"system": 2.26958902,
"min": 4.9047417928599994,
"max": 5.10477907786,
"times": [
5.10477907786,
5.09299239786,
4.9047417928599994,
5.03308233686,
5.04671301186,
4.937728326859999,
5.01207936186,
5.04904812586,
4.926448006859999,
5.001060692859999
]
},
{
"command": "pnpr@HEAD",
"mean": 4.04163366876,
"stddev": 0.14454169548011972,
"median": 4.00734450186,
"user": 2.3213798999999997,
"system": 2.3453603199999997,
"min": 3.83198777686,
"max": 4.29391265586,
"times": [
4.06896871686,
4.0707821938599995,
4.04110812986,
4.29391265586,
4.26894052486,
3.96965430286,
3.94222621186,
3.97358087386,
3.83198777686,
3.95517530086
]
},
{
"command": "pnpr@main",
"mean": 4.00145976266,
"stddev": 0.17928240105760207,
"median": 3.98920204886,
"user": 2.3068267,
"system": 2.285738919999999,
"min": 3.77949635186,
"max": 4.31708505586,
"times": [
3.86141892386,
4.06292478386,
3.82632915086,
3.77949635186,
3.87031253686,
4.071619924859999,
4.0853614358599994,
3.91547931386,
4.22457014886,
4.31708505586
]
}
]
} |
Summary
@pnpm/napi'sresolveDependencyderivedfilter_metadatafromfull_metadata, so a caller asking for full metadata got a manifest that had been run throughclear_meta— reduced to npm's abbreviated version fields. Any registry-custom field on the version object was dropped.Bit is the consumer that hit this: it reads
componentIdoff the resolved manifest, and every resolve through the engine failed withThe API this replaces —
createClient({ fullMetadata: true })from@pnpm/installing.client— leavesfilterMetadataunset, andretainsFullMeta()keeps the document whole in exactly that combination. Only the install path (createNewStoreController) pairs the two flags, where nothing outside the abbreviated set is ever read. This PR untangles them on the napi resolve path.No cache invalidation is needed after upgrading: filtered documents were mirrored under
FULL_FILTERED_META_DIR, a different slot from the unfilteredFULL_META_DIRthe fixed code reads, so a poisoned mirror can't be served.No TypeScript-side change is needed — the TS resolver path was already correct; only the napi binding mis-paired the flags.
Related to teambit/bit#10558, which added a fallback on the Bit side.
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.
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
componentId, on version manifests.Tests