Skip to content

Commit 02bbd4f

Browse files
authored
Fix flaky_trunk filter UX and clarify persistence comments (#8559)
**Impact:** HUD flaky_trunk page users (dashboard only) **Risk:** low ## What Small UX/correctness cleanups on the flaky_trunk drill-down page: clearer filter label, drop the stale drill-in when the filter changes, parse URL dates as UTC, and clarify the SQL comments describing when a hard-red counts as "persistent". ## Why The "Viable/strict jobs only" checkbox was confusingly named — it's really "Required workflows only". Toggling it could hide the job you'd drilled into, leaving the runs panel open over an empty grid, so the selected entity is now cleared on toggle (the bucket interval stays valid, so it's kept). The URL writes start/stop dates via `.utc().format(...)` but `parseDate` read them in local time, so round-tripping a shared link could shift the window by a day; parsing now uses `dayjs.utc`. The SQL persistence comments were misleading — "adjacent" means the job's own previous/next observed run (which may be several trunk commits away), not the adjacent trunk commit; the comments now say so, and a stale "~a few %" figure was removed from the help text. Signed-off-by: Jean Schmidt <contato@jschmidt.me>
1 parent 37275da commit 02bbd4f

8 files changed

Lines changed: 27 additions & 16 deletions

File tree

torchci/clickhouse_queries/flaky_trunk_entity_runs/query.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ final_jobs AS (
167167
adv_real,
168168
adv_infra,
169169
adv_testflake,
170-
-- persistent: this hard-red has an adjacent hard-red on trunk (run of >= 2 consecutive reds).
170+
-- persistent: this job's adjacent observed run is also hard-red (>= 2 of its runs in a row).
171171
toUInt8(
172172
hard_red = 1
173173
AND (

torchci/clickhouse_queries/flaky_trunk_jobs/query.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
-- for test_flake, infra_issue for infra_flake), so the structural fallback yields only real_regression
1818
-- (persistent) or unclassified (non-persistent). Persistence
1919
-- discriminates: a hard-red (failed, no retry-green at this commit) is "persistent" when the SAME job is
20-
-- also hard-red at the immediately previous OR next trunk commit; a hard-red with a clean green on BOTH
21-
-- neighbors is an isolated green->red->green flake. real_regression is NOT gated on
22-
-- later recovery, so an ongoing (still-red) break still counts.
20+
-- also hard-red at its immediately adjacent observed run -- its previous or next run ordered by
21+
-- commit_time. A job need not run on every commit, so "adjacent" means adjacent in this job's own run
22+
-- sequence, not the trunk-commit sequence, and that run may be several trunk commits away; a hard-red
23+
-- flanked by green on BOTH its neighbor runs is an isolated green->red->green flake. real_regression is
24+
-- NOT gated on later recovery, so an ongoing (still-red) break still counts.
2325
--
2426
-- Trunk filter: jobs whose head_sha is a real push to refs/heads/main for the repo param. The shared CTE
2527
-- chain (trunk_commits .. final_jobs) is identical across flaky_trunk_timeseries, flaky_trunk_jobs
@@ -167,7 +169,7 @@ final_jobs AS (
167169
adv_real,
168170
adv_infra,
169171
adv_testflake,
170-
-- persistent: this hard-red has an adjacent hard-red on trunk (run of >= 2 consecutive reds).
172+
-- persistent: this job's adjacent observed run is also hard-red (>= 2 of its runs in a row).
171173
toUInt8(
172174
hard_red = 1
173175
AND (

torchci/clickhouse_queries/flaky_trunk_runner_labels/query.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ final_jobs AS (
158158
adv_real,
159159
adv_infra,
160160
adv_testflake,
161-
-- persistent: this hard-red has an adjacent hard-red on trunk (run of >= 2 consecutive reds).
161+
-- persistent: this job's adjacent observed run is also hard-red (>= 2 of its runs in a row).
162162
toUInt8(
163163
hard_red = 1
164164
AND (

torchci/clickhouse_queries/flaky_trunk_timeseries/query.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
-- for test_flake, infra_issue for infra_flake), so the structural fallback yields only real_regression
1717
-- (persistent) or unclassified (non-persistent). Persistence
1818
-- discriminates: a hard-red (failed, no retry-green at this commit) is "persistent" when the SAME job is
19-
-- also hard-red at the immediately previous OR next trunk commit; a hard-red with a clean green on BOTH
20-
-- neighbors is an isolated green->red->green flake. real_regression is NOT gated on
21-
-- later recovery, so an ongoing (still-red) break still counts.
19+
-- also hard-red at its immediately adjacent observed run -- its previous or next run ordered by
20+
-- commit_time. A job need not run on every commit, so "adjacent" means adjacent in this job's own run
21+
-- sequence, not the trunk-commit sequence, and that run may be several trunk commits away; a hard-red
22+
-- flanked by green on BOTH its neighbor runs is an isolated green->red->green flake. real_regression is
23+
-- NOT gated on later recovery, so an ongoing (still-red) break still counts.
2224
--
2325
-- Trunk filter: jobs whose head_sha is a real push to refs/heads/main for the repo param (join to
2426
-- default.push, which also yields the commit push timestamp used for bucketing + adjacency).
@@ -167,7 +169,7 @@ final_jobs AS (
167169
adv_real,
168170
adv_infra,
169171
adv_testflake,
170-
-- persistent: this hard-red has an adjacent hard-red on trunk (run of >= 2 consecutive reds).
172+
-- persistent: this job's adjacent observed run is also hard-red (>= 2 of its runs in a row).
171173
toUInt8(
172174
hard_red = 1
173175
AND (

torchci/components/flakyTrunk/FlakyTrunkControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default function FlakyTrunkControls({
130130
onChange={(e) => setViableStrictOnly(e.target.checked)}
131131
/>
132132
}
133-
label="Viable/strict jobs only"
133+
label="Required workflows only"
134134
/>
135135
</Stack>
136136
);

torchci/components/flakyTrunk/FlakyTrunkHelp.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ export default function FlakyTrunkHelp() {
5454
</Typography>
5555
<Typography component="li" variant="body2" color="text.secondary">
5656
<Term>Unclassified</Term>
57-
{
58-
" — an isolated one-off red we can't yet attribute (~a few % of reds)."
59-
}
57+
{" — an isolated one-off red we can't yet attribute."}
6058
</Typography>
6159
</Box>
6260

torchci/components/flakyTrunk/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { GridColDef } from "@mui/x-data-grid";
22
import { Granularity } from "components/metrics/panels/TimeSeriesPanel";
33
import dayjs from "dayjs";
44
import isoWeek from "dayjs/plugin/isoWeek";
5+
import utc from "dayjs/plugin/utc";
56

67
dayjs.extend(isoWeek);
8+
dayjs.extend(utc);
79

810
export const FLAKY_TRUNK_REPO = "pytorch/pytorch";
911

@@ -169,7 +171,7 @@ export function parseDate(value: unknown, fallback: dayjs.Dayjs): dayjs.Dayjs {
169171
if (typeof value !== "string") {
170172
return fallback;
171173
}
172-
const parsed = dayjs(value);
174+
const parsed = dayjs.utc(value);
173175
return parsed.isValid() ? parsed : fallback;
174176
}
175177

torchci/pages/flaky_trunk.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ export default function Page() {
150150
clearSelections();
151151
}
152152
};
153+
// Filtering can hide the drilled-in job, leaving the runs panel open over an
154+
// empty grid, so drop the entity; the selected bucket's interval is still
155+
// valid under the filter, so keep it.
156+
const changeViableStrictOnly = (value: boolean) => {
157+
setViableStrictOnly(value);
158+
setSelectedEntity(null);
159+
};
153160

154161
const onBucketClick = useCallback(
155162
(bucketStart: dayjs.Dayjs) => {
@@ -228,7 +235,7 @@ export default function Page() {
228235
minRuns={minRuns}
229236
setMinRuns={setMinRuns}
230237
viableStrictOnly={viableStrictOnly}
231-
setViableStrictOnly={setViableStrictOnly}
238+
setViableStrictOnly={changeViableStrictOnly}
232239
/>
233240

234241
<Box sx={{ mt: 3 }}>

0 commit comments

Comments
 (0)