Remove approval_rules_finalize_bulk_copy_approvers feature flag
Removes the approval_rules_finalize_bulk_copy_approvers feature flag. It has been enabled for 100% of projects on GitLab.com since 2026-09-24 with no regressions, so ApprovalRules::FinalizeService now always bulk inserts the approvers when it copies project approval rules to a merged merge request.
Detailed context for AI agents
What does this MR do and why?
- Drops the
bulk_copy_approvers?guard inApprovalRules::FinalizeService#copy_project_rules. The copied rule is always built withoutusers:/groups:, saved, and thencopy_approversinserts the approver join rows with oneApprovalMergeRequestRulesUser.insert_allper rule (idempotent on[approval_merge_request_rule_id, user_id], withproject_idset) and assignsrule.groups. The old path assignedusers:through the habtm association, which made autosave validate everyUserrecord inside the finalize transaction. - Removes the
bulk_copy_approvers?method and itsstrong_memoize_attr. - Deletes the flag definition
ee/config/feature_flags/gitlab_com_derisk/approval_rules_finalize_bulk_copy_approvers.yml. - Removes the flag-disabled spec context in
ee/spec/services/approval_rules/finalize_service_spec.rb. The remaining examples assert the copied rules, users, groups and approved approvers, and thatinsert_allis called once.
Behaviour kept: rules that fail validation are still deleted from the association and logged, and copy_approvers is only called after save!. If the insert raises, the finalize transaction rolls back as before. No schema or data change; the rows written to approval_merge_request_rules_users are identical with the flag on or off.
Rollout history (from the rollout issue): staging and gitlab-org/gitlab 2026-09-23, 5% of projects 2026-09-23, 20% and 50% 2026-09-24, 100% 2026-09-24. Watched MergeWorker on the Sidekiq worker detail dashboard and the PatroniLongRunningTransactionDetected alerts; nothing regressed.
References
- Rollout issue: #629137 (closed)
- Feature issue (long-running transactions in MR workers): #628868 (closed)
- Introduced by: !255631 (merged)
- Sibling flag removal from the same feature issue: !260000 (merged)
Screenshots or screen recordings
Not applicable, backend-only flag removal.
How to set up and validate locally
- On an EE GDK, in a project with approval rules that have user and group approvers, enable Settings > Merge requests > Prevent editing approval rules in merge requests.
- Merge a merge request in that project.
- In the Rails console confirm the copied rules carry the approvers:
MergeRequest.last.approval_rules.regular.map { |r| [r.name, r.users.map(&:username), r.groups.map(&:path)] }.
Verification
bundle exec rspec ee/spec/services/approval_rules/finalize_service_spec.rb- 14 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.