Refactor Commits API to use standard keyset pagination patterns
## Summary Refactor the Commits API keyset pagination implementation to align with GitLab's established patterns for git object pagination. This replaces the approach in gitlab-org/gitlab!229705 with a cleaner, more maintainable architecture. ## Problem When calling `/api/v4/projects/:id/repository/commits?all=true&page=N`, pagination is broken: every page returns the same commits. Git's `--reverse` flag reverses output *after* `--skip` and `--max-count` are applied, so offset pagination produces incorrect results. See gitlab-org/gitlab#586997. ## Approach Follow the established pattern used by `BranchesFinder`, `TagsFinder`, and `TreeFinder`: 1. Create a `CommitsFinder` class with `execute(gitaly_pagination:)` method 2. Integrate with `GitalyKeysetPager` for header generation 3. Refactor the API endpoint to use finder + pager (thin controller pattern) ## Implementation Phases **Phase 1: Core Infrastructure** (initial weight: 7) - gitlab-org/gitlab#595505 - Rubocop cleanup of `lib/api/commits.rb` - gitlab-org/gitlab#595506 - Create `CommitsFinder` - gitlab-org/gitlab#595507 - Integrate with `GitalyKeysetPager` - gitlab-org/gitlab#595508 - Refactor API endpoint (fixes gitlab-org/gitlab#586997) **Phase 2: Parameter Support** (can be parallel) - gitlab-org/gitlab#595513 - Support `path` parameter - gitlab-org/gitlab#595514 - Support `first_parent` parameter - gitlab-org/gitlab#595515 - Support `order` parameter **Phase 3: Documentation** - gitlab-org/gitlab#595509 - Update API docs **Phase 4: Future** (require Gitaly changes) - gitlab-org/gitlab#595516 - Support `trailers` parameter - gitlab-org/gitlab#595517 - Support `follow` parameter ## References - Original MR (to be superseded): gitlab-org/gitlab!229705 - [Keyset pagination docs](https://docs.gitlab.com/api/rest/#keyset-based-pagination) - Existing patterns: `app/finders/branches_finder.rb`, `app/finders/tags_finder.rb`, `lib/gitlab/pagination/keyset/pager.rb`
epic