Add securityAiFlowFeedbackCreate mutation for AI flow feedback
What does this MR do and why?
The feedback component in the frontend needs an API to send feedback to. This MR exposes the feedback service from !265540 (merged) through GraphQL:
- Adds an experimental
securityAiFlowFeedbackCreatemutation that takes a vulnerability ID, a sentiment and optional reasons. It callsVulnerabilities::SecurityAiFlowFeedbacks::CreateService. - Access follows the vulnerability's project. A missing vulnerability, a project the user can't read, and a disabled feature flag all return the same error.
- Adds the fine-grained token permission
create_security_ai_flow_feedback. - About 290 lines are generated docs and
introspection_result.json.
The design and decisions are in #636350 (closed).
References
- Issue: #636350 (closed)
- Stacked on !265540 (merged), and targets its branch. Next: !265521 (merged) (frontend).
How to set up and validate locally
-
In the Rails console, enable the flag:
Feature.enable(:security_ai_flow_feedback, project). -
Make sure the Duo Agent Platform is available for the project.
-
Pick a SAST vulnerability whose latest flag has origin
ai_sast_fp_detection. -
In GraphiQL (
/-/graphql-explorer), run:mutation { securityAiFlowFeedbackCreate(input: { vulnerabilityId: "gid://gitlab/Vulnerability/<id>", sentiment: DISAGREE, reasons: [VERDICT_WRONG] }) { errors } } -
Watch for the event with
bundle exec rake gitlab:internal_events:monitor[submit_security_ai_flow_feedback]. -
Try
AGREEwith reasons, or six reasons. Both return an error and emit no event.
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.