Remove deprecate_scan_result_policies from violations and workers
What does this MR do and why?
This is part 2 of a 3-MR stack splitting !251778 (closed). It targets MR 1's branch (!252700 (merged)) and merges after MR 1; MR 3, which deletes the flag definition, targets this MR's branch and merges last.
It collapses the remaining Feature.enabled?(:deprecate_scan_result_policies, ...) branches in violation-handling and background-worker code to the enabled path. It also removes ActiveRecord scopes whose only remaining callers are the collapsed branches, and drops the remaining scan_result_policy fallbacks in these paths: the || scan_result_policy_reads OR-checks in the project policy checks, the || violation.scan_result_policy_id fallback in the violation comment service, and the scan_result_policy_id member of the violation details struct. The table stays load-bearing only for the violations upsert key and the any_merge_request read enumeration, which need a unique index on (approval_policy_rule_id, merge_request_id) before they can switch (tracked in the table-drop work item below).
Changes:
- Collapses FF branches in
Project#has_approval_policy_rules?/#approval_policy_rules_targeting_commits?(now checkingapproval_policy_rulesonly, no reads fallback),ScanResultPolicyViolation#bot_message_disabled?,Security::ScanResultPolicies::PolicyViolationDetails, bothUnenforceablePolicyRules*Workers,UpdateViolationsService,CreateViolationDetailsService,UnblockFailOpenApprovalRulesService,SyncAnyMergeRequestRulesService,FallbackBehaviorTrackingService,PolicyViolationCommentGenerator,GeneratePolicyViolationCommentService. - Deletes
ApprovalRuleLike.with_scan_result_policy_read,SoftwareLicensePolicy.with_scan_result_policy_read, andScanResultPolicyViolation.{for_approval_rules, including_scan_result_policy_reads, for_merge_request_and_scan_result_policies}— their last callers go away here. No indexes or migrations are touched; remaining query paths are unchanged. GeneratePolicyViolationCommentServicematches rules byapproval_policy_rule_idonly;UnblockFailOpenApprovalRulesServicedrops the read preload;PolicyViolationDetails::Violationno longer carriesscan_result_policy_id.- Updates ~12 spec files (removes FF-disabled contexts) and a query-count comment in
spec/requests/api/members_spec.rb.
References
Zero-downtime deployment safety
The flag is explicitly enabled on GitLab.com, so old-version nodes still evaluating Feature.enabled? take the same enabled path during a rolling deploy; no migrations or schema changes are involved.
MR acceptance checklist
This checklist encourages us to confirm any changes were analyzed for conformity with our guidelines. Please evaluate this MR against the MR acceptance checklist.