Repository navigation
Conversation
…the referrers A registry can answer a listing with one page and a Link header that points to the next page. The client drops the header, so the caller gets the first page only. Six tests expect the listings to follow the link and are ignored. Three tests pin what must not change: a request with a page size returns one page, and a response without a link ends the listing. Signed-off-by: Shareef Jalloq <shareef@jalloq.co.uk>
…the referrers A registry can answer a listing with one page and a Link header that points to the next page. The client dropped the header, so list_tags, catalog and pull_referrers returned the first page only, with no sign that the list was incomplete. list_tags and catalog now follow the links when the caller gives no page size, and return the entries of every page. With a page size they return one page, as before. pull_referrers follows the links and returns one index with the referrers of every page. The next URL is the first target of the Link header, resolved against the URL of the page. A link to another origin is an error. Signed-off-by: Shareef Jalloq <shareef@jalloq.co.uk>
sjalloq
requested review from
bacongobbler,
davidfestal,
flavio and
thomastaylor312
as code owners
November 30, 2026 22:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #319.
What changes
list_tags,catalogandpull_referrersnow follow theLinkheader that a registry sends when it answers a listing with only one page. Before, the client dropped the header, so the caller got the first page with no sign that the list was incomplete.list_tagsandcatalogwithnasNone: the client follows the links and returns the entries of every page.list_tagsandcatalogwithnasSome: one page, as before.nis the page size the caller asked for.pull_referrers: the client follows the links and returns one index with the referrers of every page.laststill means "start after this entry". It goes on the first request only; the requests after it use the URL from theLinkheader as the registry sent it.No signature changes and there are no new methods. The blocking client calls the async methods, so it gets the same behaviour.
Why it is done this way
nto get one page, or to limit the result, is not affected.Repository.TagsandRegistry.Repositoriesloop until a response has noLinkheader, and sendlaston the first request only. The next URL is read as inparseLink: the first<...>target, resolved against the URL of the page.SpecViolationErrorthat names the link.How behaviour differs from
mainRun by hand against
registry:3.1.2with its default configuration and 101 repositories. The registry answersGET /v2/_catalogwith 100 repositories andLink: </v2/_catalog?last=repo099&n=100>; rel="next".maincatalog(…, None, None)repo099repo100catalog(…, Some(10), None)Other differences:
Linkheader is an error. Before, the header was not read.Linkheader ends the listing after one request.Not in this PR
nset, the caller still cannot see theLinkheader, and continues withlastas before. oras-go's own API is a callback per page; the equivalent here would be a stream of pages. That is the fuller fix and it is new API, so I have left it for a follow-up if you want it. It was option 3 in the issue.TagListMaxPagesand its siblings), off by default. It needs a new option inClientConfig.Tests
The first commit adds nine tests in
tests/listing_pagination.rs, against a fake registry that records its requests. Six are ignored because they fail onmain: relative links for the tag list, an absolute link for the catalog,laston the first request only, a link to another origin, aLinkheader without a target, and two pages of referrers. Three pass onmainand guard what must not change: a page size returns one page for the tag list and for the catalog, and a response without a link ends the listing. The second commit is the fix and enables the six.To see the failures:
cargo test --test listing_pagination -- --include-ignoredon the first commit.