Skip to content

Commit c7f01eb

Browse files
committed
Fold coverage_ advisor verdicts into flaky_trunk
- Strip a leading "coverage_" from signal_key into base_key before normalizing, so coverage/backfill dispatches classify the same red - Group the advisor verdict subquery by (suspect_commit, base_key) instead of raw signal_key - Prefer a native (non-coverage_) verdict over a coverage_ one for the same (commit, job), latest timestamp breaking ties - Apply the identical change across all four flaky_trunk queries: entity_runs, jobs, runner_labels, timeseries Coverage/backfill advisor dispatches emit signal_key = 'coverage_' + the native job signal_key. Without stripping the prefix these verdicts normalized to a distinct adv_norm and failed to join the corresponding trunk red, leaving those reds unclassified. No native job signal_key starts with 'coverage_', so the strip is safe. Signed-off-by: Jean Schmidt <contato@jschmidt.me>
1 parent bee56ed commit c7f01eb

4 files changed

Lines changed: 40 additions & 12 deletions

File tree

torchci/clickhouse_queries/flaky_trunk_entity_runs/query.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,27 @@ advisor_agg AS (
5050
FROM (
5151
SELECT
5252
toString(suspect_commit) AS head_sha,
53+
-- Strip a leading "coverage_": coverage/backfill advisor dispatches use
54+
-- signal_key = 'coverage_' + the native job signal_key, so stripping it
55+
-- lets such a verdict normalize to (and classify) the same red. No native
56+
-- job signal_key starts with 'coverage_'.
57+
replaceRegexpOne(signal_key, '^coverage_', '') AS base_key,
5358
replaceRegexpOne(
5459
replaceRegexpOne(
55-
signal_key,
60+
base_key,
5661
' \\[[^\\]]+\\]$', ''
5762
),
5863
', [0-9]+, [0-9]+, .+\\)', ')'
5964
) AS adv_norm,
60-
argMax(verdict, timestamp) AS verdict
65+
-- Prefer a native (non-coverage_) verdict over a coverage_ one for the same
66+
-- (commit, job); among equals, the latest timestamp wins.
67+
argMax(verdict, (toUInt8(NOT startsWith(signal_key, 'coverage_')), timestamp)) AS verdict
6168
FROM misc.autorevert_advisor_verdicts
6269
WHERE
6370
repo = {repo: String}
6471
AND signal_source = 'job'
6572
AND timestamp >= {startTime: DateTime64(3)}
66-
GROUP BY suspect_commit, signal_key
73+
GROUP BY suspect_commit, base_key
6774
)
6875
GROUP BY head_sha, adv_norm
6976
),

torchci/clickhouse_queries/flaky_trunk_jobs/query.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,27 @@ advisor_agg AS (
5555
FROM (
5656
SELECT
5757
toString(suspect_commit) AS head_sha,
58+
-- Strip a leading "coverage_": coverage/backfill advisor dispatches use
59+
-- signal_key = 'coverage_' + the native job signal_key, so stripping it
60+
-- lets such a verdict normalize to (and classify) the same red. No native
61+
-- job signal_key starts with 'coverage_'.
62+
replaceRegexpOne(signal_key, '^coverage_', '') AS base_key,
5863
replaceRegexpOne(
5964
replaceRegexpOne(
60-
signal_key,
65+
base_key,
6166
' \\[[^\\]]+\\]$', ''
6267
),
6368
', [0-9]+, [0-9]+, .+\\)', ')'
6469
) AS adv_norm,
65-
argMax(verdict, timestamp) AS verdict
70+
-- Prefer a native (non-coverage_) verdict over a coverage_ one for the same
71+
-- (commit, job); among equals, the latest timestamp wins.
72+
argMax(verdict, (toUInt8(NOT startsWith(signal_key, 'coverage_')), timestamp)) AS verdict
6673
FROM misc.autorevert_advisor_verdicts
6774
WHERE
6875
repo = {repo: String}
6976
AND signal_source = 'job'
7077
AND timestamp >= {startTime: DateTime64(3)}
71-
GROUP BY suspect_commit, signal_key
78+
GROUP BY suspect_commit, base_key
7279
)
7380
GROUP BY head_sha, adv_norm
7481
),

torchci/clickhouse_queries/flaky_trunk_runner_labels/query.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,27 @@ advisor_agg AS (
4141
FROM (
4242
SELECT
4343
toString(suspect_commit) AS head_sha,
44+
-- Strip a leading "coverage_": coverage/backfill advisor dispatches use
45+
-- signal_key = 'coverage_' + the native job signal_key, so stripping it
46+
-- lets such a verdict normalize to (and classify) the same red. No native
47+
-- job signal_key starts with 'coverage_'.
48+
replaceRegexpOne(signal_key, '^coverage_', '') AS base_key,
4449
replaceRegexpOne(
4550
replaceRegexpOne(
46-
signal_key,
51+
base_key,
4752
' \\[[^\\]]+\\]$', ''
4853
),
4954
', [0-9]+, [0-9]+, .+\\)', ')'
5055
) AS adv_norm,
51-
argMax(verdict, timestamp) AS verdict
56+
-- Prefer a native (non-coverage_) verdict over a coverage_ one for the same
57+
-- (commit, job); among equals, the latest timestamp wins.
58+
argMax(verdict, (toUInt8(NOT startsWith(signal_key, 'coverage_')), timestamp)) AS verdict
5259
FROM misc.autorevert_advisor_verdicts
5360
WHERE
5461
repo = {repo: String}
5562
AND signal_source = 'job'
5663
AND timestamp >= {startTime: DateTime64(3)}
57-
GROUP BY suspect_commit, signal_key
64+
GROUP BY suspect_commit, base_key
5865
)
5966
GROUP BY head_sha, adv_norm
6067
),

torchci/clickhouse_queries/flaky_trunk_timeseries/query.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,27 @@ advisor_agg AS (
5555
FROM (
5656
SELECT
5757
toString(suspect_commit) AS head_sha,
58+
-- Strip a leading "coverage_": coverage/backfill advisor dispatches use
59+
-- signal_key = 'coverage_' + the native job signal_key, so stripping it
60+
-- lets such a verdict normalize to (and classify) the same red. No native
61+
-- job signal_key starts with 'coverage_'.
62+
replaceRegexpOne(signal_key, '^coverage_', '') AS base_key,
5863
replaceRegexpOne(
5964
replaceRegexpOne(
60-
signal_key,
65+
base_key,
6166
' \\[[^\\]]+\\]$', ''
6267
),
6368
', [0-9]+, [0-9]+, .+\\)', ')'
6469
) AS adv_norm,
65-
argMax(verdict, timestamp) AS verdict
70+
-- Prefer a native (non-coverage_) verdict over a coverage_ one for the same
71+
-- (commit, job); among equals, the latest timestamp wins.
72+
argMax(verdict, (toUInt8(NOT startsWith(signal_key, 'coverage_')), timestamp)) AS verdict
6673
FROM misc.autorevert_advisor_verdicts
6774
WHERE
6875
repo = {repo: String}
6976
AND signal_source = 'job'
7077
AND timestamp >= {startTime: DateTime64(3)}
71-
GROUP BY suspect_commit, signal_key
78+
GROUP BY suspect_commit, base_key
7279
)
7380
GROUP BY head_sha, adv_norm
7481
),

0 commit comments

Comments
 (0)