@@ -13,13 +13,12 @@ import { Location } from "@opencode/schema/location"
1313import { AbsolutePath } from "@opencode/schema/schema"
1414import { LayerNode } from "@opencode/util/effect/layer-node"
1515import { Global } from "@opencode/util/global"
16- import { Context , Deferred , Duration , Effect , Fiber , Layer , LayerMap , Option , RcMap } from "effect"
17- import { HttpEffect , HttpRouter , HttpServer } from "effect/unstable/ http"
16+ import { Context , Duration , Effect , Layer , LayerMap } from "effect"
17+ import { HttpEffect , HttpRouter , HttpServer } from "effect/http"
1818import { tempGlobalLayer } from "../../core/test/fixture/global"
1919import { tmpdirScoped } from "../../core/test/fixture/tmpdir"
2020import { it } from "../../core/test/lib/effect"
2121import { createEmbeddedRoutes } from "../src/routes"
22- import { cachedLocation } from "../src/location"
2322
2423it . live (
2524 "reads pending session prompts without booting cold locations" ,
@@ -28,7 +27,6 @@ it.live(
2827 const directory = yield * tmpdirScoped ( )
2928 const location = LocationServiceMap . canonical ( Location . Ref . make ( { directory : AbsolutePath . make ( directory . path ) } ) )
3029 const lookups : Location . Ref [ ] = [ ]
31- const closed : Location . Ref [ ] = [ ]
3230 const replacements : LayerNode . Replacements = [
3331 Global . node . replace ( tempGlobalLayer ) ,
3432 App . node . replace ( App . node ) ,
@@ -43,10 +41,7 @@ it.live(
4341 const map = yield * LayerMap . make (
4442 ( ref : Location . Ref ) => {
4543 lookups . push ( ref )
46- return Layer . merge (
47- Instance . layer ( ref , { discovery : false , replacements : bindings } ) ,
48- Layer . effectDiscard ( Effect . addFinalizer ( ( ) => Effect . sync ( ( ) => closed . push ( ref ) ) ) ) ,
49- )
44+ return Instance . layer ( ref , { discovery : false , replacements : bindings } )
5045 } ,
5146 { idleTimeToLive : Duration . infinity } ,
5247 )
@@ -115,26 +110,6 @@ it.live(
115110 expect ( yield * read ( `/api/session/${ session . id } /permission` ) ) . toEqual ( { data : [ pending . permission ] } )
116111 expect ( yield * read ( global ) ) . toEqual ( { data : [ pending . globalForm ] } )
117112 expect ( lookups ) . toEqual ( [ location ] )
118- expect ( Array . from ( yield * RcMap . keys ( locations . rcMap ) ) ) . toEqual ( [ location ] )
119- const entered = yield * Deferred . make < void > ( )
120- const release = yield * Deferred . make < void > ( )
121- const reading = yield * cachedLocation (
122- locations ,
123- location ,
124- Effect . gen ( function * ( ) {
125- const forms = yield * Form . Service
126- yield * Deferred . succeed ( entered , undefined )
127- yield * Deferred . await ( release )
128- return yield * forms . list ( { sessionID : session . id } )
129- } ) ,
130- ) . pipe ( Effect . forkChild )
131- yield * Deferred . await ( entered )
132- yield * locations . invalidate ( location )
133- expect ( closed ) . toEqual ( [ ] )
134- expect ( lookups ) . toEqual ( [ location ] )
135- yield * Deferred . succeed ( release , undefined )
136- expect ( yield * Fiber . join ( reading ) ) . toEqual ( Option . some ( [ pending . form ] ) )
137- expect ( closed ) . toEqual ( [ location ] )
138113 } ) ,
139114 15_000 ,
140115)
0 commit comments