Send top_level_group as the Artifact Registry billing anchor type

What does this MR do and why?

ArtifactRegistry::ProvisionNamespaceService sends billing_entity_type: 'group' when it provisions an organization's Artifact Registry namespace. ADR-022 and the anchor table in monolith/S10 specify 'top_level_group', with the sole top-level group's id as billing_entity_id. The id was already correct.

This MR renames the client constant to BILLING_ENTITY_TYPE_TOP_LEVEL_GROUP, sets it to 'top_level_group', and points the provisioning service at it.

Artifact Registry stores the billing anchor once at provisioning and has no endpoint that changes it. Every namespace provisioned with the wrong type keeps it until an Artifact Registry data migration corrects it, so this needs to land quickly.

Tests

Before this change, the specs asserted the literal 'group', so they pinned the wrong value. They now assert 'top_level_group' in three places:

  • the client call in provision_namespace_service_spec.rb
  • the request body sent to Artifact Registry in provision_namespace_service_spec.rb, which uses the real client against a WebMock stub
  • the client call in the activate mutation request spec

To confirm the specs catch the bug, I ran them with the constant set back to 'group'. Exactly those three examples failed, and the stubbed request showed "billing_entity_type":"group" on the wire. With the fix, the service spec, the mutation request spec and ee/spec/lib/artifact_registry/client_spec.rb all pass: 1134 examples, 0 failures.

Changelog

There is no changelog entry, because the change is behind the default-off artifact_registry_ui feature flag.

Out of scope

This MR does not change namespaces that were already provisioned with 'group'. Those rows need an Artifact Registry data migration, which the checklist on #632844 (closed) tracks.

References

Screenshots or screen recordings

Not applicable. There is no UI change.

How to set up and validate locally

  1. Run the affected specs:
    bin/rspec ee/spec/services/artifact_registry/provision_namespace_service_spec.rb \
      ee/spec/requests/api/graphql/mutations/artifact_registry/activate_spec.rb \
      ee/spec/lib/artifact_registry/client_spec.rb
  2. Optionally, set ArtifactRegistry::Client::BILLING_ENTITY_TYPE_TOP_LEVEL_GROUP back to 'group' and re-run. The three billing-type assertions fail.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Edited by Narendran

Merge request reports

Loading
Loading