.vbw-planning/milestones/ui-fixes-and-smart-scraping/phases/03-dashboard-pagination/03-04-SUMMARY.md
Added health status distribution counts to the dashboard. A new query in StatsQuery computes active source counts grouped by health_status (healthy, warning, declining, critical), rendered as color-coded inline badges below the existing stats cards. Health distribution metrics are recorded through the existing instrumentation pipeline.
StatsQuery#call to include a health_distribution hash via Source.active.group(:health_status).count with zero-defaults for all four statuses._stats.html.erb. Only non-zero statuses render. Colors match existing HealthBadgeHelper conventions.record_stats_metrics (e.g., dashboard_stats_health_healthy).stats_query_test.rb with 4 test cases covering mixed counts, inactive exclusion, zero defaults, and empty active set.lib/source_monitor/dashboard/queries/stats_query.rb -- Added health_distribution key and private methodapp/views/source_monitor/dashboard/_stats.html.erb -- Added badge row with Turbo Stream targeting IDlib/source_monitor/dashboard/queries.rb -- Appended health gauge lines to record_stats_metricstest/lib/source_monitor/dashboard/queries_test.rb -- Fixed SQL count assertion (3 -> 4) and each_value type check for new hash keytest/lib/source_monitor/dashboard/stats_query_test.rb -- NEW: 4 tests for health distribution query0296be9 feat(dashboard): add health_distribution to StatsQueryd325251 feat(dashboard): render health distribution badges below stats cardsa2b5997 feat(dashboard): record health distribution metrics as gaugesd606f66 test(dashboard): add health distribution query testsqueries_test.rb to fix two assertions broken by the new health_distribution hash key: the SQL query count check (3 -> 4 queries) and the each_value Integer type assertion (now skips the Hash-valued key).47 dashboard tests pass (36 existing + 4 new + 7 other dashboard tests), 0 failures, 0 errors.