Loading
Gate auto reviewer assignment on draft and existing reviewers
What does this MR do and why?
The dap_powered reviewer-assignment path runs asynchronously via
AutoAssignReviewersWorker#execute_dap_flow, which bypasses
ReviewerAssignment::AssignService and therefore skipped two guards that
the synchronous code_owners path enforces:
- Draft MRs were assigned reviewers on creation. This violates the requirement that reviewers are assigned only when an MR becomes ready (created non-draft, or marked ready from draft).
- Re-triggering an already-assigned MR re-ran the flow and double-posted the recommendation note, because the "reviewers already present" guard was not applied.
This MR moves both guards (draft? and "non-automated reviewers already
present") into AutoAssignReviewersWorker#perform, before the strategy
branch, so they cover the DAP flow as well as the code-owners path. A lone
Duo Code Review bot reviewer is still treated as "no reviewer yet" so
auto-assignment runs alongside it.
The now-redundant checks are removed from AssignService (the worker is its
only caller).
How validated
- New worker specs cover: draft MR → no assignment; an existing human reviewer → no assignment; only the Duo Code Review bot present → assignment still runs; and the DAP path specifically not starting on a draft MR.
AssignServicespecs updated — the moved skip cases now live in the worker spec.- Reproduced the draft-assignment bug manually on the DAP experiment playground before the fix: a draft MR received a reviewer and a rationale note while still in draft.
Related to #597374 (closed)