Gate the version list delete actions on the artifact verdict
What does this MR do and why?
This MR is part of the Artifact Registry permission gating work (spec monolith/S15). It gates the heading kebab menu and every row's delete item on the Artifact Registry version list page on the deleteArtifact verdict.
The version list page lists the versions of a package, or the manifests of a container image. Its heading holds a kebab menu with one item, which deletes the whole artifact (Delete package or Delete image). Each row also has a kebab menu with two items: "View pull command" and a delete item. The delete item reads Delete version on a version row, or Delete manifest on a manifest row.
Before this change, the heading and row delete items rendered for every viewer. Artifact Registry authorizes the delete itself, so a viewer without the permission only found out on click.
The verdict comes from the repository's userPermissions block. The page's repository read now selects that block through the shared fragment ArtifactRegistryRepositoryVerdicts. This adds no extra request. The verdicts arrive with the data they gate.
version_list.vue computes the block and passes it down as a new permissions prop, to artifact_actions.vue for the heading and to versions_section.vue for the rows. artifact_actions.vue reads the verdict through the shared permissionAllows helper with the REPOSITORY_PERMISSION_DELETE_ARTIFACT constant. versions_section.vue passes the same prop to versions_table.vue and manifests_table.vue, and each table adds a canDelete computed that reads the verdict the same way. None of these components names a schema field itself.
The two menus behave differently on a denied verdict. The heading menu holds only the delete item, so a denial renders no menu toggle at all, instead of a toggle that opens an empty list. The row menus also hold "View pull command", so a denial removes only the delete item. The toggle and the pull command item stay, since no verdict gates them.
permissionAllows answers false for an unresolved block, so no delete item renders, in the heading or in any row, before the page's repository read resolves. The delete confirmation modal stays mounted and closed on a denied row or heading, as before.
Artifact Registry still authorizes every delete. The verdict only decides what renders. If a verdict allows the action but the registry denies it, the error the mutation returns still surfaces.
Fetch policy change
The page's repository read used the default cache-first policy. It now uses cache-and-network, plus notifyOnNetworkStatusChange.
A verdict must not render from cache without a re-check. With cache-and-network, a revisit re-reads the repository in the background. notifyOnNetworkStatusChange lets the page render the cached artifact right away, instead of dropping back to a skeleton. This matches the repository detail page's existing behavior.
While that re-read is in flight, the page hands the actions component no verdict block, so no delete item appears until the fresh answer arrives. A new isInitialLoad computed keeps the skeleton and the loading announcement for the first read only.
The connection read on the same page already used cache-and-network. This change applies to the repository read only.
Cache policy addition
Three documents now select userPermissions on the same cached repository entity, each with a different field set. The artifact read selects all nine verdicts through the shared fragment. The repository detail read and the edit prefill read each select three.
Without a merge policy, Apollo warns that cache data may be lost when a narrower read replaces a wider one. This MR adds a merge: true field policy for userPermissions on the repository details type, so each read updates the verdicts it carries and leaves the rest readable.
Everything ships behind the default-off artifact_registry_ui feature flag, so this MR has no changelog entry.
References
- Gate the version list heading actions (artifact... (#629678 - closed) • Rahul Chanila • 19.5
- Gate the version and manifest row deletes (arti... (#629679 - closed) • Rahul Chanila • 19.5
- Tracking work item: Gate Artifact Central UI controls with permissi... (#627317) • Unassigned
- https://gitlab.com/gitlab-org/ops/artifact-registry/-/blob/main/docs/specs/monolith/S15-permission-gated-controls.md
Screenshots or screen recordings
The author will add screenshots for both states.
| Page types | without permission | with permission |
|---|---|---|
| Manifest list (ex, Docker) | ![]() |
![]() |
![]() |
||
| Version list (maven) | ![]() |
![]() |
![]() |
How to set up and validate locally
- Enable the feature flag in a Rails console:
Feature.enable(:artifact_registry_ui, organization) - Run the Jest specs this MR changes:
yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/repositories/versions/artifact_actions_spec.js yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/repositories/versions/version_list_spec.js yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/repositories/versions/versions_table_spec.js yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/repositories/versions/manifests_table_spec.js yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/repositories/versions/versions_section_spec.js yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/graphql/cache_config_spec.js yarn jest ee/spec/frontend/packages_and_registries/artifact_registry/graphql/mock_resolvers_spec.js - Regenerate the query fixture, then the feature specs. The feature specs need compiled webpack assets, so rebuild them first if they are stale:
bin/rspec ee/spec/frontend/fixtures/artifact_registry/artifact.rb yarn webpack bin/rspec ee/spec/features/artifact_registry/versions_spec.rb bin/rspec ee/spec/features/artifact_registry/repositories_spec.rb - Open a package or image page under a repository in the organization's Artifact Registry. The gated menu needs an Artifact Registry deployment that answers permissions.
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.





