Repository navigation
feat(npm): look packages up in the registries .npmrc names - #162
Merged
Merged
Conversation
A dependency gains a `registry`: the https URL to look it up in when it is not its source's public one. npm reads it from the nearest `.npmrc` (`registry=`, `@scope:registry=`) or Yarn Berry's `.yarnrc.yml` (`npmRegistryServer`, `npmScopes`), and extractors take a `registry` template. The registry is part of the lookup and catalog keys, and credentials come only from operator entries covering its URL. A package from its own registry gets no OSV advisories and no release notes, since the public package of that name is a different package. BREAKING CHANGE: the report schema is version 5, adding a dependency's `registry`. Refs #157
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Rust | Nov 3, 2026 7:29a.m. | Review ↗ | |
| JavaScript | Nov 3, 2026 7:29a.m. | Review ↗ | |
| Shell | Nov 3, 2026 7:29a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
|
Docs7 for sweepies/count-patchula
Commit |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | e5a0603 | Commit Preview URL Branch Preview URL |
Nov 03 2026, 07:18 AM |
…ot use
From an independent review of this PR:
- A registry value the Count cannot read from (`${VAR}`, plain http) is
kept as written, so that lookup fails instead of falling back to the
public package of the name. Extractors do the same instead of failing
the whole extraction, and only npm extractors take a registry.
- `.npmrc`/`.yarnrc.yml` files that name no registry no longer hide one
further up; scope and default settings each come from the nearest file
that sets them.
- Yarn's registry.yarnpkg.com, and any path on a public registry host,
count as public npm.
- Packages only a lockfile records get their registry too, so OSV is not
asked about the public package of their name.
- Same-named packages from different registries get separate branches.
- Escaped npm names are refused, and `credentialed` resolves mirrors.
From a second review: - `.npmrc` and `.yarnrc.yml` are fetched whenever npm or Bun is enabled, so a `files` selection or `exclude` cannot send scoped packages to the public registry. - npm extractors without a `registry` template follow `.npmrc`. - Branch prefixes use the whole registry URL, so two registries on one host do not share a branch. - An empty `registry=` or `npmRegistryServer` sets nothing.
From the third and fourth review rounds:
- The extraction cache key moves to v12, so extractions cached without
registries are not reused.
- npm regex extractors read `.npmrc` even when only the regex manager
is enabled.
- A plain-http public npm or Yarn registry counts as public.
- A request without credentials never gains an entry's on a redirect.
- Plan matching and dashboard keys include the registry, unchanged for
public packages.
- Lockfile tools see each `.npmrc` cut down to its registry lines, and a
`${VAR}` registry stays in `.yarnrc.yml`, so a private scope never
resolves to the public package of its name.
A package is now one `PackageId { source, registry, name }` wherever the
Count identifies it: datasource lookups, credential checks and release
notes, the engine's lookup and catalog keys, the server's public view and
the PR writer's notes cache. The compiler now finds every place that has
to account for a package's registry. `PackageId::is_public` is the single
rule for what may be read by name from public services, used by
advisories and release notes.
The catalog age cache (v3) and lookup hints (v4) get new keys, since their
stored shapes changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 3 of #157, npm. A dependency can now come from a registry of its own. The registry is a separate field on the dependency, not part of
package, so rules, the dashboard and the report keep the plain package name.Where the registry comes from
.npmrc: the nearest one at or above eachpackage.json, usingregistry=and@scope:registry=. Lines with${VAR}and anything that isn't an https URL are ignored.packageManagerstays on the public registry, because Corepack doesn't read.npmrc..yarnrc.yml:npmRegistryServerandnpmScopes, which win over.npmrcin the same directory.registrytemplate. An empty or unmatched capture means the public registry. Config validation checks the template's captures.Plumbing
patchula_manager::Dependency.registry.{enabled}:{source}:{registry}, so two packages with the same name from different registries are separate lookups.Client::lookup(source, registry, package). Only npm takes a registry for now, and only an https one; any other source with a registry is an error.credentialedtakes the registry too, so the public API rule from feat(lookup): authenticate to private registries from operator settings #160 covers these lookups.registriesentries covering the URL. A repository that names a registry brings none.@acme/uiwould pick up advisories and release notes from whatever is published publicly as@acme/ui.Breaking
The report schema moves to version 5, adding
registryto a dependency. Readers reject unknown fields, so a new field means a new version.Docs
registryUrls/.npmrc.Testing
mise run test:unit,mise run lintandmise run docs:buildpass on the dev VM. New tests cover:.npmrcand.yarnrc.ymlscopes, the nearest-file rule, ignoring${VAR}andhttp://, and CorepackNext: PyPI, Cargo, NuGet, RubyGems/Composer and Go/Terraform, one PR each, using the same
registryfield. Helm and Maven move onto it in a later cleanup PR.