Add UI and API changes for enabling automatic review for instances
What does this MR do and why?
- This MR adds UI and API changes for enabling automatic review for instances
- Cascading settings were added in this MR: Add Automatic DCR Review Settings for Groups an... (!200397 - merged)
- This follows the group-level UI and API changes added in: Add UI and API changes for enabling automatic r... (!201399 - merged)
How to set up and validate locally
Prerequisites:
- Make sure the AI features are enabled locally using this guide
- Ensure you have
Duo Enterpriseadd-on andduo_features_enabled: trueat the instance level - Enable feature flag in Rails console:
Feature.enable(:cascading_auto_duo_code_review_settings)
Validate UI Changes:
-
As admin, go to Admin Area > Settings > General→GitLab Duo Code Reviewsection should be visible -
Enable Enable automatic reviews by GitLab Duo→ Save → Setting persists after refresh -
Create a group/project → Go to group (or project)'s settings → Auto review checkbox should be enabled and editable (inherited but can be changed) -
Disable feature flag → Refresh page → GitLab Duo Code Review section should disappear
Validate API Changes:
-
API: GET /api/v4/application/settings→ Response should includeauto_duo_code_review_enabledfield -
API: PUT /api/v4/application/settingswithauto_duo_code_review_enabled=true→ Should update successfully -
API: PUT /api/v4/application/settingswithauto_duo_code_review_enabled=false→ Should update successfully -
As non-admin user OR with feature flag disabled → Settings should not be visible/editable
Curl commands for testing:
curl "http://localhost:3000/api/v4/application/settings" \
-H "Authorization: Bearer <YOUR-ADMIN-TOKEN>"
curl -X PUT \
-H "Authorization: Bearer <YOUR-ADMIN-TOKEN>" \
-H "Content-Type: application/json" \
-d '{"auto_duo_code_review_enabled": true}' \
"http://localhost:3000/api/v4/application/settings"
Screenshots
As an admin go to Admin Area → Settings → General
| Before (FF disabled) | After (FF enabled) |
|---|---|
GitLab Duo Code Review section shouldn't show up |
![]() |
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.
Related to #554070 (closed)
Edited by Kinshuk Singh
