Fix registry resolution for scoped npm packages without explicit scoped registry #13709
+45
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Dependabot incorrectly uses
replaces-baseregistries for scoped packages that lack explicit scoped registry configuration. When a custom registry (e.g., GitHub npm) is configured withreplaces-base: truefor specific scoped packages like@chocoapp/*, Dependabot also attempts to fetch unrelated scoped packages like@types/k6from that registry instead of the public npm registry, causingERR_PNPM_NO_MATCHING_VERSIONfailures.This fix ensures scoped packages without explicit scoped registry configuration use the public npm registry, not the
replaces-baseregistry.Anything you want to highlight for special attention from reviewers?
Changes to
RegistryFinder:explicit_registry_from_rc: For scoped packages, falls back toglobal_registry_from_config_files(excludesreplaces-basecredentials) instead ofconfigured_global_registryfirst_registry_with_dependency_details: When no registry has the dependency, scoped packages fall back to public npm registry instead ofglobal_registryglobal_registry_from_config_files(new): Returns global registry from config files (.npmrc, .yarnrc, .yarnrc.yml) only, excludingreplaces-basecredentialsRegistry resolution priority after fix:
replaces-base)replaces-baseregistry → only for unscoped packagesHow will you know you've accomplished your goal?
Added test case that reproduces the issue: configures a
replaces-basecredential for GitHub npm registry, then verifies@types/k6resolves to public npm registry, not the GitHub registry.All existing tests pass (57
registry_findertests + 337package/update_checkertests).Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
gitlab.com/usr/bin/node node /usr/bin/corepack npm install babel-preset-php@gitlab:kornelski/babel-preset-php#5fbc24ccc37bd72052ce71ceae5b4934feb3ac19 --force --dry-run false --ignore-scripts --package-lock-only by/efd56fd6ee95a--global bash --no�� --noprofile e-handler f .com: bot/uv/file_updaconfig /snap/bin/grep /usr/bin/runc.orcredential.helper(dns block)/usr/bin/node node /opt/npm_and_yarn/run.js f node k yarn config f caFilePath /etc/ssl/certs/cconfig f git k --global --add /usr/bin/git [email protected]/ update f /usr/bin/git(dns block)/usr/bin/node node /opt/npm_and_yarn/run.js 3.4.0/bin/node node /usr�� pnpm r f --lockfile-only --no-save -r /usr/bin/git stat�� [email protected]: all d47f67a09506399dfc9ddc075d .com: .yarn/cache /usr/bin/node git(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.