Remove merge_request_refresh_batched_commit_lookup feature flag

What does this MR do and why?

This MR removes the merge_request_refresh_batched_commit_lookup feature flag and keeps the batched code path permanently. The flag has been fully enabled on production since 2026-08-26 with no regressions, so the old per-merge-request lookup path can be deleted.

Detailed context for AI agents

Background:

  • Flag type: beta, default_enabled: true, introduced in milestone 19.3, actor: project.
  • Introduced by !248701 (merged) (merged 2026-08-19) as corrective action for production incident gitlab-com/gl-infra/production#22645 (closed), where large mirror pushes ran UpdateMergeRequestsWorker for 5-10 hours.
  • Rollout history on production: 25% of actors on 2026-08-21, 50% on 2026-08-25, 100% / fully enabled on 2026-08-26. No regressions or incidents reported since.

What the flag controlled: In MergeRequests::RefreshService#reload_merge_requests, on every push the service decides which open merge requests targeting the pushed branch need their diff reloaded (the "stacked" case - a merge request whose diff already contains one of the pushed commits).

  • Old path: asked each merge request individually via MergeRequestDiff#includes_any_commits?. Query count scaled with merge request count x push size.
  • New path: resolves the whole set in one query per 1,000-commit chunk via MergeRequestDiff.ids_including_any_commits.

Code changes:

  • app/services/merge_requests/refresh_service.rb: removed the Feature.enabled? gate and batched_commit_lookup_enabled?, deleted old_recheck_merge_requests_batched, renamed new_recheck_merge_requests_batched to recheck_merge_requests_batched. The service now always takes the batched path.
  • app/models/merge_request_diff.rb: removed #includes_any_commits? and the private #metadata_sha_exists?, since the old refresh path was their only caller. Reworded the comment on .ids_including_any_commits, which referred to the removed method.
  • config/feature_flags/beta/merge_request_refresh_batched_commit_lookup.yml: deleted.
  • spec/models/merge_request_diff_spec.rb: removed the #includes_any_commits? describe block.
  • spec/services/merge_requests/refresh_service_spec.rb: removed the two "feature flag is disabled" contexts.
  • spec/support/matchers/query_missing_diff_commit_columns.rb: updated the example in the header comment to use ids_including_any_commits instead of the removed method.

Confirmed no other callers of the removed methods exist in app, lib, ee, spec, or qa.

Verification performed:

  • Rubocop on all changed files: no offenses.
  • bundle exec rspec spec/services/merge_requests/refresh_service_spec.rb: 102 examples, 0 failures.
  • bundle exec rspec spec/models/merge_request_diff_spec.rb: 384 examples, 0 failures.

Rollback consideration: there is no old code path left in this MR, so reverting the flag behaviour would mean reverting this MR itself. The batched path has run at 100% on production since 2026-08-26.

Follow-up after merge: delete the flag from all environments with /chatops run feature delete merge_request_refresh_batched_commit_lookup --dev --pre --staging --staging-ref --production.

Commit uses Changelog: other, since this removes a default-on flag while keeping the feature itself unchanged.

References

Screenshots or screen recordings

Not applicable, backend-only change with no UI.

How to set up and validate locally

  1. Checkout this branch and run bundle install if needed.
  2. Run bundle exec rspec spec/services/merge_requests/refresh_service_spec.rb and confirm all examples pass.
  3. Run bundle exec rspec spec/models/merge_request_diff_spec.rb and confirm all examples pass.
  4. Optionally, in GDK: open a merge request targeting a branch, push a new commit to that branch, and confirm the merge request's diff reloads (the merge_request_diffs count increases) with a single ids_including_any_commits query for the push.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading