Add policy label for branch rule settings
What does this MR do and why?
This merge request adds visual indicators to show when branch protection rules are controlled by security policies.
The changes introduce two new components: a "PolicyBadge" that displays either "enforced by policy" or "policy warn mode" with a shield icon, and a "DisabledByPolicyPopover" that provides additional context. When a branch is protected by a security policy, the system now shows these visual cues next to the branch name and grays out any conflicting access level text to indicate those settings are overridden by the policy.
The implementation includes proper data flow from the backend (adding security policy fields to GraphQL queries), through the frontend components, and includes comprehensive test coverage. This helps users understand when their branch protection settings are being managed by organizational security policies rather than manual configuration.
References
Screenshots or screen recordings
| Description | UI |
|---|---|
| Policy enforced label and warning |
How to set up and validate locally
-
Go to Project -> Secure-> Policies -> New approval policy
-
Create policy in warn mode and this setting enabled
-
Go to Settings -> Repository -> Branch Rules
-
Make sure you see label and warning icon
-
Go back yo policy, updated it to enforced
-
Check settings again
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.
Related to #536379 (closed)