Loading
Pick the Duo Code Review depth from the project's cascading settings
What does this MR do and why?
Duo Code Review now picks its depth from the project's default depth, which cascades from the instance, group, and project settings added in !265907 (merged).
- A depth asked for on the request (sidebar or
-standard/-deepquick action) still wins over the default. - If the project doesn't allow deep reviews, the review runs standard, even when deep was asked for.
- The model pick uses the same check, so a deep run still uses the deep model setting.
Everything stays behind duo_code_review_deep_flow. Before this MR, users with the flag got a deep review by default. Now they get the project's default depth, which is standard unless someone changes it. That change is expected.
Local testing
I tested it end to end on my GDK, with the flag enabled per actor. Each case ran a full review, and I checked which flow it used:
- Project default standard, no depth requested: standard
- Project default deep, no depth requested: deep
- Project default deep, standard requested: standard
- Project default standard, deep requested: deep
- Flag on the user but not the root group, project default deep: standard
- Deep not allowed, deep requested: standard
- Flag off for the user, deep requested: standard
How to set up and validate locally
- Enable the flag for your user and for the project's root group in the Rails console. The default depth only applies when the flag is on for both:
project = Project.find_by_full_path('gitlab-duo/test') Feature.enable(:duo_code_review_deep_flow, User.find(1)) Feature.enable(:duo_code_review_deep_flow, project.root_ancestor) - Set the project's default depth to deep:
project.update!(duo_code_review_default_depth: 'deep') - Request a review from Duo on an MR without a depth. The run uses the deep flow:
Ai::DuoWorkflows::Workflow.last.flow_metadata_json['flow_id'] # => deep_code_review - Set the default back to
'standard'and request again. The run uses the standard flow. - Comment
/request_review @GitLabDuo -deep. The run uses the deep flow, because an explicit depth wins. - Run
project.update!(duo_code_review_depth_allowed: false)and comment/request_review @GitLabDuo -deepagain. The run uses the standard flow.
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.
References
- Epic: &23598
- Rollout issue: #627796
- Cascading settings: !263955 (merged) and !265907 (merged)
Edited by Kinshuk Singh