@@ -220,14 +220,14 @@ it.effect("cancels a queued request without terminating the active search proces
220220 yield * Effect . gen ( function * ( ) {
221221 const index = yield * Index . make ( "workspace" ) ;
222222 const other = yield * Index . make ( "other" ) ;
223- const blocked = yield * index . search ( "block" , 1 ) . pipe ( Effect . forkChild ) ;
223+ const before = yield * index . list ( ) ;
224+ const active = yield * index . search ( "hold" , 1 ) . pipe ( Effect . forkChild ) ;
224225 yield * Deferred . await ( control . blocked ) ;
225226 const queued = yield * other . list ( ) . pipe ( Effect . forkChild ) ;
226227 yield * Fiber . interrupt ( queued ) ;
227- expect ( yield * Deferred . isDone ( control . exited ) ) . toBe ( false ) ;
228- yield * Fiber . interrupt ( blocked ) ;
229- yield * Deferred . await ( control . exited ) ;
230- expect ( ( yield * other . list ( ) ) . entries ) . toHaveLength ( 1 ) ;
228+ yield * control . release ;
229+ expect ( yield * Fiber . join ( active ) ) . toEqual ( before ) ;
230+ expect ( ( yield * other . list ( ) ) . entries ) . toEqual ( before . entries ) ;
231231 } ) . pipe ( Effect . provideService ( HostProcessEnvironment , control . environment ) ) ;
232232 } ) . pipe ( withWorker ) ,
233233 ) ,
@@ -255,3 +255,24 @@ it.effect("lets an active workspace finish while an unrelated index expires", ()
255255 } ) . pipe ( withWorker ) ,
256256 ) ,
257257) ;
258+
259+ it . effect ( "preserves the shared process after ordinary search and refresh errors" , ( ) =>
260+ Effect . scoped (
261+ Effect . gen ( function * ( ) {
262+ const index = yield * Index . make ( "workspace" ) ;
263+ const other = yield * Index . make ( "other" ) ;
264+ const before = yield * other . list ( ) ;
265+ expect ( yield * Effect . flip ( index . search ( "search-error" , 1 ) ) ) . toMatchObject ( {
266+ _tag : "WorkspaceSearchIndexSearchFailed" ,
267+ reason : "search rejected" ,
268+ } ) ;
269+ expect ( ( yield * other . list ( ) ) . entries ) . toEqual ( before . entries ) ;
270+ expect ( yield * Effect . flip ( index . refresh ( ) ) ) . toMatchObject ( {
271+ _tag : "WorkspaceSearchIndexRefreshFailed" ,
272+ reason : "scan failed" ,
273+ } ) ;
274+ expect ( ( yield * other . list ( ) ) . entries ) . toEqual ( before . entries ) ;
275+ expect ( ( yield * index . list ( ) ) . entries ) . toEqual ( before . entries ) ;
276+ } ) . pipe ( withWorker ) ,
277+ ) ,
278+ ) ;
0 commit comments