mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 17:11:28 +01:00
The weekly test-time recording can land again on its own (GST-3303) (#4581)
The weekly job that re-records how long each test file takes can land its update again without someone fixing it by hand. Free Tests uses those times to split the suite evenly. It had not landed an update since 11-09: the Windows half kept failing, and its pull request waited for a maintainer whenever a new file ran past 60 seconds. Nothing to do. The bot's commit and pull-request step runs for real only on the weekly schedule, so the next Monday run is its first live test. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Refs: GST-3303
This commit is contained in:
1 parent
ef4a7f5cbf
commit
507ebfc16d
8 files changed
+146
-9
No files matched your search
@@ -148,6 +148,29 @@ export function seedRatchet({ durations, allowlist, baseAllowlist }: SeedRatchet
|
||||
return { violations, exceptions };
|
||||
}
|
||||
|
||||
/**
|
||||
* The allowlist a fresh recording needs, for the weekly recorder's seed PR: drop
|
||||
* entries for files now at or under the ceiling or gone from the seed, and admit
|
||||
* every unlisted file over it with `admit`'s annotated entry (a todo is required).
|
||||
* Other entries keep their text. Returns the new entries and what changed.
|
||||
*/
|
||||
export function reconcileSeedAllowlist(
|
||||
durations: Record<string, number>, allowlist: SeedAllowlistEntry[],
|
||||
admit: (file: string, ms: number) => SeedAllowlistEntry & { todo: string },
|
||||
): { entries: SeedAllowlistEntry[]; admitted: string[]; pruned: string[] } {
|
||||
const pruned = allowlist.filter(entry => !(durations[entry.file] > SEED_CEILING_MS)).map(entry => entry.file);
|
||||
const kept = allowlist.filter(entry => !pruned.includes(entry.file));
|
||||
const listed = new Set(kept.map(entry => entry.file));
|
||||
const admitted = Object.keys(durations).filter(file => durations[file] > SEED_CEILING_MS && !listed.has(file)).sort();
|
||||
return { entries: [...kept, ...admitted.map(file => admit(file, durations[file]))], admitted, pruned };
|
||||
}
|
||||
|
||||
/** The allowlist file's own layout: one entry per line. */
|
||||
export function formatSeedAllowlist(entries: SeedAllowlistEntry[]): string {
|
||||
const line = (entry: SeedAllowlistEntry) => `{${Object.entries(entry).map(([key, value]) => `${JSON.stringify(key)}: ${JSON.stringify(value)}`).join(', ')}}`;
|
||||
return `{\n "entries": [\n${entries.map(entry => ` ${line(entry)}`).join(',\n')}\n ]\n}\n`;
|
||||
}
|
||||
|
||||
export type BaseAllowlistRead =
|
||||
| { status: 'ok'; entries: SeedAllowlistEntry[] | null }
|
||||
| { status: 'unavailable'; reason: string };
|
||||
|
||||
Reference in new issue
Block a user