Add reviewers and recommended reviewers to the replacement MR overview

Fourth of five. Adds the sidebar column to the replacement overview and fills it with the reviewers of the merge request: avatar, name (linked to the user's profile), and state - approved, requested changes, commented, review started, or awaiting review - with an approved count in the card header. Below them sit the AI-recommended reviewers for the merge request, each with a profile-linked avatar and name, the model's reason behind a help icon, and a button to add them. The readiness hero also names the current user's review as the blocker when they are a reviewer who has not approved and approvals are what holds the merge up.

Chain, each part building on the one above:

  1. !252481 (merged) - flag, toggle, empty container (merged)
  2. !255057 (merged) - data layer: mount point, Apollo provider, query and subscription (merged)
  3. !252997 (merged) - layout shell and merge readiness panel (merged)
  4. !252998 (merged) - reviewers panel (this MR)
  5. !252999 (merged) - description, labels and milestone

mr-252998-reviewers

mr-252998-blocker

Detailed context for AI agents

What this MR does

  • Adds a sidebar column to the overview: a two-column grid (1fr 356px, align-items: start) added as .ai-overview-body in ee/app/assets/stylesheets/page_bundles/merge_request.scss, because Vue components in this codebase must not carry <style> blocks.
  • Fills that column with a reviewers card: each reviewer's avatar, name (a GlLink to the user's webPath, with the js-user-link class and data-user-id / data-username so the standard user popover works), and state (Approved / Requested changes / Commented / Review started / Awaiting review), an "N of M approved" count in the card header, and a "No reviewers yet" empty state.
  • Extends the readiness hero from part 3 with one addition: when the current user is a reviewer who has not approved, and the approvals merge check is the one failing, the hero title becomes "Your review is the blocker" and a "Viewing as reviewer" GlBadge (variant info) appears next to it. It does not fire when approvals are not what blocks the merge (for example, only the pipeline is failing), and does not fire on a merged, closed, or locked merge request.
  • The original version of this logic fired whenever the MR was not ready. The approvals-check condition was added during the rebase so the title can never say something false, such as telling a reviewer they are the blocker when the pipeline is red.
  • Reviewer state comes from mergeRequestInteraction.reviewState; the approved flag takes precedence over it, as in the reviewer sidebar, because the state can lag behind an approval. UNAPPROVED, or a null interaction, renders as Awaiting review. Icons follow the sidebar's REVIEW_STATE_ICONS.
  • The reviewer and suggestion fields live in a new MrAiOverviewReviewers fragment (queries/mr_ai_overview_reviewers.fragment.graphql), used by the main query and by a new mergeRequestReviewersUpdated subscription (queries/mr_ai_overview_reviewers.subscription.graphql). app.vue now runs two subscribeToMore entries, one for merge status and one for reviewers. Each payload is the same merge request by id, so Apollo's cache update re-renders the panel without a refetch, whether the change came from this tab or another user. Approving triggers the reviewers subscription too, via UpdateReviewerStateService. No backend changes.
  • The current user is read from window.gon.current_username.
  • The panel lists the aiSuggestedReviewers connection that the DAP recommend-reviewers flow writes (see the ph/suggestedReviewers/* MRs merged in 19.4), under a "Recommended" heading. Each row shows the avatar, name, the approval rule the suggestion was made for (Any eligible user for an any-approver rule, matching the sidebar component), and a help popover with the model's reason, the same treatment the sidebar gives it.
  • aiSuggestedReviewers is part of the reviewers fragment, so the reviewers subscription payload carries the remaining suggestions, and an added reviewer drops out of the recommended list from the same update. userPermissions.updateMergeRequest stays in the query only.
  • The field is null when the flow is off for the project, and the resolver already drops anyone who is a reviewer, so the section renders only while there is something to suggest.
  • Anyone with updateMergeRequest gets a plus button that runs the existing setReviewers mutation in APPEND mode; the mutation runs without refetchQueries, and the reviewers subscription moves the user from the recommended list into the reviewer rows. A failure raises the same alert the sidebar uses and leaves the suggestion in place.
  • The panel's strings dropped the AiOverview| namespace, so the labels are generic: Reviewers, No reviewers yet, Approved, Requested changes, Commented, Review started, Awaiting review. The buildReviewers helper no longer adds a derived state field; callers read mergeRequestInteraction.approved directly.

After adding a recommended reviewer on GDK:

mr-252998-after-add

Files touched

  • ee/app/assets/javascripts/merge_requests/ai_overview/components/reviewers_panel.vue (new; reviewer rows, recommended reviewers, add action)
  • components/app.vue (adds the sidebar column)
  • components/merge_readiness.vue (blocker title and badge)
  • constants.js (new REVIEWER_STATUS map: icon, GlIcon variant, text class, label)
  • utils.js (new buildReviewers, buildSuggestedReviewers, isViewerBlockingReviewer)
  • queries/mr_ai_overview_fields.fragment.graphql (lost the reviewer fields), queries/mr_ai_overview.query.graphql (now spreads both fragments), queries/mr_ai_overview_reviewers.fragment.graphql (new; reviewer and suggestion fields), and queries/mr_ai_overview_reviewers.subscription.graphql (new; mergeRequestReviewersUpdated)
  • the page bundle scss
  • specs under ee/spec/frontend/merge_requests/ai_overview/: reviewers_panel_spec.js (new), plus additions to app_spec.js, merge_readiness_spec.js, and mock_data.js
  • ee/spec/features/merge_request/user_toggles_ai_overview_spec.rb (two examples: reviewer rows, blocker hero)
  • locale/gitlab.pot

Rebase note

This MR was originally a single commit stacked on the pre-review version of part 3, when everything lived in app.vue. Part 3 merged with the readiness panel split out into merge_readiness.vue and readiness_row.vue, backed by constants.js and utils.js. Because the shape changed, this MR was rebuilt from scratch on top of that structure rather than replayed.

Verification

  • ee/spec/frontend/merge_requests/ai_overview: 4 suites, 63 examples, passing under jest.
  • Prettier and eslint are clean, including the GraphQL documents, validated against a fresh gitlab:graphql:schema:dump.
  • ee/spec/features/merge_request/user_toggles_ai_overview_spec.rb: 11 examples pass (one example, the opt-in toggle, failed once on a cold Vite start and passed on re-run). The blocker example needs stub_licensed_features(merge_request_approvers: true) and an any-approver rule: without the licence the approvals check is INACTIVE, and a regular rule with no approvers counts as an invalid rule that allows the merge, so neither makes the check fail.
  • Checked on GDK (project with the recommend-reviewers flow enabled, suggestions seeded directly into ai_suggested_reviewers): the screenshots above, and the roughly two-second add-reviewer timing, are from the earlier refetch version. The subscription-driven update has not been re-checked live on GDK yet.

Changes after review

  • Reviewers update via a new mergeRequestReviewersUpdated subscription instead of a query refetch after adding a recommended reviewer.
  • Dropped the AiOverview| namespace on the panel's strings.
  • Reviewer and recommended-reviewer avatars and names link to the user's profile.
  • Requested changes (and review started) now render via mergeRequestInteraction.reviewState, not just approved/commented/awaiting.
  • Removed the derived state field from buildReviewers; callers read mergeRequestInteraction.approved directly.
  • Reviewer and recommended-reviewer user fields come from the shared User fragment (~/graphql_shared/fragments/user.fragment.graphql) instead of a hand-written field list, which also fetches webUrl. Dropped two comments in app.vue and reviewers_panel.vue that restated the code. Checked the fragment against the GDK GraphQL endpoint and the ai_overview Jest specs (63 pass).

Out of scope

The author variant of the badge, and the author field on the fragment, land in part 5 (!252999 (merged)). That MR still stacks on the old commits of this branch and needs the same rebuild.

Edited by Marc Shaw

Merge request reports

Loading
Loading