[FF] `commits_keyset_pagination` -- Keyset pagination for the Commits API

Summary

This issue is to roll out the feature on production, that is currently behind the commits_keyset_pagination feature flag.

Introduced by !239139 (merged) (default off). This flag teaches Gitlab::Pagination::GitalyKeysetPager to recognize Repositories::CommitsFinder so the keyset pagination path can generate Link headers for the Commits API. Endpoint wiring is tracked separately in #595508.

Part of the epic: &21573

Owners

  • Most appropriate Slack channel to reach out to: #g_create_source_code
  • Best individual to reach out to: @hustewart

Expectations

What are we expecting to happen?

When enabled, requests to the Commits API that opt into keyset pagination (pagination=keyset) are served via the Gitaly keyset pagination path through Repositories::CommitsFinder, generating standard Link headers (rel="next") driven by finder.next_cursor. No behavior change is expected while the flag is off. The endpoint is not yet wired (deferred to #595508), so initial enablement validates the pager integration path.

What can go wrong and how would we detect it?

  • Incorrect or missing Link headers on commits listing, or pagination returning wrong/duplicate pages. Detect via API responses and integration tests.
  • Increased error rates / latency on the Commits API. Monitor the Rails request and Gitaly dashboards on https://dashboards.gitlab.net.
  • No data-loss risk (read-only Gitaly RPC; no SQL).

Rollout Steps

Note: Please make sure to run the chatops commands in the Slack channel that gets impacted by the command.

Rollout on non-production environments

  • Verify the MR with the feature flag is merged to master and has been deployed to non-production environments with /chatops gitlab run auto_deploy status <merge-commit-of-your-feature>
  • Deploy the feature flag at a percentage (recommended percentage: 50%) with /chatops gitlab run feature set commits_keyset_pagination 50 --actors --dev --pre --staging --staging-ref
  • Monitor that the error rates did not increase (repeat with a different percentage as necessary).
  • Enable the feature globally on non-production environments with /chatops gitlab run feature set commits_keyset_pagination true --dev --pre --staging --staging-ref
  • Verify that the feature works as expected. The best environment to validate the feature in is staging-canary as this is the first environment deployed to. Make sure you are configured to use canary.
  • If the feature flag causes end-to-end tests to fail, disable the feature flag on staging to avoid blocking deployments.

Before production rollout

  • If the change is significant and you wanted to announce in #whats-happening-at-gitlab, it best to do it before rollout to gitlab-org/gitlab-com.

Specific rollout on production

For visibility, all /chatops commands that target production must be executed in the #production Slack channel and cross-posted (with the command results) to the responsible team's Slack channel.

  • Ensure that the feature MRs have been deployed to both production and canary with /chatops gitlab run auto_deploy status <merge-commit-of-your-feature>
  • This flag uses a project-actor: /chatops gitlab run feature set --project=gitlab-org/gitlab,gitlab-org/gitlab-foss,gitlab-com/www-gitlab-com commits_keyset_pagination true
  • Verify that the feature works for the specific actors.

Preparation before global rollout

  • Set a milestone to this rollout issue to signal for enabling and removing the feature flag when it is stable.
  • Check if the feature flag change needs to be accompanied with a change management issue. Cross link the issue here if it does.
  • Ensure that you or a representative in development can be available for at least 2 hours after feature flag updates in production.
  • Ensure that documentation exists for the feature, and the version history text has been updated.
  • Notify the #support_gitlab-com Slack channel and your team channel (more guidance when this is necessary in the dev docs).
  • If this flag is or may be queried by external API consumers (for example, IDE extensions, Duo CLI, or CI integrations), follow the external API consumer guidance and ensure a fail-open mechanism is in place before the rollout milestone is finalised.

Global rollout on production

For visibility, all /chatops commands that target production must be executed in the #production Slack channel and cross-posted (with the command results) to the responsible team's Slack channel.

Release the feature

After the feature has been deemed stable, the clean up should be done as soon as possible to permanently enable the feature and reduce complexity in the codebase.

  • Create a merge request to remove the commits_keyset_pagination feature flag. Ask for review/approval/merge as usual. The MR should include the following changes:
    • Remove all references to the feature flag from the codebase.
    • Remove the YAML definitions for the feature from the repository.
  • Ensure that the cleanup MR has been included in the release package.
  • Close the feature issue to indicate the feature will be released in the current milestone.
  • Once the cleanup MR has been deployed to production, clean up the feature flag from all environments by running these chatops command in #production channel: /chatops gitlab run feature delete commits_keyset_pagination --dev --pre --staging --staging-ref --production
  • Close this rollout issue.

Rollback Steps

  • This feature can be disabled on production by running the following Chatops command:
/chatops gitlab run feature set commits_keyset_pagination false
  • Disable the feature flag on non-production environments:
/chatops gitlab run feature set commits_keyset_pagination false --dev --pre --staging --staging-ref
  • Delete feature flag from all environments:
/chatops gitlab run feature delete commits_keyset_pagination --dev --pre --staging --staging-ref --production