Repository navigation
fix(resolver): resolve catalog: only in injected workspace projects - #18290
Conversation
The resolver passed the child specifiers of every file: directory package through the importer's catalogs, however the package was declared. An ordinary file: dependency outside the workspace therefore resolved its catalog: specifiers instead of failing with ERR_PNPM_UNSUPPORTED_PROTOCOL, which pnpm v11 reports. The test added in #17295 (ordinary_file_dependencies_do_not_inherit_importer_catalogs) has failed on main since it landed. Catalogs now apply to a directory package's children only when it was resolved through a workspace: specifier, as in pnpm v11, or when its directory is a workspace project. The second case keeps the v12 behavior for a workspace project injected by a file: or bare path, which the injected freshness matrix covers and pnpm v11 does not support. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
PR Summary by QodoRestrict catalog resolution to injected workspace projects
AI Description
Merge Risk
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
[Medium impact] The PR appears safe to merge. Reviews (2) · Last reviewed commit: "fix(resolver): recognize workspace publi..." · Reviewed by Greptile |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Same-run syscall checkEach install runs 2 more times per revision, untimed, under
Integrated-Benchmark Report (Linux)Commit: Compared against main at: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.35553009512,
"stddev": 0.08954308102693186,
"median": 2.3441557840200002,
"user": 2.02392924,
"system": 1.3936856599999998,
"min": 2.2600104940200003,
"max": 2.5183107010200003
},
{
"command": "pacquet@main",
"mean": 2.41952148742,
"stddev": 0.1197086116532966,
"median": 2.4281607355200006,
"user": 1.9697500399999999,
"system": 1.45452816,
"min": 2.25728917702,
"max": 2.5684597950200003
},
{
"command": "pnpr@HEAD",
"mean": 1.3899106450199998,
"stddev": 0.09575461376574922,
"median": 1.37402417152,
"user": 1.8586499399999998,
"system": 1.3383273599999999,
"min": 1.27956041102,
"max": 1.61206804202
},
{
"command": "pnpr@main",
"mean": 1.40697111912,
"stddev": 0.12071346493534374,
"median": 1.38564420002,
"user": 1.8650119399999998,
"system": 1.34953306,
"min": 1.26944517502,
"max": 1.63237840102
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20898136688000002,
"stddev": 0.013199483704836866,
"median": 0.20960125598,
"user": 0.26946238,
"system": 0.5201195200000001,
"min": 0.19169235498,
"max": 0.22906025098000002
},
{
"command": "pacquet@main",
"mean": 0.19442292898000002,
"stddev": 0.007358855802942756,
"median": 0.19377827798000002,
"user": 0.24668598000000003,
"system": 0.48901932,
"min": 0.18540652598000001,
"max": 0.21051481198000002
},
{
"command": "pnpr@HEAD",
"mean": 0.21180116198000004,
"stddev": 0.004712932074702917,
"median": 0.21283932448,
"user": 0.26420398,
"system": 0.49220162000000006,
"min": 0.20612463498000003,
"max": 0.21788924498
},
{
"command": "pnpr@main",
"mean": 0.20995719788000003,
"stddev": 0.0050817904073068056,
"median": 0.21003863798000003,
"user": 0.24848158000000004,
"system": 0.5086503199999999,
"min": 0.20173672298,
"max": 0.21623320398
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.010198714275390946,
"stddev": 0.0005216161938966516,
"median": 0.01015185744,
"user": 0.0057288155555555555,
"system": 0.0054807226337448564,
"min": 0.00942156744,
"max": 0.01454456944
},
{
"command": "pacquet@main",
"mean": 0.010001011382084951,
"stddev": 0.0003990840898859455,
"median": 0.00995029644,
"user": 0.005501190501930504,
"system": 0.005526572509652512,
"min": 0.00921755644,
"max": 0.01252904744
},
{
"command": "pnpr@HEAD",
"mean": 0.010122308578775514,
"stddev": 0.00039906339336193966,
"median": 0.010086877440000001,
"user": 0.006673435510204078,
"system": 0.004484759510204082,
"min": 0.00939360644,
"max": 0.01374878844
},
{
"command": "pnpr@main",
"mean": 0.010092296808217053,
"stddev": 0.00036862437005571525,
"median": 0.010042756940000001,
"user": 0.006121868527131783,
"system": 0.0050195751937984505,
"min": 0.00935724644,
"max": 0.01181293744
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.009712863267004225,
"stddev": 0.00058114711703791,
"median": 0.00956566244,
"user": 0.00607579924050633,
"system": 0.00448780751054852,
"min": 0.008941142439999999,
"max": 0.01315019444
},
{
"command": "pacquet@main",
"mean": 0.009699782984354836,
"stddev": 0.00032576462496569907,
"median": 0.009670687939999999,
"user": 0.005590752741935484,
"system": 0.005027866370967741,
"min": 0.00913049244,
"max": 0.01232604444
},
{
"command": "pnpr@HEAD",
"mean": 0.009733484587679333,
"stddev": 0.0003647517942007882,
"median": 0.00970313244,
"user": 0.006132128354430381,
"system": 0.004530618902953585,
"min": 0.008979323439999999,
"max": 0.01149255244
},
{
"command": "pnpr@main",
"mean": 0.009814285585161293,
"stddev": 0.0010227190717450269,
"median": 0.009729637440000001,
"user": 0.005570418064516127,
"system": 0.005082074838709675,
"min": 0.00907045244,
"max": 0.024734748440000003
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.40652163868,
"stddev": 0.03831872621989739,
"median": 2.39671397248,
"user": 2.24802766,
"system": 1.5543341,
"min": 2.36959537348,
"max": 2.49869328748
},
{
"command": "pacquet@main",
"mean": 2.40821930378,
"stddev": 0.052791657339214086,
"median": 2.39005148198,
"user": 2.28079086,
"system": 1.5916674,
"min": 2.3580474824800004,
"max": 2.5482683924800003
},
{
"command": "pnpr@HEAD",
"mean": 1.58157063198,
"stddev": 0.0950778392369313,
"median": 1.60298841598,
"user": 1.7985665600000005,
"system": 1.5295311000000003,
"min": 1.4410405984799999,
"max": 1.7203309434799998
},
{
"command": "pnpr@main",
"mean": 1.5716275550799998,
"stddev": 0.1529097938778414,
"median": 1.57834080448,
"user": 1.8146533599999999,
"system": 1.4683102,
"min": 1.39660731648,
"max": 1.77092713548
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5383705213,
"stddev": 0.022083975244101602,
"median": 0.5374278286,
"user": 0.7992788399999999,
"system": 0.9338845600000001,
"min": 0.4976756781,
"max": 0.5729082501
},
{
"command": "pacquet@main",
"mean": 0.5551566300000002,
"stddev": 0.01779264135315377,
"median": 0.5567737986000001,
"user": 0.8473661399999999,
"system": 0.9949389599999998,
"min": 0.5185422441,
"max": 0.5773684081
},
{
"command": "pnpr@HEAD",
"mean": 0.3135359366,
"stddev": 0.01430351154726872,
"median": 0.31739492859999996,
"user": 0.29270194,
"system": 0.6174184599999999,
"min": 0.2896621171,
"max": 0.3312373101
},
{
"command": "pnpr@main",
"mean": 0.2999552899,
"stddev": 0.007970643361947704,
"median": 0.2977625916,
"user": 0.26587214000000003,
"system": 0.6109549599999999,
"min": 0.2889851651,
"max": 0.3172985101
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.5258410699599998,
"stddev": 0.033587622724767084,
"median": 1.51659648026,
"user": 0.8379177199999999,
"system": 0.8313330999999999,
"min": 1.4958848632600001,
"max": 1.6171857442600002
},
{
"command": "pacquet@main",
"mean": 1.5465419151600002,
"stddev": 0.04409537977680514,
"median": 1.5307004317600001,
"user": 0.8681430200000001,
"system": 0.9229611999999999,
"min": 1.51755086826,
"max": 1.66285636926
},
{
"command": "pnpr@HEAD",
"mean": 0.31739407495999994,
"stddev": 0.008191993181284883,
"median": 0.31289236976,
"user": 0.29017732,
"system": 0.6324042,
"min": 0.30919709626,
"max": 0.32977582726
},
{
"command": "pnpr@main",
"mean": 0.30962318316,
"stddev": 0.008335556175383178,
"median": 0.31094521326,
"user": 0.28106332,
"system": 0.6360366999999999,
"min": 0.28874877526,
"max": 0.31797338526
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store + cold pnpr resolve
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.55677779508,
"stddev": 0.03694973689783359,
"median": 1.54093874338,
"user": 0.90599428,
"system": 0.87086294,
"min": 1.5243236033799998,
"max": 1.64567646038
},
{
"command": "pacquet@main",
"mean": 1.56999648048,
"stddev": 0.04520481194816682,
"median": 1.55644034788,
"user": 0.92688408,
"system": 0.9626695399999999,
"min": 1.5327539883799999,
"max": 1.67495710138
},
{
"command": "pnpr@HEAD",
"mean": 0.76541386168,
"stddev": 0.0215260847587009,
"median": 0.76787790988,
"user": 0.5416584799999999,
"system": 0.7602406399999999,
"min": 0.7242508573800001,
"max": 0.7957787153800001
},
{
"command": "pnpr@main",
"mean": 0.7920238740800001,
"stddev": 0.017428455569553167,
"median": 0.7983439253800001,
"user": 0.54734158,
"system": 0.81136194,
"min": 0.76733874038,
"max": 0.81145684238
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2668575424333333,
"stddev": 0.01875374900088233,
"median": 0.26385347610000004,
"user": 0.2713787766666666,
"system": 0.18314862666666665,
"min": 0.2301515991,
"max": 0.29907971510000003
},
{
"command": "pacquet@main",
"mean": 0.26489597579999996,
"stddev": 0.01761440651033274,
"median": 0.2605304761,
"user": 0.28165756,
"system": 0.16873176,
"min": 0.2388328431,
"max": 0.2925592651
},
{
"command": "pnpr@HEAD",
"mean": 0.09303979793333335,
"stddev": 0.002411867862394452,
"median": 0.09279896060000001,
"user": 0.035976326666666655,
"system": 0.017212494666666668,
"min": 0.0878045031,
"max": 0.0979419591
},
{
"command": "pnpr@main",
"mean": 0.09226132022499998,
"stddev": 0.0019889441511321423,
"median": 0.0922902351,
"user": 0.039329109999999994,
"system": 0.013836524999999997,
"min": 0.0880514141,
"max": 0.0965164971
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20795862472666668,
"stddev": 0.010945537777408886,
"median": 0.20726219806,
"user": 0.21989814222222223,
"system": 0.05647016222222222,
"min": 0.18924420206,
"max": 0.22619758406
},
{
"command": "pacquet@main",
"mean": 0.20345495461555557,
"stddev": 0.010354809040430105,
"median": 0.20138240606000002,
"user": 0.21376992,
"system": 0.05507416222222222,
"min": 0.19324460306000002,
"max": 0.22154595306000002
},
{
"command": "pnpm@HEAD",
"mean": 3.8457233271711115,
"stddev": 0.13980736702219737,
"median": 3.8467410020600004,
"user": 6.02804480888889,
"system": 0.3333376066666667,
"min": 3.6534808610600003,
"max": 4.08296819306
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.07801496438774196,
"stddev": 0.0051912292282427835,
"median": 0.07664917042000001,
"user": 0.08123175806451613,
"system": 0.03346276193548387,
"min": 0.07139303342,
"max": 0.09145236342
},
{
"command": "pacquet@main",
"mean": 0.07420643526210527,
"stddev": 0.0018572077318684266,
"median": 0.07347758092000001,
"user": 0.07512652631578948,
"system": 0.034159967368421036,
"min": 0.07247922442,
"max": 0.08037131642
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.11235483121913045,
"stddev": 0.011941785617421055,
"median": 0.11079916548,
"user": 0.046291200000000005,
"system": 0.0805159808695652,
"min": 0.09845342648000001,
"max": 0.14699231148
},
{
"command": "pacquet@main",
"mean": 0.10916941574086955,
"stddev": 0.009567079077492406,
"median": 0.10539438648,
"user": 0.046939852173913034,
"system": 0.07602076347826087,
"min": 0.09771183648000001,
"max": 0.12835626548
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.5647402778,
"stddev": 0.17991193664221478,
"median": 4.5072870390999995,
"user": 2.07485004,
"system": 1.55407718,
"min": 4.3892515326,
"max": 4.8449705786
},
{
"command": "pacquet@main",
"mean": 4.5080239155,
"stddev": 0.15408910133040463,
"median": 4.4541118666,
"user": 2.2366147399999994,
"system": 1.62809228,
"min": 4.4303835256,
"max": 4.9330410216
},
{
"command": "pnpr@HEAD",
"mean": 3.5514654635,
"stddev": 0.08330350514104587,
"median": 3.5517406306,
"user": 2.04438074,
"system": 1.5604335799999998,
"min": 3.4410389366,
"max": 3.7003189736
},
{
"command": "pnpr@main",
"mean": 3.4848166313,
"stddev": 0.04359231424614665,
"median": 3.4779451916,
"user": 2.02784644,
"system": 1.5211060799999998,
"min": 3.4382227546,
"max": 3.5743126056
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.15344969449714288,
"stddev": 0.014428752619959427,
"median": 0.15270861864000002,
"user": 0.2130288914285714,
"system": 0.15488562285714286,
"min": 0.13319785414000002,
"max": 0.18189953214000001
},
{
"command": "pacquet@main",
"mean": 0.1375922067511111,
"stddev": 0.013272643842088712,
"median": 0.13705584764,
"user": 0.18936604222222223,
"system": 0.14253975777777778,
"min": 0.11650815814000001,
"max": 0.17265498414000002
},
{
"command": "pnpr@HEAD",
"mean": 0.13971855298210528,
"stddev": 0.009648699587635545,
"median": 0.13862648214,
"user": 0.17812982000000002,
"system": 0.13715471684210523,
"min": 0.12738097614000002,
"max": 0.16642534614
},
{
"command": "pnpr@main",
"mean": 0.14859805441777776,
"stddev": 0.009675901632397923,
"median": 0.14828468464,
"user": 0.1872897644444444,
"system": 0.14808764666666666,
"min": 0.13206877414,
"max": 0.17361044414000001
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.1857517862800002,
"stddev": 0.06017319133096804,
"median": 1.18907740118,
"user": 0.58211684,
"system": 0.2448474,
"min": 1.11708145418,
"max": 1.2541328521800001
},
{
"command": "pacquet@main",
"mean": 1.1370409720799999,
"stddev": 0.055589439105912124,
"median": 1.12885942518,
"user": 0.5718326399999999,
"system": 0.2467829,
"min": 1.06732765818,
"max": 1.23323893318
}
]
}Scenario: Cargo: repeat install, hot cache + hot storeFrozen repeat install of a Cargo workspace (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.03589074671469879,
"stddev": 0.002043280677809908,
"median": 0.03581301904,
"user": 0.02846164240963855,
"system": 0.01933117060240964,
"min": 0.03210364604,
"max": 0.04070679504
},
{
"command": "pacquet@main",
"mean": 0.03424508704000002,
"stddev": 0.0018724234480117423,
"median": 0.03406147404,
"user": 0.02589376151898733,
"system": 0.019986216202531652,
"min": 0.03137106404,
"max": 0.039139870040000004
}
]
} |
A workspace project with publishConfig.directory links that directory, so a file: dependency on it resolves there rather than at the project root. The workspace check compared the directory only with project roots, so such a dependency lost its catalog: resolution. The workspace directories, each project's root and the directory it links, are now collected once per importer instead of scanning every workspace package on each directory resolution. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 0a9f1ed |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18290 +/- ##
==========================================
- Coverage 92.23% 92.09% -0.15%
==========================================
Files 2504 2507 +3
Lines 315522 316515 +993
==========================================
+ Hits 291034 291485 +451
- Misses 24488 25030 +542 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Related to pnpm/tasks#310. ## Summary #18290 narrowed catalog inheritance to injected workspace projects. As a side effect, an ordinary `file:` dependency's taken `catalog:` peer range reached the resolver unresolved, and install failed with: ``` ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER "@pnpm.e2e/foo@catalog:" isn't supported by any available resolver ``` pnpm 11 resolves this after #17753, and #18129 left the v12 behavior explicitly unverified. This change passes the importer catalogs for peer extraction whenever the resolution declares a manifest directory, which covers ordinary `file:` directories as well as injected workspace projects. Child specifiers of ordinary file dependencies still do not inherit importer catalogs, as #18290 requires, and the resolver output format is unchanged. The v12 freshness half of pnpm/tasks#310 was verified separately: once resolution succeeds, editing the catalog is picked up by a normal install, and a frozen install reports `ERR_PNPM_LOCKFILE_CONFIG_MISMATCH` until the lockfile is re-resolved. This PR is therefore related to, not closing, pnpm/tasks#310. --------- Co-authored-by: Zoltan Kochan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Fixes the
mainRust CI failure ininject_workspace_packages::catalogs::ordinary_file_dependencies_do_not_inherit_importer_catalogs. The test has failed on Linux, macOS and Windows since it landed in #17295.pnpm v12 passed the child specifiers of every
file:directory package through the importer's catalogs, however the package was declared. An ordinaryfile:dependency outside the workspace therefore resolved itscatalog:specifiers. pnpm v11 rejects them withERR_PNPM_UNSUPPORTED_PROTOCOL, and the new test expects the same from v12.Catalogs now apply to a directory package's children only when:
workspace:specifier, as in pnpm v11 (resolvedVia === 'workspace'), orpublishConfig.directory.The workspace directories are collected once per importer, so each directory resolution costs a single set lookup.
The second case keeps the existing v12 behavior for a workspace project injected through a
file:or bare path. Theinjected_freshness_matrixtests cover that case and pnpm v11 does not support it, so dropping it would be a regression.This is a v12-only bug. pnpm v11 already rejects the case, and its half of the #17295 tests passes.
Squash Commit Body
Verification
cargo nextest runonpnpm-resolving-deps-resolverplus everypnpm-clitest matchingcatalogorinject: 1241 passed, including the previously failing test, the sixinjected_freshness_matrixcatalog cases, and a new test for afile:dependency on a workspace publish directory.pnpm-cliandpnpm-package-managersuites: 8828 run. The 8 failures in a loaded local run all pass in isolation.cargo clippy --workspace --all-targets -D warnings, dylint on the changed crate, and the pinned rustfmt: clean.Checklist
already linked to it solves it.
are implemented in every affected version.
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-5).
🤖 Generated with Claude Code