From 1f04baa6840bb6f562883ef063e765d6b50a46fd Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Mon, 31 Aug 2026 14:16:40 -0400 Subject: [PATCH] test: migrate fixture layer replacements (#46458) Update the Core compile options and Server replacement values to the current LayerNode API. Preserve test expectations, replacement targets, and layer lifetimes. --- packages/core/test/session-execution.test.ts | 4 ++- .../server/test/session-instances.test.ts | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/core/test/session-execution.test.ts b/packages/core/test/session-execution.test.ts index 076c9052f8b..9892f6c379b 100644 --- a/packages/core/test/session-execution.test.ts +++ b/packages/core/test/session-execution.test.ts @@ -1374,7 +1374,9 @@ function buildExecution( Layer.provide(Layer.succeed(Job.Service, jobs)), // Do not reuse the outer harness's selector with its already-captured Location map. Layer.provide( - LayerNode.compile(Instance.byLocationNode, [[LocationServiceMap.node, locations]]).pipe(Layer.fresh), + LayerNode.compile(Instance.byLocationNode, { + replacements: [LocationServiceMap.node.replace(locations)], + }).pipe(Layer.fresh), ), ), scope, diff --git a/packages/server/test/session-instances.test.ts b/packages/server/test/session-instances.test.ts index bf3cf89eb7e..9663b3c8184 100644 --- a/packages/server/test/session-instances.test.ts +++ b/packages/server/test/session-instances.test.ts @@ -52,18 +52,19 @@ it.live( const cell = PluginRuntime.makeCell() // Host and private instances must reuse the same global layer identities. const replacements: LayerNode.Replacements = [ - [Global.node, tempGlobalLayer], - [Database.node, Database.node], - [Bus.node, Bus.node], - [App.node, App.node], - [ModelsDev.node, ModelsDev.configured({ fetch: false })], - [Watcher.node, Watcher.configured({ enabled: false })], - [PluginRuntime.node, PluginRuntime.layerWithCell(cell)], - [PluginRuntime.providerNode, PluginRuntime.providerNodeWithCell(cell)], - [llmClient, Layer.succeed(LLMClient.Service, llm)], - [SessionRunnerModel.node, Layer.succeed(SessionRunnerModel.Service, { resolve: () => Effect.succeed(model) })], - [ - Instance.byLocationNode, + Global.node.replace(tempGlobalLayer), + Database.node.replace(Database.node), + Bus.node.replace(Bus.node), + App.node.replace(App.node), + ModelsDev.node.replace(ModelsDev.configured({ fetch: false })), + Watcher.node.replace(Watcher.configured({ enabled: false })), + PluginRuntime.node.replace(PluginRuntime.layerWithCell(cell)), + PluginRuntime.providerNode.replace(PluginRuntime.providerNodeWithCell(cell)), + llmClient.replace(Layer.succeed(LLMClient.Service, llm)), + SessionRunnerModel.node.replace( + Layer.succeed(SessionRunnerModel.Service, { resolve: () => Effect.succeed(model) }), + ), + Instance.byLocationNode.replace( Layer.effect( Instance.Service, Effect.gen(function* () { @@ -151,7 +152,7 @@ it.live( }) }), ), - ], + ), ] const context = yield* Layer.build( createEmbeddedRoutes({}, replacements).pipe(Layer.provide(HttpServer.layerServices)),