Skip to content

Add UI and API changes for enabling automatic review for groups

What does this MR do and why?

  • This MR adds UI and API changes for enabling automatic review for groups
  • Cascading settings were added in this MR: !200397 (merged)

Note: UI and API changes for application level settings will be added in a follow-up MR

How to set up and validate locally

Prerequisites:

  • Make sure the AI features are enabled locally using this guide
  • Use http://localhost:3000/gitlab-duo group which already has Duo Enterprise add-on and duo_features_enabled: true
  • Enable feature flag in Rails console: Feature.enable(:cascading_auto_duo_code_review_settings)

Validate UI Changes:

  • As group owner, go to Settings > General > Merge requestsGitLab Duo Code Review section should be visible
  • Enable Enable automatic reviews by GitLab Duo → Save → Setting persists after refresh
  • Create a subgroup / project → Go to subgroup (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/groups/gitlab-duo → Response should include auto_duo_code_review_enabled field
  • API: PUT /api/v4/groups/gitlab-duo with auto_duo_code_review_enabled=true → Should update successfully
  • API: PUT /api/v4/groups/gitlab-duo with auto_duo_code_review_enabled=false → Should update successfully
  • As non-admin member OR with feature flag disabled → Settings should not be visible/editable

Curl commands for testing:

curl "http://localhost:3000/api/v4/groups/gitlab-duo" \
  -H "Authorization: Bearer <YOUR-TOKEN>"

curl -X PUT \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"auto_duo_code_review_enabled": true}' \
  "http://localhost:3000/api/v4/groups/gitlab-duo"

Screenshots

Select a group as an owner / admin go to Settings -> General -> Merge Requests

Before (FF disabled) After (FF enabled)
Disabled 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