@@ -5,6 +5,7 @@ import path from 'node:path';
55import { test } from 'vitest' ;
66import { createSnapshotSourceHost } from './host.ts' ;
77import { ensureSnapshotBridgeBinary } from './cache.ts' ;
8+ import { createSnapshotSourceDeadline } from './deadline.ts' ;
89import { DEFAULT_SNAPSHOT_SOURCE_LIMITS } from './limits.ts' ;
910import type { SnapshotSourceHost } from './types.ts' ;
1011
@@ -34,6 +35,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
3435 host,
3536 runtime : 'iOS 26.2' ,
3637 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
38+ deadline : testDeadline ( ) ,
3739 sourceRoot,
3840 cacheRoot,
3941 } ) ;
@@ -44,6 +46,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
4446 host,
4547 runtime : 'iOS 26.2' ,
4648 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
49+ deadline : testDeadline ( ) ,
4750 sourceRoot,
4851 cacheRoot,
4952 } ) ;
@@ -55,6 +58,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
5558 host,
5659 runtime : 'iOS 26.2' ,
5760 limits : { ...DEFAULT_SNAPSHOT_SOURCE_LIMITS , maxNodes : 200 , maxTraversalDepth : 12 } ,
61+ deadline : testDeadline ( ) ,
5862 sourceRoot,
5963 cacheRoot,
6064 } ) ;
@@ -65,6 +69,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
6569 host,
6670 runtime : 'iOS 26.2' ,
6771 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
72+ deadline : testDeadline ( ) ,
6873 sourceRoot,
6974 cacheRoot,
7075 } ) ;
@@ -80,6 +85,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
8085 host,
8186 runtime : 'iOS 26.2' ,
8287 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
88+ deadline : testDeadline ( ) ,
8389 sourceRoot,
8490 cacheRoot,
8591 } ) ;
@@ -90,6 +96,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
9096 host,
9197 runtime : 'iOS 26.2' ,
9298 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
99+ deadline : testDeadline ( ) ,
93100 sourceRoot,
94101 cacheRoot,
95102 } ) ;
@@ -101,6 +108,7 @@ test('snapshot bridge preparation is cold-once, atomic, and invalidates corrupt
101108 host,
102109 runtime : 'iOS 26.2' ,
103110 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
111+ deadline : testDeadline ( ) ,
104112 sourceRoot,
105113 cacheRoot,
106114 } ) ;
@@ -133,6 +141,7 @@ test('concurrent snapshot bridge preparation publishes one cache entry', async (
133141 host,
134142 runtime : 'iOS 26.2' ,
135143 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
144+ deadline : testDeadline ( ) ,
136145 sourceRoot,
137146 cacheRoot,
138147 } ) ,
@@ -172,7 +181,7 @@ test('an aborted cache waiter does not cancel an independent preparation', async
172181 host,
173182 runtime : 'iOS 26.2' ,
174183 limits : { ...DEFAULT_SNAPSHOT_SOURCE_LIMITS , maxDurationMs : 300 } ,
175- signal : controller . signal ,
184+ deadline : testDeadline ( 300 , controller . signal ) ,
176185 sourceRoot,
177186 cacheRoot,
178187 } ) ;
@@ -182,6 +191,7 @@ test('an aborted cache waiter does not cancel an independent preparation', async
182191 host,
183192 runtime : 'iOS 26.2' ,
184193 limits : DEFAULT_SNAPSHOT_SOURCE_LIMITS ,
194+ deadline : testDeadline ( ) ,
185195 sourceRoot,
186196 cacheRoot,
187197 } ) ;
@@ -205,6 +215,13 @@ async function expectRejectedCancellation(value: Promise<unknown>): Promise<void
205215 } ) ;
206216}
207217
218+ function testDeadline (
219+ timeoutMs = DEFAULT_SNAPSHOT_SOURCE_LIMITS . maxDurationMs ,
220+ signal ?: AbortSignal ,
221+ ) {
222+ return createSnapshotSourceDeadline ( timeoutMs , signal ) ;
223+ }
224+
208225function createFakeBuildHost (
209226 binary : string | ( ( ) => string | Promise < string > ) ,
210227 getXcode : ( ) => string = ( ) => 'Xcode 16.4\nBuild version 16F6' ,
0 commit comments