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 order from Repositories::CommitsFinder::UNSUPPORTED_KEYSET_PARAMS.
  • plumb order through list_commits in 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

  1. In rails console: Feature.enable(:commits_keyset_pagination), then gdk restart rails-web.
  2. Fetch a topo-ordered keyset page:
    curl -s -D - --header "PRIVATE-TOKEN: $TOKEN" \
      "http://gdk.test:3000/api/v4/projects/$ID/repository/commits?pagination=keyset&order=topo&per_page=5"
    Expect 200, topologically ordered results, and a Link: ...; rel="next" header. Walk the page_token and confirm subsequent pages return different, non-overlapping commits.
  3. Confirm order=default (and omitting order) returns 200

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Related to #595515 (closed)

Edited by Hunter Stewart

Merge request reports

Loading
Loading