Files
Sebastian Poxhofer 8f5f238b8f fix(datasource/crate): skip the web API of registries that do not implement it (#46329)
* fix(datasource/crate): only query the crates.io web API for crates.io

Private sparse registries such as Artifactory or CodeArtifact advertise an
`api` URL in their `config.json` for publishing, but do not implement the
crates.io-only read endpoints `api/v1/crates/<name>` and
`api/v1/crates/<name>/<version>`. Since #41536 Renovate called both for
every registry with an `api` field, producing 404s and a
"Release interceptor failed" warning on each run.

Restore the crates.io flavor guard for the crate metadata lookup and the
release timestamp lookup. Reading `config.json` from a cloned registry is
now unreachable, so drop that branch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(datasource/crate): cite the registry web API specification in the guards

* fix(datasource/crate): probe the registry web API once instead of guarding on flavor

Keep the crates.io read endpoints for registries that implement them.
Registries whose config.json points `api` at crates.io, such as index
mirrors, are used without probing. Any other registry is probed on the
first crate; a 404 for a crate that the index just returned means the
endpoint does not exist, so the registry is remembered as unsupported in
the memory cache and, for a day, in the package cache. The release
timestamp lookup handles a 404 the same way instead of surfacing the
generic "Release interceptor failed" warning.

Restores the cloned config.json branch, since cloned registries can now
advertise an API again.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(datasource/crate): key the unsupported web API marker by the api URL

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 07:29:50 +00:00

122 lines
3.6 KiB
TypeScript

// v8 ignore file -- constant namespace list, no executable logic to cover
/* IMPORTANT:
* These namespaces below are used as part of the cacheTtlOverride feature
* It's OK to add to them (e.g. for new datasources) but we should avoid
* backwards-incompatible changes in non-major releases
*/
export const packageCacheNamespaces = [
'_test-namespace',
'changelog-bitbucket-notes@v2',
'changelog-bitbucket-release',
'changelog-bitbucket-server-notes@v2',
'changelog-bitbucket-server-release',
'changelog-forgejo-notes@v2',
'changelog-forgejo-release',
'changelog-gitea-notes@v2',
'changelog-gitea-release',
'changelog-github-notes@v2',
'changelog-github-release',
'changelog-gitlab-notes@v2',
'changelog-gitlab-release',
'datasource-apk',
'datasource-artifactory',
'datasource-aws-machine-image',
'datasource-aws-rds',
'datasource-aws-eks-addon',
'datasource-azure-bicep-resource',
'datasource-azure-pipelines-tasks',
'datasource-azure-tags',
'datasource-bazel',
'datasource-bitbucket-tags',
'datasource-bitbucket-server-tags',
'datasource-bitrise',
'datasource-buildpacks-registry',
'datasource-cdnjs',
'datasource-conan',
'datasource-conda',
'datasource-cpan',
'datasource-crate-metadata',
'datasource-crate-registry-api',
'datasource-crate',
'datasource-deb',
'datasource-deno',
'datasource-docker-architecture',
'datasource-docker-hub-cache',
'datasource-docker-digest',
'datasource-docker-hub-tags',
'datasource-docker-imageconfig',
'datasource-docker-labels',
'datasource-docker-releases-v2',
'datasource-docker-tags',
'datasource-dotnet-version',
'datasource-elm-package',
'datasource-endoflife-date',
'datasource-galaxy-collection',
'datasource-galaxy',
'datasource-git-refs',
'datasource-git-tags',
'datasource-git',
'datasource-forgejo-releases',
'datasource-forgejo-tags',
'datasource-gitea-releases',
'datasource-gitea-tags',
'datasource-github-digest',
'datasource-github-release-attachments',
'datasource-gitlab-packages',
'datasource-gitlab-releases',
'datasource-gitlab-tags',
'datasource-glasskube-packages',
'datasource-go-direct',
'datasource-go-proxy-timestamps',
'datasource-go-proxy',
'datasource-go',
'datasource-golang-version',
'datasource-gradle-version',
'datasource-helm',
'datasource-hermit',
'datasource-hex',
'datasource-hexpm-bob',
'datasource-java-version',
'datasource-jenkins-plugins',
'datasource-jsr',
'datasource-maven:cache-provider',
'datasource-maven:metadata-not-found',
'datasource-maven:pom-cache-provider',
'datasource-maven:postprocess-reject',
'datasource-nextcloud',
'datasource-node-version',
'datasource-npm:cache-provider',
'datasource-nuget-v3',
'datasource-orb',
'datasource-packagist',
'datasource-pod',
'datasource-python-version',
'datasource-repology',
'datasource-rpm',
'datasource-ruby-version',
'datasource-rubygems',
'datasource-rust-version',
'datasource-sbt-package',
'datasource-terraform-module',
'datasource-terraform-provider',
'datasource-terraform',
'datasource-typst:cache-provider',
'datasource-typst:registry-releases',
'datasource-unity3d',
'datasource-unity3d-packages',
'github-branches-datasource-v1',
'github-releases-datasource-v2',
'github-tags-datasource-v2',
'merge-confidence',
'preset',
'terraform-provider-hash',
'url-sha256',
] as const;
export type PackageCacheNamespace =
(typeof packageCacheNamespaces)[number] | `datasource-releases-${string}`;
export type CombinedKey =
`datasource-mem:pkg-fetch:${PackageCacheNamespace}:${string}`;