Back to Source Monitor

Extract FetchFeedJob Retry Orchestrator Service

.vbw-planning/milestones/07-rails-audit-and-refactoring/04-job-pipeline-reliability/01-SUMMARY.md

0.13.01.4 KB
Original Source

What Was Built

  • Fetching::RetryOrchestrator service with Result pattern (:retry_enqueued, :circuit_opened, :exhausted)
  • Extracted enqueue_retry!, open_circuit!, reset_retry_state! from FetchFeedJob into independently testable service
  • FetchFeedJob reduced from 147 to 97 lines; now delegates retry orchestration via single RetryOrchestrator.call
  • 6 new tests covering retry enqueue, circuit-open, exhausted reset, atomic locking, result context, and custom job_class

Commits

  • 4ff8884 refactor(04-01): extract FetchFeedJob retry orchestrator service

Tasks Completed

  1. Write RetryOrchestrator tests (TDD red) -- 6 tests, all erroring on missing constant
  2. Implement RetryOrchestrator service -- Result struct, .call class method, three execution paths
  3. Refactor FetchFeedJob to use RetryOrchestrator -- removed 4 methods, added 2-line delegation
  4. Update FetchFeedJob tests -- existing 16 tests pass unchanged (integration coverage maintained)
  5. Verify -- 1491 runs, 4537 assertions, 0 failures; 465 files, 0 RuboCop offenses

Files Modified

  • lib/source_monitor/fetching/retry_orchestrator.rb -- new service (100 lines)
  • lib/source_monitor.rb -- added autoload for RetryOrchestrator
  • app/jobs/source_monitor/fetch_feed_job.rb -- removed 4 methods, simplified handle_transient_error
  • test/lib/source_monitor/fetching/retry_orchestrator_test.rb -- new test file (6 tests, 38 assertions)

Deviations

None.