Fix empty popover when pre-enforcement policy overrides setting

What does this MR do and why?

Fixes a bug in PolicyOverrideWarningIcon where a policy created before the enforcement_type field was introduced (pre-enforcement policy) could produce an empty popover.

Root cause: hasApprovalSettingsOverride was derived from policiesWithSettingsOverride.length > 0, but a pre-enforcement policy (no enforcement_type) passes the hasSettingsOverride check while failing both the enforced (=== 'enforce') and warn (=== 'warn') filters. This left the popover open with no content rendered.

Fix:

  1. enforcedPoliciesWithSettingsOverride now includes policies where enforcement_type is absent — pre-enforcement policies default to the enforced behavior, which matches the original intent.
  2. hasApprovalSettingsOverride is now derived from the two display-level computed properties (enforcedPoliciesWithSettingsOverride and warnPoliciesWithSettingsOverride) rather than the intermediate policiesWithSettingsOverride, eliminating any case where the icon shows but the popover is empty.

References

#590825 (closed)

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. Enable the security_orchestration_policies_configuration feature flag (or ensure scan result policies are available).
  2. Set up a scan result policy on a project without an enforcement_type field in its YAML (i.e., a policy created before the enforcement_type field was added).
  3. Navigate to Settings → Merge requests for that project.
  4. Before this fix: the warning icon appears, clicking it opens an empty popover.
  5. After this fix: the warning icon only appears when there is content to show; the popover correctly shows the policy in the enforced section.

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.

Edited by Alexander Turinske

Merge request reports

Loading
Loading