Skip to content

feat: implement OCI Distribution Spec v1.1 referrers API - #1

Open
mostlikelee wants to merge 18 commits into
timlee/REG-1267-v3.1.3-basefrom
timlee/REG-1267
Open

mostlikelee wants to merge 18 commits into
timlee/REG-1267-v3.1.3-basefrom
timlee/REG-1267

Conversation

@mostlikelee

@mostlikelee mostlikelee commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements the OCI Distribution Spec v1.1 referrers API (GET /v2/{name}/referrers/{digest}), completing the work started in #3834 and #4483.

This builds on the storage-layer subject linking by @brackendawson and @alistair (cherry-picked from #4483) and adds the read-side endpoint that was left as TODO.

What's included

From #4483 (storage layer — @brackendawson, @alistair):

  • Parse subject and artifactType fields on OCI manifest and index PUT
  • Create referrer link files on the filesystem under _referrers/
  • Validate subject.mediaType is a manifest type

New (referrers API endpoint):

  • Register GET /v2/{name}/referrers/{digest} route
  • Return an OCI Image Index (application/vnd.oci.image.index.v1+json) with descriptors for all manifests referencing the subject
  • Enrich each descriptor with mediaType, artifactType, and annotations from the manifest blob per spec
  • Resolve artifactType per spec: manifest field → config.mediaType fallback
  • Support ?artifactType= query parameter filtering with OCI-Filters-Applied response header
  • Return empty index (not 404) when no referrers exist
  • Enumerate referrer links from the filesystem storage layout

Tests

  • TestReferrersAPI — end-to-end test covering:
    • Push subject manifest, push artifact manifest with subject reference
    • Query referrers (unfiltered) — verify digest, mediaType, artifactType
    • Query with matching artifactType filter — verify filtering + header
    • Query with non-matching filter — verify empty result
    • Query for digest with no referrers — verify empty index
  • All existing tests pass (handlers, storage, manifest suites)

Spec references

Related PRs

teambush1 and others added 8 commits December 2, 2026 18:28
Signed-off-by: Alistair Bush <alistair.bush@gmail.com>
Co-authored-by: Alistair Bush <alistair.bush@gmail.com>
Co-authored-by: Bracken Dawson <abdawson@gmail.com>
Signed-off-by: lemonprogis <edward.briggler@gmail.com>
Signed-off-by: Edward Briggler <edward.briggler@gmail.com>
(cherry picked from commit 12fbb32)
Signed-off-by: Alistair Bush <alistair.bush@gmail.com>
Signed-off-by: lemonprogis <edward.briggler@gmail.com>
Signed-off-by: Edward Briggler <edward.briggler@gmail.com>
(cherry picked from commit 005e12a)
Signed-off-by: Alistair Bush <alistair.bush@gmail.com>

Signed-off-by: lemonprogis <edward.briggler@gmail.com>
Signed-off-by: Edward Briggler <edward.briggler@gmail.com>
(cherry picked from commit e4ffc83)
Signed-off-by: Alistair Bush <alistair.bush@gmail.com>
Signed-off-by: lemonprogis <edward.briggler@gmail.com>
Signed-off-by: Edward Briggler <edward.briggler@gmail.com>
(cherry picked from commit 2db525d)
…{digest})

Completes the referrers API per OCI Distribution Spec v1.1 by adding
the read-side endpoint on top of the storage-layer subject linking from
the previous commits.

- Register GET /v2/{name}/referrers/{digest} route
- Implement referrersHandler returning an OCI Image Index response
- Enumerate referrer links from the filesystem storage layer
- Enrich descriptors with mediaType, artifactType, and annotations
  from the manifest blob per spec requirements
- Support ?artifactType= query parameter filtering with
  OCI-Filters-Applied response header
- Return empty index (not 404) when no referrers exist
- Add comprehensive TestReferrersAPI covering unfiltered listing,
  artifact type filtering, non-matching filters, and empty results

Signed-off-by: lemonprogis <edward.briggler@gmail.com>
Signed-off-by: Edward Briggler <edward.briggler@gmail.com>
(cherry picked from commit 25ad9d0)
- Rename emptyJsonDescriptor to emptyJSONDescriptor (staticcheck ST1003)
- Regenerate docs/content/spec/api.md from template to include the
  referrers route

Signed-off-by: Edward Briggler <edward.briggler@gmail.com>
Signed-off-by: lemonprogis <edward.briggler@gmail.com>
(cherry picked from commit 3e01322)
Signed-off-by: Tim Lee <tim.lee@defenseunicorns.com>
Use the same tree as the verified rebase onto the upstream v3.1.3 tag.
Keep the existing Referrers and manifest read-fix commits in history.
@mostlikelee
mostlikelee changed the base branch from main to timlee/REG-1267-v3.1.3-base December 4, 2026 00:46
andrewg-xyz and others added 10 commits December 4, 2026 12:57
Signed-off-by: Andrew Greene <andrew@defenseunicorns.com>
(cherry picked from commit 143fa58)

(cherry picked from commit 6b9cd14)
Signed-off-by: Andrew Greene <andrew@defenseunicorns.com>
(cherry picked from commit 7f33b11)

(cherry picked from commit 53160a7)
Signed-off-by: Andrew Greene <andrew@defenseunicorns.com>
(cherry picked from commit 237abf1)

(cherry picked from commit 8c026bc)
Signed-off-by: Andrew Greene <andrew@defenseunicorns.com>
(cherry picked from commit 46a14a4)

(cherry picked from commit 9b55695)
Signed-off-by: Andrew Greene <andrew@defenseunicorns.com>
(cherry picked from commit 91ecf0b)

(cherry picked from commit 18b05c1)
Signed-off-by: lemonprogis <edward.briggler@gmail.com>

(cherry picked from commit 36748b8)
Signed-off-by: lemonprogis <edward.briggler@gmail.com>

(cherry picked from commit 7a6b069)
Signed-off-by: lemonprogis <edward.briggler@gmail.com>

(cherry picked from commit baceb84)
Signed-off-by: lemonprogis <edward.briggler@gmail.com>

(cherry picked from commit fade04f)
Signed-off-by: lemonprogis <edward.briggler@gmail.com>

(cherry picked from commit 28a817e)
@mostlikelee mostlikelee added this to the Registry/3.2.0 milestone Dec 4, 2026
@mostlikelee mostlikelee changed the title Timlee/reg 1267 feat: implement OCI Distribution Spec v1.1 referrers API Dec 4, 2026
@mostlikelee
mostlikelee marked this pull request as ready for review December 4, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants