Repository navigation
Conversation
The list-attestations endpoints for users, organizations and repositories page with `before`/`after` cursors and ignore `page`. ListAttestations took ListOptions, so callers could not reach any page after the first, and ListAttestationsIter stopped after one page because the Link header never carries a page number. Take ListCursorOptions instead, as other cursor-paginated endpoints do, and regenerate the iterators. BREAKING CHANGE: `ListAttestations` and `ListAttestationsIter` on `OrganizationsService`, `RepositoriesService` and `UsersService` now take `*ListCursorOptions` instead of `*ListOptions`.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4755 +/- ##
=======================================
Coverage 98.63% 98.63%
=======================================
Files 204 204
Lines 19165 19165
=======================================
Hits 18904 18904
Misses 261 261 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
The list-attestations endpoints (
GET /users/{username}/attestations/{subject_digest},/orgs/{org}/...,/repos/{owner}/{repo}/...) page withbefore/aftercursors; the OpenAPI description hasper_page,before,afterand nopage.ListAttestationstakes*ListOptions, so:page=2and returns page 1 again), andListAttestationsIterstops after one page, because theLinkheader carriesafter=..., never a page number.This switches the three methods to
*ListCursorOptions, asListConcurrencyGroupsandListOrganizationCopilotSpacesalready do for cursor-paged endpoints, and regenerates the iterators (they now followresp.After). This is a breaking change: callers passing&github.ListOptions{PerPage: n}change it to&github.ListCursorOptions{PerPage: n};nilstill works.flowchart TD A[List attestations for a digest with per_page 1] --> B{Second page} B -->|Before| C[Iterator stops after one attestation] B -->|After| D[Iterator sends after cursor and gets both]Narrated recording, before then after (sound on):
evidence.mp4
The demo calls the real API (read-only) for a
gh2.106.0 release asset incli/cli, which has two attestations, and logs each request:Commands and output
master:
this branch:
Edge cases and unchanged behaviour checked (against the real API in the demo): the org endpoint pages the same way, the default page size (
nilopts) still returns both, and a digest with a single attestation returns one.Tests:
go test -run Attestation ./githubpasses; the updated unit tests check thatafterandper_pageare sent. On master the same cursorLinkheader makesListAttestationsIterreturn 3 of 7 items (checked with a throwaway test; the updated tests do not compile against master's signature).script/lint.shpasses. I did not run the fullscript/test.sh.AI assistance: Claude Code found the bug and wrote the change, the test updates and the demo.
🤖 Generated with Claude Code