Loading
Support order parameter with keyset pagination in Commits API
What does this MR do and why?
Enables the order parameter to work with keyset pagination (pagination=keyset) in the Commits API (GET /projects/278964/repository/commits).
Part of epic &21573, closing #595515 (closed).
Previously order was rejected as unsupported when using keyset pagination, returning a 400. Gitaly's ListCommits RPC already supports ordering via its order field, so the limitation was self-imposed in the Rails finder.
What
- Remove
orderfromRepositories::CommitsFinder::UNSUPPORTED_KEYSET_PARAMS. - plumb
orderthroughlist_commitsin the keyset branch
Keyset mode remains gated behind the commits_keyset_pagination feature flag (default off); when off, behavior is unchanged.
How to set up and validate locally
- In
rails console:Feature.enable(:commits_keyset_pagination), thengdk restart rails-web. - Fetch a topo-ordered keyset page:
Expect 200, topologically ordered results, and a
curl -s -D - --header "PRIVATE-TOKEN: $TOKEN" \ "http://gdk.test:3000/api/v4/projects/$ID/repository/commits?pagination=keyset&order=topo&per_page=5"Link: ...; rel="next"header. Walk thepage_tokenand confirm subsequent pages return different, non-overlapping commits. - Confirm
order=default(and omittingorder) returns200
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
Related to #595515 (closed)
Edited by Hunter Stewart