Investigate N+1 query in policyAutoDismissed GraphQL field
Summary
This MR investigates a flaky test for the policyAutoDismissed GraphQL field that occasionally fails due to N+1 database queries.
Test Details:
- File:
ee/spec/graphql/types/vulnerability_type_spec.rb - Description:
Types::VulnerabilityType policyAutoDismissed N+1 queries behaves like N+1 queries avoids N+1 database queries - Issue: https://gitlab.com/gitlab-org/quality/test-failure-issues/-/issues/18468
Current Status:
The test fails intermittently with 2 extra queries related to loading primary_identifier for vulnerability findings. The root cause is not yet clear, as the policyAutoDismissed field (which calls dismissed_by_policy?) doesn't directly access primary_identifier.
Changes:
Updated the test to use exceed_query_limit(control) instead of a hardcoded query count. This will provide detailed diff output showing exactly which queries are extra and how many times they appear, helping us understand the root cause of the flakiness.
Once we have more information from the test output, we can determine the appropriate fix.