Expose manifest preview arrays on the Artifact Registry GraphQL list type

What does this MR do and why?

This MR exposes three preview arrays on the GraphQL list type ArtifactRegistryManifest: tagsPreview, childrenPreview, and parentsPreview. Each holds the first ten entries of the corresponding full array that the Artifact Registry manifests-list endpoint already returns per row (AR OpenAPI ContainerManifest schema: tags_preview, children_preview, parents_preview).

Without these fields, a client listing manifests cannot render the Tags, Platforms, and "Referenced by" columns from list data; it would need one detail call per row. The list endpoint already returns the previews, but the GraphQL list type did not surface them.

Implementation:

  • Added tags_preview, parents_preview, and children_preview readers to the ArtifactRegistry::Manifest client value object (ee/lib/artifact_registry/manifest.rb). tags_preview and parents_preview use the existing string_list helper, which drops non-string entries. children_preview uses hash_list and then keeps only entries with a string digest, so a malformed child can never null the non-null-element GraphQL list.
  • Exposed the three as experiment fields (milestone 19.15) on ArtifactRegistryManifest. childrenPreview reuses the existing ArtifactRegistryManifestPlatform type; tagsPreview and parentsPreview are lists of strings.

The preview fields are list-only. ArtifactRegistryManifestDetails subclasses the list type, but the detail endpoint returns no preview keys, so an inherited preview would resolve null and falsely read as a deployment predating the field. The detail type therefore excludes the three previews (overriding fields and get_field, following the Resolvers::MergeRequests::RootResolver precedent for hiding inherited arguments); a detail consumer selects the full arrays (tags, children, parentDigests) plus parentsCount instead.

The list carries no parents total: tagsCount and childrenCount ride on every row, but parentsCount is detail-only.

Regenerated GraphQL docs (doc/api/graphql/reference/_index.md) and public/-/graphql/introspection_result.json.

References

Screenshots or screen recordings

No UI ships in this MR. It is a backend GraphQL schema change, so no screenshots apply.

How to setup and validate locally

The following exercises the preview readers' filtering and nil-vs-empty behavior in a rails console or via rails runner:

m = ArtifactRegistry::Manifest.new(
  'digest' => 'sha256:aaaa',
  'tags_preview' => ['latest', 123],
  'parents_preview' => ['sha256:parent'],
  'children_preview' => [
    { 'digest' => 'sha256:child', 'architecture' => 'amd64' },
    { 'architecture' => 'arm64' },
    'oops'
  ]
)

raise 'tags_preview filter failed'     unless m.tags_preview == ['latest']
raise 'parents_preview failed'         unless m.parents_preview == ['sha256:parent']
raise 'children_preview filter failed' unless m.children_preview == [{ 'digest' => 'sha256:child', 'architecture' => 'amd64' }]

absent = ArtifactRegistry::Manifest.new('digest' => 'sha256:z')
raise 'absent tags_preview should be nil'     unless absent.tags_preview.nil?
raise 'absent children_preview should be nil' unless absent.children_preview.nil?

empty = ArtifactRegistry::Manifest.new('tags_preview' => [], 'children_preview' => [])
raise 'empty tags_preview should be []'     unless empty.tags_preview == []
raise 'empty children_preview should be []' unless empty.children_preview == []

puts 'OK: preview readers filter malformed entries, keep nil vs empty distinct'

Automated coverage: value-object specs (ee/spec/lib/artifact_registry/manifest_spec.rb), GraphQL type spec (ee/spec/graphql/types/artifact_registry/manifest_type_spec.rb), and an end-to-end request spec (ee/spec/requests/api/graphql/organizations/artifact_registry_manifests_spec.rb) including a malformed-child case.

MR acceptance checklist

This checklist encourages us to confirm any changes work as expected. Please review the guidelines and select applicable items.

Edited by Narendran

Merge request reports

Loading
Loading