@@ -493,6 +493,40 @@ it.effect(
493493 } ) . pipe ( Effect . scoped , Effect . provide ( NodeServices . layer ) ) ,
494494) ;
495495
496+ it . effect . each ( [ "download" , "validation" ] as const ) (
497+ "keeps the timeout message scoped to the download (%s)" ,
498+ ( stage ) =>
499+ Effect . gen ( function * ( ) {
500+ const fs = yield * FileSystem . FileSystem ;
501+ const started = yield * Deferred . make < void > ( ) ;
502+ const stall = Deferred . succeed ( started , undefined ) . pipe ( Effect . andThen ( Effect . never ) ) ;
503+ const h = yield * makeHarness ( {
504+ platform : "win32" ,
505+ spawner : makeWindowsTar ( fs , [ ] ) ,
506+ ...( stage === "download"
507+ ? {
508+ body : Stream . concat (
509+ Stream . succeed ( archive . subarray ( 0 , 10 ) ) ,
510+ Stream . fromEffect ( stall ) ,
511+ ) ,
512+ }
513+ : { options : { validate : ( ) => stall } } ) ,
514+ } ) ;
515+ yield * h . installation . start ;
516+ yield * Deferred . await ( started ) ;
517+ yield * TestClock . adjust ( stage === "download" ? "45 minutes" : "90 seconds" ) ;
518+ expect ( yield * terminalState ( h . installation ) ) . toMatchObject ( {
519+ phase : "failed" ,
520+ message :
521+ stage === "download"
522+ ? "The Codex download timed out. Retry installation."
523+ : "Could not install Codex. Check disk space and directory access, then try again." ,
524+ } ) ;
525+ expect ( h . downloads ( ) ) . toBe ( 1 ) ;
526+ expect ( yield * h . fs . readDirectory ( h . installation . managedDirectory ) ) . toEqual ( [ ] ) ;
527+ } ) . pipe ( Effect . scoped , Effect . provide ( NodeServices . layer ) ) ,
528+ ) ;
529+
496530it . effect ( "cancels an in-flight download and cleans the staging directory" , ( ) =>
497531 Effect . gen ( function * ( ) {
498532 const downloading = yield * Deferred . make < void > ( ) ;
0 commit comments