tomato·bazeldocs v0 · latest

D3 — a repo name CHOSEN on a SHARED extension must be namespaced

Dev-dep & toolchains · gates/d3_unnamespaced_extension_repo.rq ↗

Why this is an invariant#

From the rules_k8s post-mortem, verbatim: “A module extension’s repos are shared across the whole module graph, so oci.pull(name = "distroless_static") here collides with any consumer that pulls a base of that name”. Bazel’s error is “A repo named distroless_static_linux_amd64 is already generated by this module extension”. The shipped fix was to prefix with the module name.

Three distinctions carry the whole gate, and getting any of them wrong makes it useless:

  • FOREIGN extension only. Apparent repo names are module-scoped, so two unrelated modules both using @crates is not automatically a conflict — only a shared extension instance can collide.
  • CHOSEN names only. rust_toolchains is emitted by the rules_rust extension for everyone, so nobody is choosing it and there is nothing to collide. Flagging it would condemn the documented idiom used by 20+ modules.
  • NON-DEV usages only. A dev_dependency extension usage is dropped from every graph but the module’s own, so its repos are never in a consumer’s graph and cannot collide with anything. This mirrors D2, which has always split registersToolchain from registersToolchainDev — the projector emits gate:extDev and this gate simply never read it, so 8 of the 38 findings were modules being told to namespace a repo nobody else can see.

Namespacing is checked against gate:namespacePrefix facts, so rules_jena naming its Maven repo jena_maven passes.

Findings#

25 findings. Each row is a counterexample — the columns are the query's own, in the order it selects them.

modulerepoextension
botnoccrates@rules_rust//crate_universe:extension.bzl
fastverk-appcrates@rules_rust//crate_universe:extension.bzl
forgecrates@rules_rust//crate_universe:extension.bzl
forgedistroless_cc@rules_oci//oci:extensions.bzl
fvkitcrates@rules_rust//crate_universe:extension.bzl
meridian_chatnpm@aspect_rules_js//npm:extensions.bzl
meridian_tuicrates@rules_rust//crate_universe:extensions.bzl
meridian_uiview_corecrates@rules_rust//crate_universe:extensions.bzl
meridian_webnpm@aspect_rules_js//npm:extensions.bzl
rules_agentic_idecrates@rules_rust//crate_universe:extension.bzl
rules_cloudformationcfn_assembler_maven@rules_jvm_external//:extensions.bzl
rules_docker_composecompose_crates@rules_rust//crate_universe:extension.bzl
rules_huggingfacehf_crates@rules_rust//crate_universe:extension.bzl
rules_jsonschemacrates@rules_rust//crate_universe:extension.bzl
rules_loracrates@rules_rust//crate_universe:extension.bzl
rules_runpodcrates@rules_rust//crate_universe:extension.bzl
rules_schema_orgdcterms_ttl@rules_rdf//rdf:extensions.bzl
rules_schema_orgschemaorg_ttl@rules_rdf//rdf:extensions.bzl
rules_schema_orgskos_rdf@rules_rdf//rdf:extensions.bzl
rules_specmaven@rules_jvm_external//:extensions.bzl
trackercrates@rules_rust//crate_universe:extension.bzl
trackerdistroless_cc@rules_oci//oci:extensions.bzl
vpncrates@rules_rust//crate_universe:extension.bzl
vpndistroless_java@rules_oci//oci:extensions.bzl
wavecrates@rules_rust//crate_universe:extension.bzl