Artifact registry: connect manifest detail and paginate referrers

What does this MR do and why?

This change is behind the feature flag :artifact_registry_ui, which is default-off. It is EE-only, and the page stays dark.

The Docker and OCI manifest detail page was built against a local Apollo layer: both of its query documents selected their fields with @client, and a runtime mock resolver answered them. That layer existed because Artifact Registry served no single-manifest read at all — the by-digest route was DELETE only, so there was nothing to query. Artifact Registry serves that read now and the monolith reads it, so this MR connects the page to the schema, removes the local layer, gives the page its first entry point from the manifest list, and pages the Referrers tab.

It carries three steps of the phase plan — Step 15 (connect the view), Step 11 (the list row link, which the plan folds into Step 15), and Step 10 (referrers keyset pagination) — so it is larger than the ~500 reviewable LOC the plan aims at, though the teardown means it deletes more than it adds. If the size is a problem, the plan's own documented fallback is to split the row link back out as its own step behind this one; say so and I will.

Six commits, in dependency order:

  1. Read the manifest detail from the schema. Drops @client from get_manifest.query.graphql and get_manifest_referrers.query.graphql, deletes graphql/mock_resolvers.js and the manifest half of graphql/mock_artifacts.js, drops the mockResolvers argument from repositories/index.js, repoints the stories onto mocked Apollo handlers, adds a :js feature spec, and turns the manifests table digest cell into a router link to the page.
  2. Page the referrers tab. Adds the cursor variables to the referrers document and a GlKeysetPagination to referrers_section.vue, reading its cursor from the route query through the shared page-params helper.
  3. Fix four findings from a self-review, recorded in full in a comment below: the referrers read is now announced in the page's live region, the errored page-info guard has a test that can actually fail, and a document selection plus four typename constants that only the removed mock layer needed are gone.
  4. Consolidate the Storybook fixtures. The artifact generators sat under graphql/ only because they fed the deleted local resolver; they are now folded into the spec tree's mock data, where the manifest stories already read their fixtures from.
  5. Trim the specs. Removes the mock-data spec, since fixtures are not a unit under test, and folds the referrers paging cases back into the component's own spec file over a reactive mocked route rather than a second file with a real router.

Three things worth a reviewer's attention:

  • The field name and both argument names the schema declares match what the local layer declared, which is why this is a directive removal rather than a document rewrite. The :js feature spec is what establishes that, driving both documents through the real schema and resolvers in a browser.
  • The referrers tab could not show data before this MR. Its document asked the server for the manifest while the rows came from the mock, and a server-resolved parent carries no seeded rows to hand back. Connecting the read is what makes the tab work.
  • The referrers query needs CACHE_AND_NETWORK. The connection's cache policy keys on no argument, so under the default cache-first policy a cursored read is answered from the page already held and the pager moves nothing. This was found in a browser, not by a spec, so referrers_section_spec.js now asserts the re-read.

Two deliberate divergences from the plan, stated rather than left to be found:

  • The plan scoped the row link against the repository detail artifacts table, which links only for hosted repositories. This links unconditionally: the sibling referrers_table.vue already links manifest digests unconditionally, and the contract serves this page for a remote repository too: the platform triple and the annotations are null there, while children and referrers come back empty and the referrer count zero, which the sidebar and the tab already handle. A remote repository therefore gets a Referrers tab with a 0 count and the "Nothing refers to this manifest." empty state, not a hidden or errored one.
  • The plan listed a graphql/cache_config.js change and mock cursor slicing for Step 10. Neither was written. The referrers connection policy already keys on no argument and replaces on merge, which is what a keyset pager wants; and the mock work would have been written and deleted inside this one MR, so the pagination lands straight on the real connection instead.

References

Screenshots or screen recordings

Before After
Referrers tab before-referrers after-referrers
Referrers tab, page two No pager existed after-referrers-page-2
Manifests table digest cell before-table after-table

The two Referrers captures show different row counts, and that is the change rather than a difference in framing: the before state renders the one referrer the local Apollo mock seeded, and the after state renders the 26 that Artifact Registry holds, 20 of them on the first page. The manifests table pair is directly comparable, because that list was already server-backed — the only difference is that the digest is now a link.

How to set up and validate locally

This needs a local Artifact Registry the SPA can read from — the GDK client stub is enough, and it has to stand in for manifest and manifest_referrers, which are the two reads this MR starts making.

  1. Enable the flag in a Rails console:
    Feature.enable(:artifact_registry_ui)
  2. Visit a container repository's image at /o/<organization>/-/artifact_registry/<slug>/repositories/<repository>/<image_id>.
  3. Click a digest in the Digest column. It now navigates to that manifest's page, and the breadcrumb trail reads organization, Repositories, repository, image, short digest.
  4. Open the Referrers tab on a manifest with more than 20 referrers. Page forward with Next and back with Previous; the cursor is in the URL, so the page is shareable and survives a reload.
  5. Leave the Referrers tab and return to it. The cursor is dropped, so you land on the first page rather than mid-list.

What was run:

  • Jest over ee/spec/frontend/packages_and_registries/artifact_registry on Vue 2 and on Vue 3, 67 suites passing. Seven suites fail identically on master at the same commit on missing generated fixtures and contribute no tests either way: repository_detail_spec.js, upstream_repositories_table_spec.js, repositories_list_spec.js, repositories_table_spec.js, version_detail_paging_spec.js, version_detail_spec.js, version_list_spec.js.
  • bin/rspec ee/spec/features/artifact_registry/manifest_detail_spec.rb.
  • ESLint with --max-warnings 0 on every changed JavaScript and Vue file, and RuboCop on both new Ruby spec files.
  • locale/gitlab.pot is unchanged. The one string the row link needs, ArtifactRegistry|Manifest %{digest}, is already in the catalog from the referrers table.

No changelog trailer: the feature sits behind a default-off flag.

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.


Written by GitLab Duo

Edited by Zack Cuddy

Merge request reports

Loading
Loading