Skip to content

Add UI and API changes for enabling automatic review for instances

What does this MR do and why?

How to set up and validate locally

Prerequisites:

  • Make sure the AI features are enabled locally using this guide
  • Ensure you have Duo Enterprise add-on and duo_features_enabled: true at 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 > GeneralGitLab Duo Code Review section 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 include auto_duo_code_review_enabled field
  • API: PUT /api/v4/application/settings with auto_duo_code_review_enabled=true → Should update successfully
  • API: PUT /api/v4/application/settings with auto_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 enabled

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

Merge request reports

Loading