Skip to content

Implement mergeRequestDiffs property for MergeRequestType

Patrick Bajao requested to merge 415359-merge-request-diffs-graphql-field into master

What does this MR do and why?

This adds mergeRequestDiffs property to MergeRequestType in GraphQL API.

It returns the following properties:

  • diff_llm_summary - returns a MergeRequestDiffLlmSummaryType
  • review_llm_summaries - returns a collection of MergeRequestReviewLlmSummaryType. Supports cursor pagination.
  • created_at
  • updated_at

How to set up and validate locally

  1. Run migration: rake db:migrate.

  2. Create a MR.

  3. Submit a review on the MR.

  4. Create MergeRequest::ReviewLlmSummary record for the submitted review via rails console:

    MergeRequest::ReviewLlmSummary.create(merge_request_diff: MergeRequestDiff.last, review: Review.last, user: User.llm_bot, provider: :open_ai, content: "Review summary")
  5. Make this GraphQL query:

    query {
      project(fullPath: "<insert path of project>") {
        id
        mergeRequest(iid: "<insert IID of MR>") {
          id
          mergeRequestDiffs {
            edges {
              cursor
              node {
                diffLlmSummary {
                  user {
                    id
                  }
                  provider
                  content
                  createdAt
                  updatedAt
                }
                reviewLlmSummaries {
                  edges {
                    cursor
                    node {
                      user {
                        id
                      }
                      reviewer {
                        id
                      }
                      provider
                      content
                      createdAt
                      updatedAt
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

MR acceptance checklist

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

Related to #415359 (closed)

Edited by Patrick Bajao

Merge request reports

Loading