.vbw-planning/milestones/03-coverage-analysis-quick-wins-critical-path-test-co/phases/02-critical-path-test-coverage/PLAN-05.md
Close the coverage gaps in lib/source_monitor/scraping/bulk_source_scraper.rb (66 uncovered lines) and lib/source_monitor/realtime/broadcaster.rb (48 uncovered lines). For BulkSourceScraper, the existing tests cover current/unscraped/all selections, rate limiting, and selection_counts. This plan targets the remaining uncovered branches: disabled_result, invalid_selection_result, batch limiting, determine_status edge cases, and selection normalization. For Broadcaster, there is no existing test file -- this plan creates one covering setup!, broadcast_source, broadcast_item, broadcast_toast, fetch/item event handlers, error swallowing, and turbo_available? checks.
Decomposition rationale: BulkSourceScraper and Broadcaster are the remaining REQ-05/REQ-06 targets. BulkSourceScraper has a partially-tested test file that needs extension. Broadcaster has no test file and needs creation. They don't share files, so combining them in one plan is safe. The combined gap (114 lines) fits within 5 tasks.
Trade-offs considered:
What constrains the structure:
test/lib/source_monitor/scraping/bulk_source_scraper_test.rbbin/rails test test/lib/source_monitor/scraping/bulk_source_scraper_test.rb -n /disabled|invalid_selection|result_struct|normalize|selection_label/i exits 0test/lib/source_monitor/scraping/bulk_source_scraper_test.rbbin/rails test test/lib/source_monitor/scraping/bulk_source_scraper_test.rb -n /batch_limit|determine_status|without_inflight/i exits 0test/lib/source_monitor/realtime/broadcaster_test.rb (new file)bin/rails test test/lib/source_monitor/realtime/broadcaster_test.rb -n /setup|broadcast_source|broadcast_item/i exits 0test/lib/source_monitor/realtime/broadcaster_test.rbbin/rails test test/lib/source_monitor/realtime/broadcaster_test.rb -n /toast|fetch_completed|item_scraped|fetch_toast|item_toast/i exits 0test/lib/source_monitor/realtime/broadcaster_test.rbbin/rails test test/lib/source_monitor/realtime/broadcaster_test.rb -n /reload_record|turbo_available|register_callback|log_error|log_info/i exits 0bin/rails test test/lib/source_monitor/scraping/bulk_source_scraper_test.rb exits 0bin/rails test test/lib/source_monitor/realtime/broadcaster_test.rb exits 0COVERAGE=1 bin/rails test test/lib/source_monitor/scraping/bulk_source_scraper_test.rb test/lib/source_monitor/realtime/broadcaster_test.rb shows both files with >80% branch coveragebin/rails test exits 0 (no regressions)