Repository navigation
fix: don't silently drop locked optional deps on resolution failure - #12855
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughpnpm now fails optional dependency resolution when a locked version cannot be resolved from registry metadata, instead of removing the locked entries. The PR adds resolver logic, a regression test with a version-hiding proxy, and a changeset entry. ChangesOptional dependency resolution failure handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pnpm11/installing/deps-resolver/src/resolveDependencies.ts`:
- Line 1852: The resolver currently treats any satisfying package entry in the
lockfile as a match, which can incorrectly block skip-on-failure behavior for
optional dependencies. Update the dependency check in resolveDependencies to
prefer the current locked edge/path for the specific wantedDependency before
falling back to any package-wide match, and keep the fix contained within the
existing resolver flow around wantedLockfileContainsSatisfyingEntry and the
related logic at the second call site. Preserve the exact locator/name mapping
so only the current locked dep path is considered already resolved when
available.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c8392a94-92c7-46c8-9223-22e60052031f
📒 Files selected for processing (3)
.changeset/optional-locked-resolution-failure.mdpnpm11/installing/deps-installer/test/install/optionalDependencies.tspnpm11/installing/deps-resolver/src/resolveDependencies.ts
When re-resolution of an optional dependency fails (for example, a registry mirror whose packument has not synced the pinned version yet), the resolver silently skipped the dependency. The parent's snapshot was then rewritten without the edge and the pruner erased the locked entries, so identical inputs produced different lockfiles depending on which machine ran the install, and a frozen install on another host had no entry to link for the affected package. Rethrow the resolution error instead of skipping when the wanted lockfile already holds an entry that satisfies the wanted range. An optional dependency that never resolved keeps the skip-on-failure behavior. pacquet already fails loudly in this scenario (its resolver never had the silent skip), so the two stacks now agree on the locked-entry case. Closes pnpm#12853 Co-Authored-By: Claude Fable 5 <[email protected]>
Match hidden packument paths by decoding the request URL instead of hand-encoding the package name, and serve the test proxy's error response as text/plain (CodeQL findings on the test helper). Document why wantedLockfileContainsSatisfyingEntry matches by package name and range instead of the current edge's locked dep path: dedupe clears per-snapshot dependency maps before resolving, so no edge-level linkage exists on the code path where the erasure happens. Co-Authored-By: Claude Fable 5 <[email protected]>
fa5ac06 to
0ac0b27
Compare
Code Review by Qodo
Context used✅ Compliance rules (platform):
51 rules 1.
|
PR Code Suggestions ✨Latest suggestions up to e9fcb45 Warning
Previous suggestionsSuggestions up to commit 0ac0b27
|
||||||||||||||||||
…ailures An optional dependency whose resolution fails is now skipped instead of failing the install, emitting the same pnpm:skipped-optional-dependency reason=resolution_failure payload as pnpm (including the parents chain, newly added to the wire type) with the default reporter rendering the same info line for top-level skips. The exception matches pnpm's new locked-entry guard: when the wanted lockfile already holds a package entry satisfying the wanted range, the failure is rethrown with the same hint so the locked entries are not silently erased (pnpm#12853). Co-Authored-By: Claude Fable 5 <[email protected]>
…macro Fixes the perfectionist macro_trailing_comma dylint finding. Co-Authored-By: Claude Fable 5 <[email protected]>
…ests Adds the required trailing comma in a multi-line assert_eq! and wraps a bare URL in angle brackets. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit e9fcb45 |
|
Assessment of the remaining Qodo findings on e9fcb45 (the inline "Preserve inherited optional handling" ( Skipped-optional prefix mismatch (strict equality vs O(n) lockfile scan per resolution failure — the scan runs only after a resolver chain call has already failed, so each occurrence is preceded by a network round-trip that dominates it by orders of magnitude, and the first rethrow aborts the install. It is not in the resolver's hot loop; an index threaded through the context for a failure-only path is not worth the state. Not applying. JSDoc narrating internals — the flagged paragraph records the non-obvious why for matching by name+range instead of the current edge's locked dep path, which the repo's comment conventions explicitly allow; the same question was already raised in review, and the paragraph is what stops the check from being "simplified" into the edge-keyed form that would silently disable the fix on the dedupe flow. Keeping it. Written by an agent (Claude Code, claude-fable-5). |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12855 +/- ##
==========================================
- Coverage 85.35% 85.33% -0.03%
==========================================
Files 453 453
Lines 70868 71032 +164
==========================================
+ Hits 60488 60613 +125
- Misses 10380 10419 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: 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": 4.34524045836,
"stddev": 0.14935238459297445,
"median": 4.29881696216,
"user": 4.0986419,
"system": 3.6651650599999996,
"min": 4.19087151816,
"max": 4.60471543716,
"times": [
4.60471543716,
4.48583589116,
4.24189424616,
4.42255761816,
4.4987729531600005,
4.22638191816,
4.19087151816,
4.20074884016,
4.22488648316,
4.35573967816
]
},
{
"command": "pacquet@main",
"mean": 4.21496676456,
"stddev": 0.10148990768353224,
"median": 4.19420748316,
"user": 4.068008900000001,
"system": 3.6263930600000003,
"min": 4.06648262916,
"max": 4.37159724416,
"times": [
4.27903626116,
4.19076486216,
4.06648262916,
4.14066491116,
4.12378961216,
4.15965859116,
4.19765010416,
4.36555696516,
4.25446646516,
4.37159724416
]
},
{
"command": "pnpr@HEAD",
"mean": 2.11979392996,
"stddev": 0.13514518033245396,
"median": 2.08938381766,
"user": 2.6878411000000004,
"system": 3.10058636,
"min": 1.98692844316,
"max": 2.37872530916,
"times": [
2.33335652616,
2.04859013016,
1.98692844316,
2.08826124516,
2.0086146241600003,
2.0905063901600003,
2.00481474716,
2.10266004516,
2.37872530916,
2.15548183916
]
},
{
"command": "pnpr@main",
"mean": 2.18700816546,
"stddev": 0.08972427525908652,
"median": 2.18150420116,
"user": 2.6874704,
"system": 3.1034294599999996,
"min": 2.09098582716,
"max": 2.3697628021600003,
"times": [
2.3697628021600003,
2.17528573816,
2.19755986816,
2.1877226641600003,
2.09098582716,
2.29473423716,
2.0962617151600003,
2.1131483391600003,
2.12838961016,
2.21623085316
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6722474491200001,
"stddev": 0.01683650269180925,
"median": 0.66795727532,
"user": 0.4009619,
"system": 1.3583739799999999,
"min": 0.6507332918200001,
"max": 0.69827606082,
"times": [
0.6635310828200001,
0.6569868388200001,
0.67238346782,
0.68794076082,
0.65840196382,
0.6507332918200001,
0.6927014168200001,
0.65977766882,
0.68174193882,
0.69827606082
]
},
{
"command": "pacquet@main",
"mean": 0.6831986612200001,
"stddev": 0.030411902428670822,
"median": 0.67555360082,
"user": 0.40103170000000005,
"system": 1.3532558799999996,
"min": 0.64512521582,
"max": 0.74577499682,
"times": [
0.69341099382,
0.69273323682,
0.66230566782,
0.66962642982,
0.66841804782,
0.64512521582,
0.68148077182,
0.65574417782,
0.7173670738200001,
0.74577499682
]
},
{
"command": "pnpr@HEAD",
"mean": 0.72353392672,
"stddev": 0.039497084107158555,
"median": 0.71404951482,
"user": 0.4049165,
"system": 1.3758156799999999,
"min": 0.6826193448200001,
"max": 0.81631409682,
"times": [
0.71513469582,
0.69539812582,
0.70612584282,
0.7275780968200001,
0.68626331782,
0.71296433382,
0.81631409682,
0.74304721882,
0.74989419382,
0.6826193448200001
]
},
{
"command": "pnpr@main",
"mean": 0.73325294992,
"stddev": 0.04766616797523538,
"median": 0.7236043788200001,
"user": 0.40449729999999995,
"system": 1.3890735799999996,
"min": 0.68820447882,
"max": 0.85761776682,
"times": [
0.7244486008200001,
0.75289075782,
0.68820447882,
0.71691105682,
0.70367875282,
0.73737985782,
0.73018775782,
0.69845031282,
0.72276015682,
0.85761776682
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.38061867446,
"stddev": 0.11503986466323463,
"median": 4.34918477356,
"user": 3.8949633599999993,
"system": 3.4817531199999996,
"min": 4.22146096406,
"max": 4.55065669906,
"times": [
4.32937231106,
4.22146096406,
4.28423088106,
4.32019750506,
4.28628652206,
4.36899723606,
4.55065669906,
4.53806279906,
4.502764385060001,
4.404157442060001
]
},
{
"command": "pacquet@main",
"mean": 4.39409581896,
"stddev": 0.051259189228421355,
"median": 4.40592409256,
"user": 3.88444236,
"system": 3.4769126199999993,
"min": 4.32218161806,
"max": 4.46664816006,
"times": [
4.43453807906,
4.32218161806,
4.40467369906,
4.41604582206,
4.45331002306,
4.3365145730600005,
4.407174486060001,
4.46664816006,
4.35662909706,
4.34324263206
]
},
{
"command": "pnpr@HEAD",
"mean": 2.19718252656,
"stddev": 0.15405055522232564,
"median": 2.12784462606,
"user": 2.52923816,
"system": 2.9828415199999996,
"min": 2.03408700906,
"max": 2.48285530106,
"times": [
2.0524356450599996,
2.19150812106,
2.48285530106,
2.12501648706,
2.13067276506,
2.1206425480599997,
2.42500488506,
2.03408700906,
2.1129256550599997,
2.29667684906
]
},
{
"command": "pnpr@main",
"mean": 2.23172831146,
"stddev": 0.14528356289951877,
"median": 2.16272864406,
"user": 2.5590013599999994,
"system": 2.9824019199999996,
"min": 2.06912242106,
"max": 2.49556062606,
"times": [
2.06912242106,
2.14025242906,
2.1453238840599997,
2.45425850506,
2.17156149206,
2.49556062606,
2.2806085120599997,
2.15389579606,
2.11707545606,
2.2896239930599998
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.44491993302,
"stddev": 0.024190703766056084,
"median": 1.4396221974199999,
"user": 1.40689662,
"system": 1.7461303999999997,
"min": 1.41910615942,
"max": 1.49535515342,
"times": [
1.44072546542,
1.45669273042,
1.4284881064200001,
1.42012427342,
1.42589316042,
1.41910615942,
1.45906175442,
1.4652335974200001,
1.43851892942,
1.49535515342
]
},
{
"command": "pacquet@main",
"mean": 1.47830682242,
"stddev": 0.04452185608435972,
"median": 1.4659360619200001,
"user": 1.4503173200000001,
"system": 1.7518631999999996,
"min": 1.43814049342,
"max": 1.58375319642,
"times": [
1.4707375794200002,
1.43851999242,
1.58375319642,
1.5234356934200002,
1.4611345444200001,
1.43814049342,
1.47141660442,
1.48495863842,
1.45657582242,
1.45439565942
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7162056669200002,
"stddev": 0.048845707593090516,
"median": 0.6944690524200001,
"user": 0.36923712,
"system": 1.3440639,
"min": 0.67593429342,
"max": 0.83667437442,
"times": [
0.76192706042,
0.67593429342,
0.69127001742,
0.68829011242,
0.83667437442,
0.6885649704200001,
0.68927295842,
0.71888286642,
0.7135719284200001,
0.6976680874200001
]
},
{
"command": "pnpr@main",
"mean": 0.72300590832,
"stddev": 0.03976547455672049,
"median": 0.7119805154200001,
"user": 0.38269591999999997,
"system": 1.3461104000000002,
"min": 0.69334136642,
"max": 0.8309299074200001,
"times": [
0.69835255342,
0.7008775714200001,
0.7171174144200001,
0.73076976242,
0.7117809284200001,
0.7072406544200001,
0.8309299074200001,
0.72746882242,
0.7121801024200001,
0.69334136642
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.30289562058,
"stddev": 0.026136924719632252,
"median": 3.30647826628,
"user": 2.0127278799999995,
"system": 2.10731968,
"min": 3.25165421428,
"max": 3.33704072028,
"times": [
3.30722693728,
3.29176917228,
3.27816731728,
3.31646204028,
3.29068321428,
3.31339995528,
3.30572959528,
3.33704072028,
3.25165421428,
3.33682303928
]
},
{
"command": "pacquet@main",
"mean": 3.1849974630799993,
"stddev": 0.049957490668623414,
"median": 3.19275659678,
"user": 1.9254343799999998,
"system": 2.03139188,
"min": 3.10102856428,
"max": 3.26563494328,
"times": [
3.20936258528,
3.23876760228,
3.19387548228,
3.20209070128,
3.17532691528,
3.12781668728,
3.10102856428,
3.26563494328,
3.14443343828,
3.19163771128
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6977849615799999,
"stddev": 0.01632105957503282,
"median": 0.69125108778,
"user": 0.3466810800000001,
"system": 1.3635592799999998,
"min": 0.6807573302800001,
"max": 0.73485188928,
"times": [
0.6852042082800001,
0.68826773228,
0.73485188928,
0.70197742728,
0.7130586642800001,
0.69346602128,
0.6890361542800001,
0.6875786702800001,
0.6807573302800001,
0.70365151828
]
},
{
"command": "pnpr@main",
"mean": 0.6965965418800002,
"stddev": 0.03708144068084767,
"median": 0.6876830097800001,
"user": 0.35983768,
"system": 1.3199610799999997,
"min": 0.6741042432800001,
"max": 0.79867121628,
"times": [
0.6872060132800001,
0.69896929228,
0.6976632592800001,
0.6784289852800001,
0.6755621662800001,
0.6881600062800001,
0.79867121628,
0.6741042432800001,
0.6929197862800001,
0.67428045028
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6723080150000001,
"stddev": 0.015988011304625207,
"median": 0.6737235167000002,
"user": 0.6390511200000001,
"system": 0.15931515999999998,
"min": 0.6520537147000001,
"max": 0.6996729137000001,
"times": [
0.6780538077000001,
0.6781812397000001,
0.6828393027000002,
0.6520537147000001,
0.6996729137000001,
0.6693932257000001,
0.6569481207000001,
0.6560114667000001,
0.6601483617000001,
0.6897779967000001
]
},
{
"command": "pacquet@main",
"mean": 0.6797552307000001,
"stddev": 0.011892664455557542,
"median": 0.6752257847,
"user": 0.64607652,
"system": 0.16169275999999996,
"min": 0.6642259277000001,
"max": 0.7004913877000001,
"times": [
0.7004913877000001,
0.6911800907000001,
0.6720038977000001,
0.6809198557000001,
0.6948112007000001,
0.6692885117000001,
0.6760784027000001,
0.6743731667000001,
0.6642259277000001,
0.6741798657000001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.1114171842,
"stddev": 0.002743234033826324,
"median": 0.1111282392,
"user": 0.030066695000000004,
"system": 0.019836110000000004,
"min": 0.10623495670000001,
"max": 0.11729041670000001,
"times": [
0.1133488177,
0.1103610867,
0.1105422887,
0.1112362717,
0.10816479270000001,
0.1089235597,
0.1117838337,
0.1126164597,
0.10623495670000001,
0.1099894317,
0.1124447487,
0.1110647807,
0.1158157337,
0.1086393997,
0.1081066937,
0.1144761937,
0.1108705987,
0.11339413270000001,
0.1165167767,
0.11119169770000001,
0.11729041670000001,
0.1117895047,
0.10987934270000001,
0.10933090170000001
]
},
{
"command": "pnpr@main",
"mean": 0.1096666067,
"stddev": 0.0023610978151212664,
"median": 0.10998113970000001,
"user": 0.029634039999999997,
"system": 0.019120439999999995,
"min": 0.10627333870000001,
"max": 0.1136427977,
"times": [
0.11017292470000001,
0.1116507357,
0.1111423757,
0.1134902527,
0.1110894827,
0.10696816370000001,
0.11027738270000001,
0.11090375070000001,
0.1120368067,
0.10627333870000001,
0.10726976070000001,
0.1099990057,
0.1136427977,
0.1066411087,
0.1081290027,
0.10666951870000001,
0.10835713570000001,
0.1084906957,
0.11292713870000001,
0.10699091670000001,
0.10745017470000001,
0.10998113970000001,
0.11339713570000001,
0.10962184470000001,
0.10809257770000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 7.222642153599999,
"stddev": 0.13338320553518754,
"median": 7.1945719227,
"user": 4.233438980000001,
"system": 3.9127147,
"min": 6.9926943327,
"max": 7.4698752627,
"times": [
7.2857884907,
7.4698752627,
7.3870875487,
7.1788785177,
7.1765999067,
7.2102653277,
7.1565422657,
6.9926943327,
7.1419251407,
7.2267647426999995
]
},
{
"command": "pacquet@main",
"mean": 7.071359868200001,
"stddev": 0.204266482691757,
"median": 7.0588128141999995,
"user": 4.16367438,
"system": 3.846716,
"min": 6.7949735637,
"max": 7.4059558207,
"times": [
6.7949735637,
7.0161278617,
7.4059558207,
6.9129753417,
7.0402005617,
7.0774250667,
7.4031334147,
6.8592024777,
7.0783771417,
7.1252274317
]
},
{
"command": "pnpr@HEAD",
"mean": 5.0151501992,
"stddev": 0.0717321859471935,
"median": 5.0382652332,
"user": 2.77824268,
"system": 3.2820961000000004,
"min": 4.8954852167,
"max": 5.0933919727,
"times": [
5.0659683497,
5.0559361397,
4.8954852167,
5.0475344747,
5.0866301597,
4.9385115616999995,
4.9183611047,
5.0933919727,
5.0289959917,
5.0206870207
]
},
{
"command": "pnpr@main",
"mean": 5.065099377699999,
"stddev": 0.13323417074064137,
"median": 5.0216006666999995,
"user": 2.790309779999999,
"system": 3.3162388999999997,
"min": 4.8877780347,
"max": 5.2935553657,
"times": [
4.9497399487000004,
5.2935553657,
5.0214301087,
4.8877780347,
5.1361375957,
5.2156342957,
4.9708267447,
5.1823083317,
5.0217712247,
4.9718121267
]
}
]
} |
|
| Branch | pr/12855 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,197.18 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 697.78 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 716.21 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 111.42 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,119.79 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 5,015.15 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 723.53 ms |
`pnpm audit --audit-level high` failed on four advisories, all in dev-scope transitive dependencies: fast-uri 3.1.3 -> 3.1.4 GHSA-v2hh-gcrm-f6hx js-yaml 5.2.1 -> 5.2.2 GHSA-pm4m-ph32-ghv5 postcss 8.5.15 -> 8.5.23 GHSA-r28c-9q8g-f849 brace-expansion 5.0.7 -> 5.0.8 GHSA-mh99-v99m-4gvg Every patched version already satisfies the range its parent declares (ajv wants fast-uri ^3.0.1, minimatch wants brace-expansion ^5.0.5, and so on), so these were stale lockfile resolutions rather than blocked ones. Refreshing the resolutions is sufficient; no `overrides:` entries are needed, and adding them would pin packages that should stay free to float. Dependabot could not produce this fix itself. Its security update for fast-uri ran with `update-subdependencies: false` and `allowed-updates` restricted to direct dependencies, so it errored out rather than opening a PR. Because the audit gate is repo-wide rather than diff-scoped, that single unfixable alert turned `ci` red on every open PR. Bumping pnpm is load-bearing here, not incidental. Under 11.9.0, regenerating this lockfile drops all eleven `lightningcss-*` platform binary packages: the package is reached both as a regular dependency (vite -> lightningcss) and through an optional one (vitefu -> vite), which triggers a resolver bug that erases locked optional entries instead of failing loudly. The resulting lockfile builds nowhere, including the linux-x64 host Cloudflare Pages deploys from. pnpm/pnpm#12855 fixes this in 11.11.0; 11.17.0 is the current release. `pnpm/action-setup` reads the version from `packageManager`, so CI and the deploy host pick it up with no workflow change.
Summary
Closes pnpm/pnpm#12853.
When re-resolution of an optional dependency fails, the resolver silently skips it (
pnpm:skipped-optional-dependency,reason=resolution_failure) — even whenpnpm-lock.yamlalready holds a locked resolution for that dependency. The parent's snapshot is then rewritten without those edges andpruneSharedLockfileerases the now-orphaned entries. This is how@napi-rs/[email protected]in the issue ends up serialized as'@napi-rs/[email protected]': {}with all 11 platform-binary entries removed.The most common trigger is registry metadata that differs between machines — for example a mirror whose packument for the platform-binary packages hasn't synced a recently published version yet (the
1.0.2binaries were 8 days old when the issue was filed, and only the freshly published version is affected, which matches the issue's observation that the older@napi-rs/[email protected]survived). Duringpnpm dedupeevery package re-resolves from registry metadata, so all 11 exact-pinned binaries fail resolution at once and are dropped from the lockfile in one run, while a machine with a healthy registry restores them — the two hosts fight over the lockfile indefinitely, which the reporter perceived as OS-dependence. I verified that the minimal repro from the issue produces byte-identical lockfiles on macOS arm64 and Linux arm64 against a healthy registry, and that a stale packument reproduces the emptied snapshot exactly.With this change, the resolution error is rethrown instead of swallowed when the wanted lockfile already contains an entry satisfying the wanted range: the install fails loudly and the lockfile stays intact. An optional dependency that never resolved (no locked entry) keeps the skip-on-failure behavior, so genuinely unresolvable optional deps still install fine. This follows the same pattern as #10289 and #10211, which stopped silently skipping optional deps for policy failures.
Verified end-to-end with the issue's reproduction against a proxy serving stale packuments: before,
pnpm dedupesilently rewrote the snapshot to{}; after, it fails withERR_PNPM_NO_MATCHING_VERSIONnaming the dependency path, and the lockfile keeps all 11 platform binaries. A healthy registry dedupe still succeeds.pacquet parity: pacquet previously failed loudly on every optional-dependency resolution failure (its resolver never had the silent skip). This PR now aligns the two stacks on both cases: pacquet skips a never-locked unresolvable optional dep like pnpm — emitting the same
pnpm:skipped-optional-dependency(reason=resolution_failure) payload including theparentschain (newly added to the wire type), with the default reporter rendering the same top-level info line — and keeps failing loudly, now with the same hint, when the wanted lockfile holds a satisfying entry. Covered by resolver-level tests mirroring the TypeScript regression test (locked entry → loud failure with the hint; never-locked → skip with the notification payload; out-of-range locked entry → still skips). One wording gap remains: the loud failure's message text differs (ERR_PNPM_NO_MATCHING_VERSIONvs pacquet's stringified resolver-chain error, and miette printshelp:where pnpm printshint:) — that is pacquet's pre-existing error-rendering shape, left for a follow-up.Squash Commit Body
Checklist
pacquet/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-fable-5).
Summary by CodeRabbit
Bug Fixes
New Features
Tests