[go: up one dir, main page]

Auto-resolve stale todos when MR is closed

Goal

Complete the feature by adding close event handling. Reuses all infrastructure from previous phases.

⚠️ This completes the core feature - after this, feature is fully functional!

Related to #20637 (closed)

Depends on: Phase 1a, Phase 1b, Phase 1c

Implementation Details

File: app/services/merge_requests/close_service.rb

Add worker invocation after existing todo resolution (same pattern as PostMergeService).

Test Coverage Required

Location: spec/services/merge_requests/close_service_spec.rb

  • Worker enqueued when flag enabled
  • Worker NOT enqueued when flag disabled
  • Todos resolved for all affected users
  • Behavior consistent with merge path

Location: spec/requests/api/merge_requests_spec.rb

  • API close endpoint resolves todos

Files to Change

  • app/services/merge_requests/close_service.rb
  • spec/services/merge_requests/close_service_spec.rb
  • spec/requests/api/merge_requests_spec.rb

Acceptance Criteria

  • Worker enqueued when MR closed
  • Consistent behavior with merge path
  • All tests pass
  • No N+1 queries

Deployment Plan

  1. Deploy to staging
  2. Test close functionality
  3. Deploy to production
  4. Verify both merge AND close work correctly

Estimated Effort: 1-2 days