Skip to content

Expose accepted reviewers to GraphQL query

Tan Le requested to merge tle/add-suggested-reviewers-accepted-graphql into master

What does this MR do and why?

Update GraphQL API to query suggested reviewers and accepted suggestions.

  • This API is gated behind a feature flag suggested_reviewers_control.
  • This query is in Alpha and hence will not require a deprecation process.

Screenshots or screen recordings

Screenshot_2022-12-18_at_11.01.08_am

How to set up and validate locally

  1. Ensure a SaaS (Gitlab.com) environment
    1. One way of doing this is to add a env.runit file to the root GDK folder with the following snippet
      export GITLAB_SIMULATE_SAAS=1
  2. Set ultimate license on a group http://gdk.test:3000/admin/groups
  3. Create a project in the ultimate group or use an existing one, e.g. http://gdk.test:3000/gitlab-org/gitlab-test
  4. Set the feature flag on rails console bundle exec rails c
    project = Project.find(2)
    Feature.enable(:suggested_reviewers_control, project)
  5. Enable suggested_reviewers_enabled project settings
    project.project_setting.update!(suggested_reviewers_enabled: true)
  6. Create a merge request on the project
  7. Use some existing project members
    accepted_reviewers = ["ken"]
    suggested_reviewers = ["lea_mclaughlin", "ken"]
  8. Add some suggestions to an existing open MR
    mr = MergeRequest.find(7)
    mr.build_predictions
    mr.predictions.update!(accepted_reviewers: { reviewers: accepted_reviewers }, suggested_reviewers: { reviewers: suggested_reviewers })
  9. Go to http://gdk.test:3000/-/graphql-explorer
  10. Excute the following query and confirm the output
    {
      mergeRequest(id: "gid://gitlab/MergeRequest/7") {
        suggestedReviewers {
          accepted
          suggested
        }
      }
    }

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Relates to https://gitlab.com/gitlab-org/modelops/applied-ml/review-recommender/clickhouse-exploration/-/issues/18

Edited by Tan Le

Merge request reports