AR namespace statistics: GraphQL statistics field on the registry type

What does this MR do and why?

Adds a statistics field to Types::ArtifactRegistry::RegistryType, resolving through the ArtifactRegistry::Client#namespace_statistics client method. This is the GraphQL surface the repositories header and the disable confirmation will read.

No user-visible change — behind the artifact_registry_ui feature flag (disabled), nothing selects the field yet.

The field

ArtifactRegistryNamespaceStatistics exposes two figures, both experiment BigInt, both nullable:

  • repositoriesCount
  • deduplicatedSizeBytes

The endpoint also returns componentsCount and downloadsCount; neither has a consumer, so they are omitted and remain additive later.

Design decisions

  • No FieldCallCount bound. The field is the node type of an organizations connection, so a per-definition call limit would raise on the second node. It follows the sibling permissions field and bounds cost with request-scoped memoization instead.
  • Every read failure resolves the field to null, never a GraphQL error. The client maps a 404 to nil; the resolver rescues the remaining client error arms so an unresolved read omits the figures rather than failing the surrounding query.
  • Slug read off the presenter. The resolver reads slug + organization from the registry presenter in @object rather than re-resolving the mapping.

Files

  • ee/app/graphql/types/artifact_registry/namespace_statistics_type.rb (new)
  • ee/app/graphql/resolvers/artifact_registry/namespace_statistics_resolver.rb (new)
  • ee/app/graphql/types/artifact_registry/registry_type.rb (mount the field)
  • regenerated doc/api/graphql/reference/_index.md + public/-/graphql/introspection_result.json
  • type, resolver, and request specs

Testing

  • Type spec: field shape and nullability
  • Resolver spec: presenter-slug read, per-request memoization, every failure arm → nil, flag-off
  • Request spec: one GET per query, each mapped error status → null with no errors, transport timeout, 404, flag-off

Confirmed locally: type + resolver + registry-type specs 25 examples, 0 failures; RuboCop clean. The request spec runs in CI (the local checkout cannot boot the request stack's asset pipeline).

References

Edited by Narendran

Merge request reports

Loading
Loading