Resolve stale merge request to-dos via background migration

What does this MR do and why?

Adds a batched background migration to clean up the existing backlog of closed or merged merge requests. It marks pending to-dos with the actions assigned, approval_requested, review_requested, and added_approver as done when their target merge request is already merged or closed, mirroring the resolution semantics in TodoService (state done, resolved_by_action system_done, snoozed_until cleared).

Affected users' cached pending to-do counts are invalidated per batch by deleting their cache keys, so the next read recomputes a fresh count from the primary rather than risking a replica-lag stale write.

References

gitlab-org#20462

Screenshots or screen recordings

Before After

How to set up and validate locally

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.

Merge request reports

Loading
Loading