@@ -13,18 +13,21 @@ import {
1313 planContentionRetry ,
1414 type RetryOutcome ,
1515 type RetryPlan ,
16+ type RunBlocker ,
1617 type TestFailure ,
1718} from './contention-retry.ts' ;
1819
1920export type TestRun = {
2021 ok : boolean ;
2122 failures : readonly TestFailure [ ] ;
23+ /** Non-test failures; any of them forbids a retry. */
24+ blockers ?: readonly RunBlocker [ ] ;
2225} ;
2326
2427/** Telemetry payload for scheduled-lane health (#1430). */
2528export type ContentionRetryTelemetry = {
26- /** Files rerun in this job, with the test that timed out . */
27- retried : ReadonlyArray < { file : string ; testName : string ; trackingIssue : string } > ;
29+ /** Files rerun in this job (one entry per file, not per failed test) . */
30+ retried : ReadonlyArray < { file : string ; testNames : readonly string [ ] ; trackingIssue : string } > ;
2831 retryCount : number ;
2932 retryOutcome : RetryOutcome | null ;
3033 listSize : number ;
@@ -81,7 +84,7 @@ export async function runWithContentionRetry(
8184 return finish ( options , { ok : true , summary : '' , plan : undefined , outcome : null } ) ;
8285 }
8386
84- const plan = planContentionRetry ( first . failures ) ;
87+ const plan = planContentionRetry ( first . failures , first . blockers ?? [ ] ) ;
8588 if ( ! plan . retry ) {
8689 return finish ( options , {
8790 ok : false ,
@@ -111,16 +114,17 @@ function finish(
111114 } ,
112115) : ContentionRetryResult {
113116 const plan = state . plan ;
117+ // Keyed by file, matching what actually reran: two timed-out tests in one file
118+ // are one retry, not two.
114119 const retried = plan ?. retry
115- ? plan . failures . map ( ( failure ) => {
116- const file = normalizeTestFile ( failure . file ) ;
117- return {
118- file,
119- testName : failure . testName ,
120- trackingIssue :
121- CONTENTION_RETRY_FILES . find ( ( entry ) => entry . file === file ) ?. trackingIssue ?? '' ,
122- } ;
123- } )
120+ ? plan . files . map ( ( file ) => ( {
121+ file,
122+ testNames : plan . failures
123+ . filter ( ( failure ) => normalizeTestFile ( failure . file ) === file )
124+ . map ( ( failure ) => failure . testName ) ,
125+ trackingIssue :
126+ CONTENTION_RETRY_FILES . find ( ( entry ) => entry . file === file ) ?. trackingIssue ?? '' ,
127+ } ) )
124128 : [ ] ;
125129 return {
126130 ok : state . ok ,
0 commit comments