Use risk classification flow 2.0.0 behind a feature flag

What does this MR do and why?

The Risk Assessment flow runs on every new merge request, and every run clones the full repository first. On gitlab-org/gitlab, that clone takes about 5 minutes and loads Gitaly, but the flow hardly uses it.

Flow version 2.0.0 in the AI Gateway reads files through the API only. This MR makes the flow use 2.0.0 for projects with the duo_mr_risk_classification_no_checkout feature flag. The flow still clones the repository, so we can compare the classification quality with 1.0.0 before we remove the clone.

This is the first of two steps:

  1. This MR: use 2.0.0, still with a clone.
  2. Skip the clone: !268121

References

Screenshots or screen recordings

Not applicable. There is no UI change.

How to set up and validate locally

  1. In GDK, check out the AI Gateway from gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7854 (merged) and restart DWS.
  2. In a Rails console, enable the Risk Assessment flow for gitlab-duo/test. You will need to enable these flags before:
    Feature.enable(:show_duo_mr_risk_classification_widget)
    Feature.enable(:duo_mr_risk_classification)
  3. Create a merge request in gitlab-duo/test. Make sure that the CI job of the session clones the repository and that DWS loads risk_classification 1.0.0.
  4. Enable the new flag:
    Feature.enable(:duo_mr_risk_classification_no_checkout)
  5. Create a merge request that changes a migration or an authorization-related file. The CI job still clones the repository, but DWS now loads 2.0.0.
  6. Make sure that the merge request widget shows the risk assessment.

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 Wanderson Policarpo

Merge request reports

Loading
Loading