Expose conflict sections on MergeRequest.conflictFiles

What does this MR do and why?

Adds a sections field to MergeRequest.conflictFiles (Types::MergeRequests::ConflictType). It mirrors the conflicts UI's JSON: each conflicting file's content split into sections, where a section is a run of lines that is either one conflict to resolve or context shared by both sides.

  • MergeRequestConflictSection: conflict (boolean), lines, and sectionId (null for context sections). The field is named sectionId rather than id because Types::BaseObject#id would try to build a GraphQL global ID out of the section hash.
  • MergeRequestConflictLine: type (CONTEXT, HEAD, ORIGIN, MATCH, NO_NEWLINE), oldLine, newLine, text.

Without this field, an API client that wants to resolve a conflict section by section, rather than by sending a whole file's resolved content, would have to re-implement GitLab's conflict parser and line numbering just to compute section ids. With this field the ids are opaque values the server hands out, and the client only has to echo them back.

This field and the mergeRequestResolveConflicts mutation (!256558 (closed)) are both 19.5 experiments. The mutation takes these ids as sectionId in its input.

References

Screenshots or screen recordings

Not applicable. GraphQL-only change, no UI.

How to set up and validate locally

  1. Create a merge request whose branches conflict (the spec fixture branches conflict-resolvable into conflict-start in the test repository work for this).

  2. Query the new field:

    {
      project(fullPath: "group/project") {
        mergeRequest(iid: "1") {
          conflictFiles {
            ourPath
            theirPath
            sections {
              sectionId
              conflict
              lines { type oldLine newLine text }
            }
          }
        }
      }
    }
  3. Each conflict section has a sectionId; context sections have sectionId: null.

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.

  • Specs: spec/graphql/types/merge_requests/conflict_type_spec.rb, spec/graphql/types/merge_requests/conflict_section_type_spec.rb, spec/graphql/types/merge_requests/conflict_line_type_spec.rb, spec/graphql/types/merge_requests/conflict_line_type_enum_spec.rb, spec/requests/api/graphql/merge_request/conflict_files_spec.rb.
  • Generated: GraphQL reference docs (doc/api/graphql/reference/_index.md), introspection schemas.
  • Experiment, milestone 19.5, additive and read-only, so no feature flag.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading