Address review comments: use MergedCloudEvent for merged MR flow trigger
What does this MR do and why?
Addresses open review comments from !249082 (merged) (now merged).
relate to #613978
Changes
1. Introduce MergeRequests::MergedCloudEvent
Creates a proper CloudEvents v1.0 event class (inheriting from BaseCloudEvent) published
from CE MergeRequests::PostMergeService#execute (alongside the existing MergedEvent
published from the EE hook). The new event carries the acting user (who merged the MR) in
the CloudEvent envelope, eliminating the need for the resolve_current_user workaround.
2. Fix conceptual mismatch in the worker
ExecuteMergeRequestMergedWorkflowTriggersWorker now subscribes to MergedCloudEvent
instead of the plain MergedEvent, aligning it with every other worker in
Ai::CloudEventsFlowTriggerWorker. The resolve_current_user override is removed —
current_user now comes from the event envelope directly.
3. Remove EVENT_TYPES[:merge_request] from Developer flow defaults
The merge_request event type was added in
!249081 (merged) to drive the merged-MR flow
via the legacy MergedEvent. Now that the worker subscribes to MergedCloudEvent instead,
keeping EVENT_TYPES[:merge_request] in the Developer defaults would cause duplicate flow
invocations on every merge. It has been removed. Note: SyncFoundationalFlowsService is
create-only, so projects that already synced keep their existing merge_request trigger row;
those rows become inert once the flags are enabled because the worker no longer subscribes to
the legacy event.
4. Feature flag improvements
feature_issue_urlupdated to point at the canonical GitLab feature issue (gitlab-org#22593) instead of the AIGW dependency issue.descriptionupdated to mention the companionmerge_request_merged_memory_distillationflag and the existing-Developer-flow-session requirement.
5. Feature category
Worker, event definition, and specs updated to :code_suggestions (the dap_triggers
category is not yet synced from the www-gitlab-com stages.yml). The redundant
feature_category :code_suggestions declaration in the worker is removed — it is already
provided by the Ai::CloudEventsFlowTriggerWorker concern.
References
- Addresses review comments on !249082 (merged)
- Feature issue: gitlab-org#22593
- Rollout issue: #608484
How to set up and validate locally
- check out branch !250633 and restart gdk
- run
bundle exec rails runner scripts/duo/merged_trigger_demo.rbin gitlab repo - follow the instruction, wait for the session complete and click merge
- a memory distillation flow is triggered and a MR is created
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.
