Add AI triage eligibility module with profile support

What does this MR do and why?

Adds Vulnerabilities::AiTriage::Eligibility module that makes an attached triage_and_remediation profile a second source of truth for whether an AI vulnerability triage flow may run for a project. It sits alongside the existing duo_sast_fp_detection_enabled, duo_secret_detection_fp_enabled and duo_sast_vr_workflow_enabled project settings, and follows a similar shape as DependencyManagement::SecurityUpdate::Eligibility.

It exposes enabled?, severity_allowed? and auto_run? over three trigger types: sast_false_positive, secret_detection_false_positive and sast_vulnerability_resolution. The profile_for and configuration_for lookups behind them are memoized per project and trigger in Gitlab::SafeRequestStore.

The call sites OR the profile check into their existing eligibility predicates and gate the automatic enqueue on auto_run?. It replaces a hardcoded high_or_critical_severity? check with severity_allowed?. It also applies the existing with_projects scope to preload the project that the per-vulnerability checks now read.

Enablement and severity live in the predicates the workers re-check, so the automatic and bulk paths agree. run_mode sits only on the automatic callbacks, which the bulk path bypasses, so manual means "only when a user asks" rather than disabled.

Every predicate is a no-op where no profile drives the trigger. severity_allowed? returns the hardcoded high/critical gate when no profile threshold governs, and auto_run? returns true, since the settings path has no manual mode. secret_detection_false_positive has no severity_level in its trigger schema, so it always takes that fallback.

Enablement is an OR, configuration is profile-first:

Project setting Profile attached Enabled? Severity Run mode
hardcoded high or critical always automatic
profile severity_level profile run_mode
profile profile
- -

Changelog: added
EE: true

[Backend] Introduce a new Eligibility module fo... (#627964) • Gal Katz

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 Gal Katz

Merge request reports

Loading
Loading