Remove merge_request_metrics_outside_merge_transaction feature flag
Removes the merge_request_metrics_outside_merge_transaction feature flag. It has been enabled for 100% of projects on GitLab.com since 2026-09-24 with no regressions, so MergeRequests::PostMergeService now always computes the merge request metrics before the post-merge event transaction opens.
Detailed context for AI agents
What does this MR do and why?
- Drops the
Feature.enabled?guard aroundmetrics_service.prepare_merge_datainMergeRequests::PostMergeService#create_event, so the EEAnalytics::MergeRequestMetricsCalculatorreads (every commit and diff file of the MR from Gitaly) always happen beforeEvent.transactionopens rather than inside it. - Deletes the flag definition
config/feature_flags/gitlab_com_derisk/merge_request_metrics_outside_merge_transaction.yml. - Removes the flag-disabled spec context in
spec/services/merge_requests/post_merge_service_spec.rb. The remaining example asserts the orderingprepare_merge_data->Event.transaction->merge.
Behaviour kept: the EE MergeRequestMetricsService#merge fallback @calculated_merge_data || calculated_merge_data is unchanged, so merge still works if called without prepare_merge_data (covered by ee/spec/services/ee/merge_request_metrics_service_spec.rb). No schema or data change; the values written to merge_request_metrics are identical with the flag on or off.
Rollout history (from the rollout issue): staging 2026-09-17, gitlab-org/gitlab 2026-09-18, 20% of projects 2026-09-22, 50% 2026-09-23, 100% 2026-09-24. Watched MergeWorker error ratio and DB duration on the Sidekiq worker detail dashboard and the PatroniLongRunningTransactionDetected alerts; nothing regressed.
References
- Rollout issue: #629135 (closed)
- Feature issue (long-running transactions in MR workers): #628868 (closed)
- Introduced by: !255421 (merged)
Screenshots or screen recordings
Not applicable, backend-only flag removal.
How to set up and validate locally
- Merge any merge request on an EE GDK.
- In the Rails console confirm the metrics were written:
MergeRequest.last.metrics.slice(:merged_at, :commits_count, :added_lines, :removed_lines).
Verification
bundle exec rspec spec/services/merge_requests/post_merge_service_spec.rb- 26 examples, 0 failures.- Rubocop clean on both changed Ruby files.
MR acceptance checklist
Evaluated against the MR acceptance checklist. Flag removal only, no new risk in quality, performance, reliability, security, or maintainability.