Draft: [skip ci] Coalesce mergeRequestMergeStatusUpdated updates
What does this MR do and why?
mergeRequestMergeStatusUpdated is the most expensive GraphQL subscription on GitLab.com (Grafana, 24 hours, 2026-10-21):
- About 98 triggers each second, up to 197.
- About 706 results sent to browsers each second, up to 3,769, so each trigger reaches about 7 subscribers.
- About 514 KB each second, the most of all subscriptions.
More than 30 services and models trigger it, for example merge status changes, pipeline changes, approvals, thread resolution and reviewer changes. One change to a merge request often triggers it several times within a few seconds, and each trigger runs the subscription again for every subscriber.
The payload is the current state of the merge request, so the subscription fits the opt-in rule for coalescing from !266624 (merged). When graphql_subscription_coalescing is enabled for the subscriber, each websocket node runs the subscription at most once for each merge request in each 500-millisecond window, and always runs the last update.
Why a new class
The field used Subscriptions::IssuableUpdated, which 16 other fields share, such as issuableTitleUpdated and issuableLabelsUpdated. A coalesce declaration on that class would opt in all of them. Subscriptions::MergeRequests::MergeStatusUpdated subclasses it with the same arguments, payload type and authorization, so the GraphQL schema does not change. A subscription subclass does not inherit payload_type, so the class declares it again.
What subscribers see
These consumers get the first update of a burst at once and the last one at most about 500 milliseconds later. They skip the updates in between:
- The merge request widget,
merge_widget.vueandmr_widget_options.vue - The sticky header,
sticky_header.vue - The "merge request prepared" signal in
code_review/signals.js - The blocking merge requests report and the AI overview (EE)
Each of them uses the state in the payload, either through the Apollo cache or by copying it, or refetches when that state matches a condition, such as BLOCKED_STATUS or preparedAt. So the last update of a burst is enough, and none of them depends on an update in between.
How to set up and validate locally
The coalescer specs in !266624 (merged) cover the behaviour. This MR only declares coalesce.
bin/rspec spec/graphql/subscriptions/merge_requests/merge_status_updated_spec.rb spec/graphql/types/subscription_type_spec.rbMR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
References
- Part of https://gitlab.com/gitlab-org/gitlab/-/work_items/630854, step C3
- Uses the coalescer from !266624 (merged)
- Site-wide trigger, push and byte volume: https://gitlab.com/gitlab-org/gitlab/-/work_items/630854#note_4059560153
- Flag rollout: #637380