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:
repositoriesCountdeduplicatedSizeBytes
The endpoint also returns componentsCount and downloadsCount; neither has a consumer, so they are omitted and remain additive later.
Design decisions
- No
FieldCallCountbound. 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 a404tonil; 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
@objectrather 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
GETper query, each mapped error status →nullwith noerrors, 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
- Implements: gitlab#628182
- Parent: gitlab#627138
- Client method: !254364 (merged)