Repository navigation
fix(resolving-deps-resolver): key an aliased dependency by its manifest name - #13407
Conversation
…st name An aliased `jsr:` or named-registry dependency (`"bar-from-jsr": "jsr:@pnpm-e2e/[email protected]"`) resolved and installed, but never reached the lockfile importer. Those resolvers stamp the protocol's own package name on the result as its alias, and the tree builder let that name win over the manifest key. `build_importer` only records aliases the manifest declares, so the edge was dropped and the importer came out empty. The TypeScript CLI reads the same resolver output the other way around (`wantedDependency.alias ?? pkgResponse.body.alias ?? pkg.name`), so this applies that precedence in the tree builder, shared by the fresh and the lockfile-reuse node paths. The resolver's alias still names the edges that carry no manifest key of their own, such as `pnpm add jsr:@pnpm-e2e/bar`. The two `jsr with alias` ports lose their `known_failures` gate, and the named-registry shape gets its own CLI test; its expected lockfile entry was taken from a TypeScript-CLI run against the same manifest. TypeScript needs no change: it already records both shapes correctly. Closes #13362
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe resolver now prioritizes manifest aliases when recording dependency edges for fresh and reused resolutions. Named-registry and aliased JSR installation/update tests verify lockfile importer entries and alias-based package installation. ChangesAliased dependency importer
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Resolver
participant Lockfile
participant NodeModules
CLI->>Resolver: Install or update aliased dependency
Resolver->>Lockfile: Record manifest-keyed importer entry
Resolver->>NodeModules: Install package under alias
Lockfile-->>CLI: Return dependency metadata
Possibly related issues
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 lockfile importer for aliased jsr:/named-registry dependencies
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the prior documentation concern is resolved because the rustdoc now states the helper contract while the implementation rationale is kept in a regular comment. Reviews (3): Last reviewed commit: "docs(resolving-deps-resolver): move the ..." | Re-trigger Greptile |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs (1)
1905-1916: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse regular comments for private implementation rationale.
Both blocks explain internal alias-precedence behavior on private functions; reserve
///for public API contracts.
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs#L1905-L1916: convert the privatenode_aliasrationale to//.pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs#L301-L305: convert the privateresolve_jsr_implrationale to//.As per coding guidelines, “Use rustdoc comments for public API contracts and regular comments for implementation rationale.”
🤖 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/resolving-deps-resolver/src/resolve_dependency_tree.rs` around lines 1905 - 1916, Convert the private implementation-rationale comments above node_alias in pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs lines 1905-1916 from rustdoc comments to regular comments, preserving their content. Apply the same change to the private resolve_jsr_impl rationale in pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs lines 301-305; no wording or behavior changes are needed.Source: Coding guidelines
🤖 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/resolving-deps-resolver/src/resolve_dependency_tree.rs`:
- Around line 1905-1916: Convert the private implementation-rationale comments
above node_alias in
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs lines
1905-1916 from rustdoc comments to regular comments, preserving their content.
Apply the same change to the private resolve_jsr_impl rationale in
pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs lines 301-305; no wording
or behavior changes are needed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2dc81708-3a45-4f91-9f56-2ec73c5a11a7
📒 Files selected for processing (7)
.changeset/aliased-jsr-dependency-importer.mdpnpm/crates/cli/tests/named_registry_install.rspnpm/crates/cli/tests/update_jsr.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-npm-resolver/src/named_registry_resolver.rspnpm/crates/resolving-npm-resolver/src/npm_resolver.rspnpm/plans/TEST_PORTING.md
…lper Trim `node_alias`'s doc comment to the contract and the invariant behind it: the scenarios it narrated are what the integration tests are for. Append the named-registry test's `namedRegistries` key through `append_workspace_yaml_key`, which guards the trailing newline and asserts the harness has not started writing the key itself.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13407 +/- ##
=======================================
Coverage 87.55% 87.55%
=======================================
Files 544 544
Lines 93464 93467 +3
=======================================
+ Hits 81832 81838 +6
+ Misses 11632 11629 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Review feedback, addressed in df18605: Fixed
Not changing
Written by an agent (Claude Code, claude-opus-5). |
…t of rustdoc `node_alias`'s rustdoc keeps the contract; why the manifest key has to come first turns on how the lockfile importer is built, which is implementation rationale rather than part of this helper's contract.
|
Follow-up on the remaining documentation point (Greptile, and CodeRabbit's nitpick in its narrower reading), addressed in 07e93e3. Splitting the two halves is the right call: To be clear about what I did not change: the Written by an agent (Claude Code, claude-opus-5). |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Code review by qodo was updated up to the latest commit 07e93e3 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. 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.5040354462,
"stddev": 0.13421964932177538,
"median": 2.4601828078,
"user": 1.5213259000000001,
"system": 1.24434176,
"min": 2.3626445557999998,
"max": 2.7046308388,
"times": [
2.3702609178,
2.3626445557999998,
2.6271526508,
2.3681853078,
2.6866817158,
2.4829043407999998,
2.5780885328,
2.4374612748,
2.4223443268,
2.7046308388
]
},
{
"command": "pacquet@main",
"mean": 2.5025159137000004,
"stddev": 0.15132114104788938,
"median": 2.5003082277999997,
"user": 1.4914241,
"system": 1.21729326,
"min": 2.3456923058,
"max": 2.7747065368,
"times": [
2.3456923058,
2.5512235158,
2.5301526528,
2.3551325147999997,
2.3922218328,
2.7180435628,
2.5331893988,
2.7747065368,
2.4704638028,
2.3543330138
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4743194344000001,
"stddev": 0.11594623643023727,
"median": 1.4433662448000002,
"user": 1.0589825999999998,
"system": 1.0945901599999999,
"min": 1.3441333828000002,
"max": 1.7426960648000003,
"times": [
1.4515312818000001,
1.7426960648000003,
1.3659797208000002,
1.3441333828000002,
1.5938740768000002,
1.4361382688000002,
1.4903940268,
1.4465054328000002,
1.4317150318,
1.4402270568000002
]
},
{
"command": "pnpr@main",
"mean": 1.5382239639,
"stddev": 0.14689774558564192,
"median": 1.4937882558000002,
"user": 1.0442105000000002,
"system": 1.1091646599999998,
"min": 1.3534908328000002,
"max": 1.7917637308000003,
"times": [
1.6913577588000002,
1.5300881918000002,
1.4292865868000002,
1.4066456608000002,
1.6107565288,
1.3534908328000002,
1.7917637308000003,
1.4574883198000002,
1.6796098638,
1.4317521648
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25293875118000003,
"stddev": 0.00604033712900464,
"median": 0.25159731478,
"user": 0.20856950000000002,
"system": 0.52322536,
"min": 0.24486228178000002,
"max": 0.26356131678,
"times": [
0.24486228178000002,
0.25238157578000003,
0.25488974078000004,
0.25027106678000005,
0.26118089178000004,
0.25583167778000004,
0.24615579778000002,
0.26356131678,
0.25081305378,
0.24944010878000003
]
},
{
"command": "pacquet@main",
"mean": 0.25185639088,
"stddev": 0.007622506834944654,
"median": 0.25021625428,
"user": 0.21279309999999999,
"system": 0.50977586,
"min": 0.24317755078000003,
"max": 0.26628024778000003,
"times": [
0.25118716578,
0.25363990578,
0.24519729978000002,
0.24421686078000002,
0.26167012978000004,
0.24317755078000003,
0.26628024778000003,
0.24809760078000004,
0.24924534278000002,
0.25585180478
]
},
{
"command": "pnpr@HEAD",
"mean": 0.25974515638000006,
"stddev": 0.005139125407294066,
"median": 0.25804989378,
"user": 0.2091923,
"system": 0.51550876,
"min": 0.25304847678000003,
"max": 0.26910284078,
"times": [
0.25618711378000003,
0.25811944978,
0.26294414878000005,
0.26910284078,
0.25437057678,
0.25798033778,
0.26504110278000004,
0.25304847678000003,
0.25724503878000005,
0.26341247778000004
]
},
{
"command": "pnpr@main",
"mean": 0.26573481868,
"stddev": 0.005424246859368308,
"median": 0.26698632128,
"user": 0.20506610000000003,
"system": 0.53400966,
"min": 0.25726878378,
"max": 0.27416559878,
"times": [
0.26677549578000004,
0.26719714678,
0.27416559878,
0.26063200178,
0.26996276378,
0.26503157378000003,
0.26742401178,
0.27028670278,
0.25860410778000004,
0.25726878378
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.75385941614,
"stddev": 0.01359351256736787,
"median": 2.74877350404,
"user": 1.6805546800000002,
"system": 1.29449922,
"min": 2.73681817354,
"max": 2.77597619554,
"times": [
2.7448225065400003,
2.76521397754,
2.7681063145400002,
2.76512614354,
2.75253668854,
2.74501031954,
2.77597619554,
2.74099270354,
2.73681817354,
2.74399113854
]
},
{
"command": "pacquet@main",
"mean": 2.74131489984,
"stddev": 0.02017488110789742,
"median": 2.74899067654,
"user": 1.67173828,
"system": 1.2585791199999998,
"min": 2.69401787854,
"max": 2.76289264454,
"times": [
2.72946645254,
2.74825649954,
2.75125577654,
2.75006318854,
2.76289264454,
2.74972485354,
2.73095437454,
2.69401787854,
2.7609511925400003,
2.73556613754
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5931358078400002,
"stddev": 0.13150706603878762,
"median": 1.5835543950400002,
"user": 1.02416308,
"system": 1.1091750200000001,
"min": 1.44125079054,
"max": 1.8028438525400001,
"times": [
1.6440340395400002,
1.46878271654,
1.44859881354,
1.8028438525400001,
1.7584966035400003,
1.5230747505400002,
1.5120069385400001,
1.67515835354,
1.65711121954,
1.44125079054
]
},
{
"command": "pnpr@main",
"mean": 1.5655726464400002,
"stddev": 0.1317386618567603,
"median": 1.5422694410400002,
"user": 1.0128428799999998,
"system": 1.08594302,
"min": 1.41126585454,
"max": 1.8052586705400002,
"times": [
1.64814010054,
1.41126585454,
1.4238177895400002,
1.8052586705400002,
1.6933225655400002,
1.42932273554,
1.50516632554,
1.52766515054,
1.55687373154,
1.6548935405400003
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.58429255974,
"stddev": 0.007893673259383609,
"median": 0.5826222964400001,
"user": 0.7032714999999999,
"system": 0.6481945199999999,
"min": 0.5708729374400001,
"max": 0.5963330654400001,
"times": [
0.5873368504400001,
0.5708729374400001,
0.5775425374400001,
0.5809073504400001,
0.57975954644,
0.5941480364400001,
0.5963330654400001,
0.5811928544400001,
0.5840517384400001,
0.5907806804400001
]
},
{
"command": "pacquet@main",
"mean": 0.57891274484,
"stddev": 0.012958828144822632,
"median": 0.5813266664400001,
"user": 0.7005361000000001,
"system": 0.63989972,
"min": 0.5585855174400001,
"max": 0.6001111624400001,
"times": [
0.5876743024400001,
0.5697897354400001,
0.5755640964400001,
0.5823908524400001,
0.5896668204400001,
0.6001111624400001,
0.5609904174400001,
0.5802624804400001,
0.5840920634400001,
0.5585855174400001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29614576844000007,
"stddev": 0.008242910001972992,
"median": 0.29346395144000004,
"user": 0.1956991,
"system": 0.5187245199999999,
"min": 0.28922245544,
"max": 0.31799943644,
"times": [
0.29737808544,
0.29819584844,
0.29240515544,
0.31799943644,
0.29355372944,
0.28986090244,
0.28922245544,
0.29337417344,
0.29268517044000003,
0.29678272744
]
},
{
"command": "pnpr@main",
"mean": 0.29225151104,
"stddev": 0.0077210640501733764,
"median": 0.29075730944,
"user": 0.19146840000000004,
"system": 0.50224652,
"min": 0.28139651544,
"max": 0.30532513244000004,
"times": [
0.29459341144,
0.28139651544,
0.28800443144,
0.29341392844,
0.28810069044000003,
0.28425004844,
0.28762929844,
0.29862255944,
0.30532513244000004,
0.30117909444
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9017295754599999,
"stddev": 0.010931366209557699,
"median": 1.90222969546,
"user": 0.9311427999999999,
"system": 0.7472842199999998,
"min": 1.88813682396,
"max": 1.9218678989600002,
"times": [
1.9218678989600002,
1.9088398099600001,
1.9126890009600002,
1.8998935779600001,
1.89557162096,
1.90456581296,
1.88872346596,
1.8923732619600002,
1.88813682396,
1.9046344809600002
]
},
{
"command": "pacquet@main",
"mean": 1.8872600612600003,
"stddev": 0.008998155303912002,
"median": 1.88495055696,
"user": 0.9228793999999999,
"system": 0.73591172,
"min": 1.87354738396,
"max": 1.90159037196,
"times": [
1.90159037196,
1.87698516596,
1.89187834796,
1.88399219496,
1.88246867696,
1.89522932996,
1.88385041796,
1.88590891896,
1.89714980396,
1.87354738396
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29948925716,
"stddev": 0.005325157573530194,
"median": 0.29844696396000003,
"user": 0.19918150000000004,
"system": 0.5160181199999999,
"min": 0.29097182896,
"max": 0.30840471596,
"times": [
0.30840471596,
0.30544107696,
0.30281485096000005,
0.29861147696,
0.30259338696000004,
0.29776598196000004,
0.29828245096,
0.29590396096000005,
0.29410284096,
0.29097182896
]
},
{
"command": "pnpr@main",
"mean": 0.29930462986000006,
"stddev": 0.007535816561260251,
"median": 0.29777169296000006,
"user": 0.19838050000000002,
"system": 0.5171697199999998,
"min": 0.28938537296,
"max": 0.31678508396000005,
"times": [
0.28938537296,
0.29370402396,
0.30102831096000005,
0.29450233096,
0.29763250196,
0.30200565296000004,
0.29791088396000004,
0.31678508396000005,
0.30432423296,
0.29576790396
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5286959116600001,
"stddev": 0.029871923222568136,
"median": 0.5191358994599999,
"user": 0.50344964,
"system": 0.09480858,
"min": 0.49730331046000004,
"max": 0.58077469746,
"times": [
0.5425986754600001,
0.51654475946,
0.52172703946,
0.50514706046,
0.49804033246,
0.5076753444600001,
0.54803314746,
0.5691147494600001,
0.58077469746,
0.49730331046000004
]
},
{
"command": "pacquet@main",
"mean": 0.36127036015999997,
"stddev": 0.011001869655465676,
"median": 0.36247700646000003,
"user": 0.35701713999999996,
"system": 0.052381880000000006,
"min": 0.34214305346,
"max": 0.38195907246,
"times": [
0.36118995746,
0.36376405546,
0.35999411446,
0.38195907246,
0.35076718846,
0.36780720746,
0.36818036846,
0.34214305346,
0.36440444546,
0.35249413846
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08619466830848486,
"stddev": 0.0019362324423312272,
"median": 0.08652562946,
"user": 0.020890136969696972,
"system": 0.008112618181818182,
"min": 0.08194042846,
"max": 0.08940275446000001,
"times": [
0.08472858846,
0.08457184346,
0.08925022946000001,
0.08430187746000001,
0.08815175946,
0.08940275446000001,
0.08405416346000001,
0.08558768946,
0.08420260246000001,
0.08598595646000001,
0.08731508946000001,
0.08608030246000001,
0.08654615846000001,
0.08685654946000002,
0.08311497246,
0.08605038846,
0.08372604746000001,
0.08755216446000001,
0.08607379046000001,
0.08340935446,
0.08777710546,
0.08775015646,
0.08783647646000001,
0.08742908346000001,
0.08698173346,
0.08652562946,
0.08348520546,
0.08194042846,
0.08903885246000001,
0.08657792746000001,
0.08908688246,
0.08642323646000001,
0.08660905446000002
]
},
{
"command": "pnpr@main",
"mean": 0.08651485580375,
"stddev": 0.0019224138878154487,
"median": 0.08721412496,
"user": 0.020359627499999994,
"system": 0.008800793749999999,
"min": 0.08144291546000001,
"max": 0.08901381646,
"times": [
0.08901381646,
0.08843650346000001,
0.08869769246,
0.08491181146000001,
0.08631681746000001,
0.08733830246,
0.08498789546,
0.08582163846,
0.08712116646000001,
0.08777834746,
0.08721331846000001,
0.08789320346000001,
0.08778590246000001,
0.08772616946,
0.08641416046000001,
0.08485010546,
0.08635394746000001,
0.08830390346000001,
0.08799008646,
0.08605054746000002,
0.08849973146000001,
0.08580562846,
0.08721493146,
0.08733709046,
0.08764809446,
0.08739899646,
0.08309639746000001,
0.08722572146,
0.08680277946,
0.08251017746000001,
0.08144291546000001,
0.08248758546000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.5053174385600006,
"stddev": 0.09492886869740762,
"median": 4.48414045206,
"user": 1.65887112,
"system": 1.35475648,
"min": 4.40858997556,
"max": 4.64518163556,
"times": [
4.41121198356,
4.64518163556,
4.40858997556,
4.6449473045600005,
4.50974634356,
4.4357565685600004,
4.59158680256,
4.53446445456,
4.41315475656,
4.45853456056
]
},
{
"command": "pacquet@main",
"mean": 4.49925315336,
"stddev": 0.11712755977716928,
"median": 4.445418351060001,
"user": 1.68733232,
"system": 1.3047818799999997,
"min": 4.41069754756,
"max": 4.78558822656,
"times": [
4.41937966156,
4.486667450560001,
4.78558822656,
4.55360561456,
4.42694948956,
4.445411898560001,
4.58976916456,
4.44542480356,
4.41069754756,
4.42903767656
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5459584737600003,
"stddev": 0.0739119429049228,
"median": 3.53536229456,
"user": 1.13324622,
"system": 1.2326699799999998,
"min": 3.4534636555600002,
"max": 3.6666010995600002,
"times": [
3.4728704765600003,
3.4534636555600002,
3.5109412645600004,
3.6481715515600004,
3.6666010995600002,
3.4708054735600005,
3.5941016255600005,
3.52593486656,
3.54478972256,
3.5719050015600002
]
},
{
"command": "pnpr@main",
"mean": 3.5245948090600003,
"stddev": 0.108841762262107,
"median": 3.4874012495600004,
"user": 1.13155442,
"system": 1.20985208,
"min": 3.4249694815600003,
"max": 3.78194155056,
"times": [
3.4382534655600003,
3.5466382105600003,
3.4439717305600004,
3.6211389085600003,
3.4666259735600002,
3.78194155056,
3.54760627056,
3.4825025965600003,
3.4249694815600003,
3.49229990256
]
}
]
} |
|
Bencher alert on CI measured 497.30 ms on HEAD against a 352.51 ms baseline (+41.08%, over the 423.01 ms boundary). I re-ran the same scenario on one machine, same harness, prebuilt binaries, 10 runs each:
HEAD comes out 1.04 ± 0.05 times faster than main — no regression in the direction the alert claims. That matches what the diff can do. The shape of the CI numbers points the same way: HEAD's σ was 29.9 ms against main's 11.0 ms in the same run, and the other six scenarios all landed within ±1% of baseline, including I have re-run the benchmark workflow to get a fresh measurement. Written by an agent (Claude Code, claude-opus-5). |
…st name (pnpm#13407) An aliased `jsr:` or named-registry dependency (`"bar-from-jsr": "jsr:@pnpm-e2e/[email protected]"`) resolved and installed, but never reached the lockfile importer. Those resolvers stamp the protocol's own package name on the result as its alias, and the tree builder let that name win over the manifest key. `build_importer` only records aliases the manifest declares, so the edge was dropped and the importer came out empty. The TypeScript CLI reads the same resolver output the other way around (`wantedDependency.alias ?? pkgResponse.body.alias ?? pkg.name`), so this applies that precedence in the tree builder, shared by the fresh and the lockfile-reuse node paths. The resolver's alias still names the edges that carry no manifest key of their own, such as `pnpm add jsr:@pnpm-e2e/bar`. The two `jsr with alias` ports lose their `known_failures` gate, and the named-registry shape gets its own CLI test; its expected lockfile entry was taken from a TypeScript-CLI run against the same manifest. TypeScript needs no change: it already records both shapes correctly. Closes pnpm#13362
Summary
An aliased
jsr:dependency —"bar-from-jsr": "jsr:@pnpm-e2e/[email protected]"— resolved and installed under pacquet, but the lockfile importer came out empty, so nothing that reads direct dependencies out of the lockfile (outdated,update,licenses, dedupe, frozen-install verification) could see it. Closes #13362.The
jsr:and named-registry resolvers stamp the protocol's own package name on the result as its alias (@pnpm-e2e/bar), which is what an edge with no manifest key of its own —pnpm add jsr:@pnpm-e2e/bar— should install under. pacquet's tree builder let that name win over the manifest key, andbuild_importeronly records aliases the manifest declares, so the edge was dropped.The TypeScript CLI stamps the very same alias in its resolver (
alias: spec.jsrPkgName) but reads it the other way around in the tree builder —wantedDependency.alias ?? pkgResponse.body.alias ?? pkg.name. This PR applies that precedence in pacquet, extracted into onenode_aliashelper shared by the fresh-resolve and lockfile-reuse node paths. The same bug affected aliasednamedRegistriesentries ("foo-from-work": "work:@pnpm.e2e/[email protected]"), and the same fix covers them.TypeScript needs no change here — it already records both shapes correctly, so this is a pacquet-only fix.
Tests: the two
jsr with aliasports drop theirknown_failuresgate, and the named-registry shape gets its own CLI test. Its expected lockfile entry was taken from an actual TypeScript CLI run against the same manifest (positive-from-work→specifier: work:[email protected],version: [email protected]) rather than assumed. Both new assertions were verified to fail against the pre-fix precedence.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting. (pacquet-only: the TypeScript CLI already behaves correctly, and its ownjsr with aliastest covers it.)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).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
jsr:and named-registry dependencies, so they’re visible to lockfile-based tooling.node_modulescontains the expected alias-named package, includingupdate --latestscenarios.