Draft: Offer the approval removal settings as radio options
What does this MR do and why?
Adds the rule-mode control for the remove_code_owner_approvals_with_new_commit approval setting introduced in !242393 (merged). That MR added YAML and backend support plus the indicator on the project merge request approval settings page, but rule mode had no way to set it. This MR targets 14088-add-codeowner-setting-in-policy (242393's branch), not master, so the diff only shows the editor changes. Retarget to master once 242393 merges.
remove_approvals_with_new_commitandremove_code_owner_approvals_with_new_commitare mutually exclusive, so rule mode now renders one When a commit is added: radio group (Keep approvals / Remove all approvals / Remove approvals by Code Owners if their files changed), matching the project settings page.- The group label is a
legendfor an accessible name. Each option keeps its own tooltip. - Selecting an option writes both keys so they can never both be enabled.
from_yaml.jsrejects a policy with both keys enabled, mirroring the JSON schema constraint from the first MR.- The Code Owner option renders when
approval_policy_selective_code_owner_removalsis enabled, or when the policy being edited already has that key — so editing an existing policy with the flag off doesn't silently strip the setting. - Flag off and key absent: unchanged behavior,
remove_approvals_with_new_commitstays a plain checkbox.
Changed: settings.js, settings_item.vue, settings_section.vue, editor_component.vue, from_yaml.js, both security/policies_controller.rb files (push the flag to the frontend), and four Jest specs.
Screenshots or screen recordings
Verified in the policy editor against a local GDK (flightjs/Flight, flag enabled) under Advanced > Merge request approval settings.
Recording (3x), hovering each option's tooltip then walking through all three choices, with the .yaml preview tracking each selection:
| Before: remove all (the default) | After: Code Owner option selected |
|---|---|
![]() |
![]() |
Editor showing a saved policy with the new option selected:
- The three options render as one radio group.
- The
.yamlpreview tracks each selection. - With the flag off, the group is not rendered and the existing setting stays a checkbox.
No console errors beyond pre-existing Vue development warnings.
How to set up and validate locally
- Enable the
approval_policy_selective_code_owner_removalsfeature flag. - Open a merge request approval policy in the policy editor, rule mode, and expand Advanced > Merge request approval settings.
- The When a commit is added: group offers Keep approvals / Remove all approvals / Remove approvals by Code Owners if their files changed; the
.yamlpreview updates with each choice. - Disable the flag and reload: the group is gone and
remove_approvals_with_new_commitis a checkbox again.
References
- Depends on !242393 (merged) (retarget to
masteronce it merges) - Related to &14088
- Rollout: #604018
Notes for reviewers
- The three radio strings duplicate identical
ApprovalSettings|strings from the project settings page. That's the established per-namespace i18n convention here, not an oversight. - Deliberately out of scope: hardening
getEnabledinsettings_item.vueagainst{ enabled: false }. Follow-up.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.


