[FF] optimized_code_owner_entries_since_commit -- Use lightweight Gitaly RPC for code owner entries

Summary

This issue is to roll out the optimized code owner entries comparison on production, that is currently behind the optimized_code_owner_entries_since_commit feature flag.

When enabled, this feature uses the lightweight FindChangedPaths Gitaly RPC instead of the heavier CommitDiff RPC when finding code owner entries that changed between consecutive MR diff versions. FindChangedPaths returns only path metadata (no diff content), making it significantly faster. This is the largest bottleneck in MergeRequestResetApprovalsWorker (P95: 4.636s for entries_since_commit).

Falls back to the existing CommitDiff-based comparison when the feature flag is disabled.

Replaces the previous rollout issue #591569 (closed) (feature flag was renamed from use_db_diff_for_code_owner_entries).

Related issue: #579591

Owners

  • Most appropriate Slack channel to reach out to: #g_code_review
  • Best individual to reach out to: @marc_shaw

Expectations

What are we expecting to happen?

Significant reduction in entries_since_commit latency for the MergeRequestResetApprovalsWorker. Local benchmarks show a ~2.8x speedup. Production impact expected to be larger since the CommitDiff RPC cost scales with repo/diff size while FindChangedPaths returns only metadata.

What can go wrong and how would we detect it?

  • Incorrect path comparison could lead to wrong code owner approvals being reset. This would manifest as approvals being incorrectly preserved or incorrectly removed.
  • Monitor merge_request_reset_approvals_worker duration metrics and error rates.
  • Verified locally that FindChangedPaths produces identical path sets to CommitDiff across rename, delete, modify, and no-change scenarios (159 comparisons, 0 mismatches).

Rollout Steps

Rollout on non-production environments

  • Enable the feature flag on staging with /chatops run feature set optimized_code_owner_entries_since_commit true --dev --pre --staging --staging-ref
  • Verify that code owner approval resets work correctly on staging

Global rollout on production

  • Incrementally roll out the feature on production
    • /chatops run feature set optimized_code_owner_entries_since_commit 25 --actors
    • /chatops run feature set optimized_code_owner_entries_since_commit 50 --actors
    • /chatops run feature set optimized_code_owner_entries_since_commit 100 --actors
  • Monitor entries_since_commit duration metrics for improvement
  • Enable globally: /chatops run feature set optimized_code_owner_entries_since_commit true

Release the feature

  • Create a merge request to remove the feature flag
  • Close this issue

Rollback Steps

  • This feature can be disabled by running: /chatops run feature set optimized_code_owner_entries_since_commit false