Skip to content

Fix committers ActiveRecord::ImmutableRelation error

Phil Hughes requested to merge ph/fixCommittersMergeRequestImmutableError into master

What does this MR do and why?

Fixes a ActiveRecord::ImmutableRelation error with approvals queries. If suggested_approvers and committers are in the same query GraphQL will throw a ActiveRecord::ImmutableRelation because the committers query has been loaded and memoized. Run the below query to see this happening:

query {
  project(fullPath:"gitlab-org/gitlab") {
    mergeRequest(iid:"104092") {
      approvalState {
        suggestedApprovers {
          nodes {
            id
          }
        }
      }
      committers {
        nodes {
          id
        }
      }
    }
  }
}

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly 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.

Merge request reports