Return error for duplicate assignee IDs in UpdateAssigneesService

What does this MR do and why?

Fixes a silent rejection bug in MergeRequests::UpdateAssigneesService where passing duplicate IDs in assignee_ids caused the update to be silently ignored with no error returned to the caller.

The fix adds an explicit duplicate check before processing: if assignee_ids contains duplicate values, the service now adds a validation error ("Duplicate assignee IDs are not allowed") to the merge request and returns early, making the failure visible to callers (e.g. the API returns a 422 with the error message).

A corresponding RSpec test is added to cover this new error path.

References

Closes #601085 (closed)

Screenshots or screen recordings

N/A — backend-only change.

Before After

How to set up and validate locally

  1. In a Rails console or via the API, send a PUT request to /api/v4/projects/:id/merge_requests/:mr_iid with assignee_ids: [<id>, <id>] (same ID twice).
  2. Before this fix: HTTP 200 with no change and no error.
  3. After this fix: HTTP 422 with { "message": { "assignees": ["Duplicate assignee IDs are not allowed"] } }.

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.

Edited by Filip Aleksic

Merge request reports

Loading