AR namespace statistics: disable confirmation figures
What does this MR do and why?
Disabling an organization's Artifact Registry asks the owner to type the registry handle, but the confirmation says nothing about what is behind that handle. This MR names the repository count and the stored size in the confirmation body, for example Repositories: 3 and Storage used: 20.42 MiB, so the owner sees the scope of what they are turning off before confirming.
Stacked on !256610 (merged), which adds the artifactRegistry { statistics } GraphQL field this reads. This MR targets that branch and must be rebased onto master once it merges. It is a sibling of !256618 (merged) (the same figures in the repositories list header); the two touch utils.js identically and merge in either order.
No user-visible change yet: the settings page is behind the artifact_registry_ui feature flag, which is disabled by default.
What changed
get_artifact_registry.query.graphqlselectsstatistics { repositoriesCount deduplicatedSizeBytes }inside the registry block the activation section already reads. No extra browser request; the server makes one additional Artifact Registry read per settings page load (about 1 ms, a single counter-row lookup), which is the only Artifact Registry call this page makes.activation_section.vuepassesregistry.statisticsfrom its own query to the confirmation.disable_confirmation.vuetakes a nullablestatisticsprop and renders the figures as a list after the two existing consequence sentences. Each figure is nullable on its own and renders only when known, so an unknown figure is never shown as zero in a destructive confirmation; when neither is known, or the prop is null, the list is omitted and the handle prompt and the disable action are unchanged, so a statistics read failure never blocks disabling.utils.jsgainshumanSizeClamped, which clamps a negativededuplicatedSizeBytes(a reconciliation underflow can report one until it corrects; seenamespace_statistics_type.rb) so the modal shows0 Brather than negative bytes. Same helper as !256618 (merged).- Two new externalized strings;
locale/gitlab.potregenerated.
Tests
disable_confirmation_spec.js: both figures named, with string inputs that exercise the formatting (1,234,2.00 KiB); negative stored size renders as zero; only the known figure renders when the other is null; figures omitted while the action is still offered whenstatisticsis null or both figures are null.activation_section_spec.js: the statistics from the section's own query reach the confirmation.
References
- Implements: #628184
- Depends on: !256610 (merged) (GraphQL
statisticsfield on the registry type) - Sibling: !256618 (merged) (repositories list header)
- Parent: #627138 (closed)
Screenshots or screen recordings
Captured on GDK against a real local Artifact Registry (real per-user token exchange, no stubs) with three hosted repositories in the namespace. AR reported repositories_count: 3, deduplicated_size_bytes: 21408101. The registry was not actually disabled; every run ended with Cancel.
| Before | After |
|---|---|
![]() |
![]() |
Settings page and the modal in context
| Activation section (unchanged by this MR) | Modal over the page |
|---|---|
![]() |
![]() |
Statistics null: figures omitted, disable still offered
Simulated by intercepting the getArtifactRegistry response in the browser and replacing artifactRegistry.statistics with null; the rest of the registry block is untouched. The confirm button still enables once the handle is typed.
How to set up and validate locally
Requires a running Artifact Registry the monolith can reach. The steps below are what produced the screenshots.
-
Point GDK at your local AR in
config/gitlab.ymlunderdevelopment:and restartrails-web:artifact_registry: api_url: http://127.0.0.1:8090 service_token: secret_file: /path/to/ar-gitlab-api-service-tokenAR must run with
auth.token_exchangepointed at GDK's issuer (http://gdk.test:3000, JWKShttp://gdk.test:3000/oauth/discovery/keys, audiencegitlab-artifact-registry) andauth.gitlab_api.service_tokenset to the same value as the secret file above. -
In
rails console, enable the flags and pick an organization you own that has exactly one top-level group (activation derives the billing anchor from it and rejects an organization with several, which rules out the GDK default organization):Feature.enable(:artifact_registry_ui) Feature.enable(:org_stage_experimental) # organization pages gate org = Organizations::Organization.find_by!(path: 'ar-e2e') Group.where(organization_id: org.id, parent_id: nil).count # => 1 -
Activate the registry and create a few repositories from
/api/graphqlas an owner (X-GitLab-Organization-ID: <org id>header, PAT withapi):mutation { artifactRegistryActivate(input: { slug: "gdk" }) { errors registry { slug status } } } mutation { artifactRegistryRepositoryCreate(input: { name: "docker-hosted", format: DOCKER, kind: HOSTED, visibility: PRIVATE }) { errors repository { name } } }Push something into a repository so the size is non-zero, for example
oras cp --to-plain-http docker.io/library/alpine:3.20 127.0.0.1:8090/gdk/container/docker-hosted/alpine:3.20. -
Confirm the block the section reads resolves against the real service:
{ organization(id: "gid://gitlab/Organizations::Organization/<org id>") { artifactRegistry { slug status statistics { repositoriesCount deduplicatedSizeBytes } } } }Expected shape:
{"slug":"gdk","status":"active","statistics":{"repositoriesCount":"3","deduplicatedSizeBytes":"21408101"}}(your numbers will differ). -
Open
http://gdk.test:3000/o/<org path>/-/settings/artifact_registryand select Disable Artifact Registry. The modal body listsRepositories: <count>andStorage used: <size>matching the query above. Type the handle: the confirm button enables as before. Cancel unless you mean to disable. -
Frontend specs:
yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/settings ee/spec/frontend/packages_and_registries/artifact_registry/utils_spec.js
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.





