Skip to content

Commit 91faa15

Browse files
refactor(flaky-history-analysis): adjust failure analysis windows for improved accuracy
- Updated the `flaky-history-analysis.ts` script to reduce the historical lookback period from 365 days to 30 days, focusing on more recent failures. - Modified the failure counting windows to only include 7-day and 30-day buckets, enhancing the relevance of the analysis. - Adjusted console output to reflect the new 30-day failure count, ensuring accurate reporting of sampled runs.
1 parent 7630365 commit 91faa15

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

.github/scripts/flaky-history-analysis.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ const WORKFLOW = 'ci.yml';
2727
// the exact job name.
2828
const JOB_NAME = 'Unit tests';
2929
// How far back the historical window extends. Failures are bucketed into the
30-
// nested windows below, so a failure 5 days ago counts in all four windows and
31-
// one 200 days ago counts only in the 365d bucket.
32-
const LOOKBACK_DAYS = 365;
33-
const WINDOWS_DAYS = [7, 30, 90, 365] as const;
30+
// nested windows below, so a failure 5 days ago counts in both windows and
31+
// one 20 days ago counts only in the 30d bucket.
32+
const LOOKBACK_DAYS = 30;
33+
const WINDOWS_DAYS = [7, 30] as const;
3434
type WindowKey = `${(typeof WINDOWS_DAYS)[number]}d`;
3535
const WINDOW_KEYS = WINDOWS_DAYS.map((d) => `${d}d` as WindowKey);
3636
type WindowCounts = Record<WindowKey, number>;
@@ -327,7 +327,7 @@ async function main(): Promise<void> {
327327
const { files, runsSampled } = await buildHistory(octokit, owner, repo, modifiedFiles, runs);
328328
console.log(
329329
`🔍 Sampled ${runs.length} completed ci.yml run(s) on main over the last ${LOOKBACK_DAYS}d ` +
330-
`(${runsSampled['365d']} failure/success within window)`,
330+
`(${runsSampled['30d']} failure/success within window)`,
331331
);
332332

333333
const result = writeHistoryFile(files, runsSampled);

0 commit comments

Comments
 (0)