mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 14:38:59 +02:00
fix(test-runner): empty-shard outcome carries failingFiles; harden flaky-retry list
The empty-shard early return omitted the (required) failingFiles field — tsc TS2741 — feeding undefined into the flaky-retry flatMap. Also drop the dead 'else if (worst !== 0)' guard (the enclosing if already pins it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
b75f670a9e
commit
87e64f69ba
@@ -1023,7 +1023,7 @@ export async function runFreeShard(
|
||||
// so an unoccupied index must not fail or shift work to a different runner.
|
||||
if (files.length === 0) {
|
||||
const outcome: FreeShardOutcome = {
|
||||
shard: shardNumber, files: [], status: 'passed', exitCode: 0, elapsedMs: 0, groupPid: null,
|
||||
shard: shardNumber, files: [], status: 'passed', exitCode: 0, elapsedMs: 0, groupPid: null, failingFiles: [],
|
||||
};
|
||||
log(shardEpilogue(outcome, totalShards));
|
||||
return outcome;
|
||||
@@ -1303,7 +1303,8 @@ async function main(): Promise<number> {
|
||||
&& !isTerminationRequested()
|
||||
&& outcomes.every((o) => o.status !== 'timed-out')
|
||||
) {
|
||||
const flakyFiles = [...new Set(outcomes.flatMap((o) => o.failingFiles))];
|
||||
const flakyFiles = [...new Set(outcomes.flatMap((o) => o.failingFiles))]
|
||||
.filter((f): f is string => typeof f === 'string' && f.length > 0);
|
||||
const allAttributed = outcomes.every((o) => o.status === 'passed' || o.failingFiles.length > 0);
|
||||
if (allAttributed && flakyFiles.length > 0 && flakyFiles.length <= RETRY_CAP) {
|
||||
console.log(`[test:free] flaky-retry: re-running ${flakyFiles.length} failing file(s) once, serially: ${flakyFiles.join(', ')}`);
|
||||
@@ -1318,7 +1319,7 @@ async function main(): Promise<number> {
|
||||
} else {
|
||||
console.error('[test:free] flaky-retry FAILED — the failures reproduce serially; not flaky.');
|
||||
}
|
||||
} else if (worst !== 0) {
|
||||
} else {
|
||||
console.log(`[test:free] flaky-retry skipped: ${allAttributed ? `${flakyFiles.length} failing file(s) exceeds cap ${RETRY_CAP}` : 'failures not fully attributed'}.`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user