fix(core): defer cyclic layer dependencies

This commit is contained in:
Dax Raad 2026-07-17 20:25:21 -04:00
commit c4830c147d
4 changed files with 16 additions and 3 deletions

View file

@ -74,7 +74,7 @@ type MakeInput<
T extends Tag | undefined = undefined,
> = NodeIdentity & {
readonly layer: Implementation
readonly deps: Items & CheckDependencies<Implementation, NoInfer<Items>>
readonly deps: (Items | (() => Items)) & CheckDependencies<Implementation, NoInfer<Items>>
readonly tag?: T
}
@ -90,7 +90,9 @@ export function make<
name: input.service !== undefined ? input.service.key : input.name,
service: input.service,
implementation: input.layer,
dependencies: input.deps,
get dependencies() {
return typeof input.deps === "function" ? input.deps() : input.deps
},
tag: input.tag,
}
}

View file

@ -1033,7 +1033,8 @@ const SHELL_MAX_CAPTURE_BYTES = 1024 * 1024
export const node = makeGlobalNode({
service: Service,
layer: layer.pipe(Layer.orDie),
deps: [
// Defer the execution node across the Session/runner module cycle until the graph is compiled.
deps: () => [
Job.node,
Database.node,
EventV2.node,