Add project settings for Duo Code Review depth
What does this MR do and why?
Project maintainers need a way to block deep reviews, so projects that don't want to pay for them can turn them off. They also need a way to choose the default review depth for Code Review Flow.
This MR adds those controls to the project merge request settings, using the design from !262996 (comment 4109666703):
- An Allow deep reviews checkbox.
- A Depth level option with Standard (Default) and Deep. When Allow deep reviews is cleared, Deep is disabled and Standard (Default) is selected.
The settings appear only when duo_code_review_deep_flow is enabled for the top-level group, and only for projects with GitLab Duo and foundational flows turned on.
References
- Related gitlab-org#23598
- !262996 (comment 4109666703) (decision to drop the lock, and the UI design)
Screenshots or screen recordings
| Project settings |
|---|
![]() |
How to set up and validate locally
Prerequisites: a project with GitLab Duo and foundational flows turned on. These steps use the gitlab-duo/test project.
-
Check out this branch and enable the feature flag for the top-level group in a Rails console:
Feature.enable(:duo_code_review_deep_flow, Group.find_by_full_path('gitlab-duo')) -
As a project maintainer, go to
http://gdk.test:3000/gitlab-duo/test/-/settings/merge_requests#merge-request-duo-code-review-settings. Under GitLab Duo Code Review, the Allow deep reviews checkbox and the Depth level options appear. -
Clear Allow deep reviews. Deep becomes disabled. Select Allow deep reviews again, select Deep, then clear Allow deep reviews. Standard (Default) becomes selected.
-
Select Allow deep reviews and Deep, then select Save changes. After the page reloads, Deep is still selected.
-
Go to the project's audit events page (
http://gdk.test:3000/gitlab-duo/test/-/audit_events). Theduo_code_review_depth_allowed_updatedorduo_code_review_default_depth_updatedevent is listed. -
Disable the feature flag for the group and reload the project settings page. The depth settings are gone.
Feature.disable(:duo_code_review_deep_flow, Group.find_by_full_path('gitlab-duo')) -
To undo, enable the flag again, select Allow deep reviews and Standard (Default), and save.
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.
