Policy editor creates empty merge requests when updating schedule conditions

Title

Scan execution policy editor creates empty MRs when updating UI fields that don't change YAML

Description

When updating certain UI fields in the scan execution policy editor (such as "Conditions > Schedules > Run for"), the system creates a merge request even though no actual changes are made to the underlying policy YAML configuration.

Current Behavior

  • Edit existing scan execution policy
  • Change "Run for" value to 1 (or other UI-only fields)
  • Save policy
  • Creates an empty merge request with no diff
  • MR shows no changes to the .gitlab/security-policies/policy.yml file

Expected Behavior

  • Should only create MR when actual policy YAML changes
  • UI-only updates that don't affect the policy configuration shouldn't trigger MR creation
  • Should validate if content has actually changed before creating MR

Steps to Reproduce

  1. Open existing scan execution policy in editor
  2. Navigate to Conditions > Schedules > Run for
  3. Change value to 1
  4. Click Configure with a merge request
  5. Observe: MR is created but contains no actual changes

Impact

  • User Experience: Unnecessary MRs clutter project history
  • Confusion: Team members review empty MRs with no changes
  • Workflow disruption: Requires manual cleanup of empty MRs
  • Audit trail pollution: Makes it harder to track actual policy changes

Workaround

  • Manually close empty MRs
  • Edit policy YAML directly in the repository instead of using the UI editor
Edited by 🤖 GitLab Bot 🤖