Count coverage at risk from master quarantine only
What does this MR do and why?
The risk aggregation now reads quarantine from test_metrics.quarantined_tests_hourly_mv over 3 days. That is the same source and window the Quarantine score counts from in the runbooks Test Health views. It used to read test_file_quarantine_summary over 30 days, which also counts stable-branch and backport pipelines. Specs that master had already unquarantined kept lines at risk, so Pipeline Authoring lost a point while showing 0 quarantined tests.
The window is a constant rather than a constructor option because it has to match the score. risk_window still sets the flaky and ownership lookback.
With a 3-day window, a test_results ingestion stall longer than 3 days would store a day with no quarantine risk. The score reads the same window live, so the two still agree when the job runs.
Related: gitlab-org/quality/analytics/team#859 (closed)
Verification
- The fix works. I ran the committed aggregation SQL from
mainand from this branch against production on 2026-10-07, both with the same coverage anchor. All four groups that showed coverage at risk with 0 quarantined tests drop to 0 on the branch. For Pipeline Authoring that is 10,250 lines. - Nothing else changed. Both runs return the same 82 group rows, with identical source file counts and executable-line totals. Only the lines-at-risk columns move, and only downward. Flaky lines drop too, because an unquarantined spec now counts as healthy cover. The
mainrun also matches the stored 2026-10-07 snapshot on 80 of 82 rows. The other 2 differ by a few hundred flaky lines that arrived after the morning run.
Method and full numbers
I stripped the INSERT line from each version of test_health_risk_aggregation.sql and ran both with clickhouse-query.sh. Both used snapshot_date=2026-10-07, risk_window=30 DAY, quarantine_window=3 DAY, and coverage_start=2026-10-07 from #find_coverage_start's query.
Quarantine lines at risk went down for 24 groups and up for none:
| Group | main |
Branch |
|---|---|---|
| optimize | 24,244 | 4,958 |
| vulnerability_management | 18,683 | 1,643 |
| pipeline_execution | 27,661 | 14,723 |
| pipeline_authoring | 10,250 | 0 |
| planner_intelligence | 27,150 | 17,561 |
| build_security | 8,472 | 161 |
| authentication | 12,906 | 5,105 |
| organizations | 22,745 | 16,054 |
| code_review | 26,798 | 21,443 |
| environments | 10,783 | 5,482 |
| duo_chat | 3,942 | 0 |
| activation | 3,731 | 0 |
| source_code_investigation | 16,160 | 12,826 |
| engagement | 8,095 | 4,948 |
| policy_management | 35,142 | 33,712 |
| ci_platform | 905 | 0 |
| planning_views | 14,771 | 13,957 |
| work_items | 15,238 | 14,665 |
| acquisition | 487 | 0 |
| package_registry | 7,840 | 7,355 |
| import | 219 | 13 |
| geo | 268 | 193 |
| portfolio_planning | 11,252 | 11,224 |
| compliance | 9,025 | 9,018 |
Flaky lines at risk went down for 6 groups, and combined lines at risk for 10, because a spec that is no longer quarantined now counts as a healthy cover. Activation's flaky figure goes from 1,882 to 1,109 and engagement's from 31,273 to 28,857; the rest move by less than 300 lines.