[BE] Security scanning loading indefinitely

Summary

Security scanning displays an indefinite loading state in some merge requests that have security scanners enabled.

Steps to reproduce

It's currently unknown under which circumstances this happens. However you can see the following example MRs which this bug is observed:

Current behavior

  • The security scanning section displays a loading spinner indefinitely
  • The frontend continuously polls the enabledScans GraphQL query
  • The enabledScans query (located at ee/app/assets/javascripts/vue_merge_request_widget/queries/enabled_scans.query.graphql) returns ready: false for both enabledSecurityScans and enabledPartialSecurityScans
  • Users cannot see the results from other security scanners that are actually running and completing successfully

Expected behavior

  • Security scanning should display the results from enabled scanners (e.g., API Fuzzing, Container Scanning, etc.)
  • The loading state should resolve once the enabled scanners complete
  • The ready field should return true or null when there are completed scans available

Root cause analysis

The issue appears to be in the backend logic that determines when security scans are "ready".

Possible solution

The enabledScans GraphQL query should return ready: true when:

  • All enabled security scanners have completed
  • OR return ready: null to indicate that polling should stop

Impact

  • Poor user experience with indefinite loading states
  • Unnecessary server load from continuous polling
  • Users cannot access security scan results from enabled scanners
Edited by 🤖 GitLab Bot 🤖