Verify if any_approver rule could be set per protected branch

Problem

While implementing Branch rule editing: Minimum required approvals per target branch we realised that we only allow for creating one MR approval rule of type any_approver. The goal of Minimum required approvals per target branch is to have an option to set MR approval rule of type any_approver per protected branch.

Current implementation

Validation of a unique any_approver rule:

https://gitlab.com/gitlab-org/gitlab/blob/0a0ae8f1088928daa6b432d9179b0daf9a6feba1/ee/app/models/approval_project_rule.rb#L55

Preview of a unique any_approver rule:

applies_to_all_protected_branches: false
approvals_required: 1
contains_hidden_groups:false
eligible_approvers: []
groups: []
id: 113
name: "All Members"
protected_branches: []
report_type: null
rule_type: "any_approver"
users: []

Future implementation

Preview of a per protected branch any_approver rule:

applies_to_all_protected_branches: false
approvals_required: 1
contains_hidden_groups: false
eligible_approvers: []
groups: []
id: 114
name: "All Members"
protected_branches: [
  {
    allow_force_push: false
    code_owner_approval_required: false
    id: 45
    inherited: false
    merge_access_levels: []
    name: "*-test"
    push_access_levels: []
    unprotect_access_levels: []
  }
]
report_type: null
rule_type: "any_approver"
users: []

Questions

  1. Is there a reason why we shouldn't have more than one any_approver rule?
  2. Can we extend the validation to check if there is one all-branches any_approver rule, but also to check if there's only one branch specific any_approver rule?