Add the Artifact Registry Trash route behind a feature flag

What does this MR do and why?

Scaffolds the Artifact Registry Trash page (monolith/S11): its route and its own feature flag. The page itself, its reads and the View Trash entry point come in later MRs, once the spec settles.

  • Adds the artifact_registry_trash_ui wip flag. The page needs both it and artifact_registry_ui. The shared flag is already on where closed beta runs, so the page's own flag keeps it dark until it reads real trash data.
  • Adds the page at artifact_registry/<slug>/trash, beside the repositories area rather than inside its SPA, with its own Rails route, mount and app (decided in review). Trash holds repositories and artifacts, the path has a single -/, and it can't clash with a repository named trash.
  • The route runs the repositories area's gate and slug check, and the controller checks the Trash flag before resolving the slug. Every refusal is the same 404, so the route can't enumerate slugs. It has no sub-paths.
  • The page renders only its heading for now, with Repositories (linked to the repositories list), then Trash in the breadcrumb.

Why a trash action on the repositories controller

The page is a trash action on Organizations::ArtifactRegistryRepositoriesController, not a new controller. It opens under the same conditions as the repositories area, plus its own flag, and the controller only serves the Vue app.

Reasoning
  • Same gate. Trash needs ArtifactRegistryGating and the slug check (ensure_resolved_slug! and the methods behind it). The slug check is private to this controller, so a new controller would first need it moved into a shared concern.
  • Writes don't go through this controller. Emptying the trash will need more than read access, but it will follow the other Artifact Registry writes: a GraphQL mutation that Artifact Registry authorizes, with the UI hiding the action based on userPermissions. The controller only decides who can open the page.
  • The sidebar keeps working. The Repositories item matches on this controller, so it stays highlighted on Trash. If Trash gets its own sidebar item, both items can match on controller#action instead (active_routes: { path: ... }), as projects#activity does.
  • GitLab already does this. OrganizationsController serves activity, groups_and_projects and users as custom actions.

Worth splitting out if viewing Trash ever needs a different permission from viewing Repositories, or the page gains sub-paths or Rails endpoints of its own.

The feature is dark, so there is no changelog trailer.

References

Screenshots or screen recordings

Recorded on Caproni as root, organization and slug default, on the MR and on its base (master).

Before (master) After, flag on After, flag off
266124-before-master 266124-after-flag-on 266124-after-flag-off
artifact_registry/<slug>/trash has no route, so it returns 404. The Trash heading, with Repositories (linked to the list), then Trash in the breadcrumb. 404, the same response as an unknown slug.

The Trash route. Each video then opens a wrong slug and a sub-path (both 404), and the old repositories/-/trash path, which shows the same in-app not-found state as on master. The flag-on video also follows the Repositories crumb back to the list.

Master MR, flag on MR, flag off

The existing Artifact Registry pages: the list, the new hosted, remote and virtual forms, repository detail and edit, artifact versions, manifest detail, an unknown in-app path, the landing redirect, and settings. On every page the status, title, heading, breadcrumb links, pushed flags, and console and GraphQL errors match master.

Master MR

How to set up and validate locally

  1. Enable the flags for your organization in the Rails console:
    org = Organizations::Organization.default_organization
    Feature.enable(:artifact_registry_ui, org)
    Feature.enable(:artifact_registry_trash_ui, org)
  2. As a user who can read the organization's Artifact Registry, visit /o/<organization-path>/-/artifact_registry/<slug>/trash.
  3. Check that the page shows the Trash heading, with Repositories, then Trash in the breadcrumb, and that Repositories links to /o/<organization-path>/-/artifact_registry/<slug>/repositories.
  4. Disable artifact_registry_trash_ui and reload. The page returns 404.

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 Fiona McCawley

Merge request reports

Loading
Loading