Pass typed parent data to ActorHost factories - #87
Conversation
cevr
left a comment
There was a problem hiding this comment.
Review guide for parent-owned ActorHost data. Two Counsel rounds accepted this revision. The full local gate passed.
| Effect.flatMap((requested) => | ||
| Machine.scoped(options.spawn(requested).pipe(Effect.tap((actor) => actor.start))), | ||
| Machine.scoped( | ||
| options.spawn(requested, hostInput).pipe(Effect.tap((actor) => actor.start)), |
There was a problem hiding this comment.
- Parent data stays with the generation.
parent state
- host(request)
+ host(request, hostInput)
acquire(request)
Deferred.await(entry.requested)
- spawn(requested)
+ spawn(requested, hostInput)The host closure supplies the second argument. A consumer cannot replace it. Existing request matching and scope cleanup stay intact. This call trace comes from source; calldiff is unavailable in this environment.
| }).pipe(Effect.provide(ActorSystemDefault)), | ||
| ); | ||
|
|
||
| it.scoped("keeps typed host data with its generation across consumers and reentry", () => |
There was a problem hiding this comment.
- Check generation and type boundaries.
The actual machine receives rewards:early from an early consumer and its first owner. A later consumer gets the same actor. After the owner closes, reentry yields a new actor with history:next. The type-constraints test also rejects missing host data, invalid host data, and attempts to pass host data through acquire.
Full gate: 396 tests, 909 assertions, types, lint, format, build, and example gates passed.
A parent can now supply typed startup data to an ActorHost generation. Consumers still request the actor with their own input. This lets a parent select a screen destination without making the UI copy or reconstruct that decision.
Call
host(request, hostInput)and type the second argument ofspawn(request, hostInput). Existing one-argument factories keep their behavior. Host data stays with its generation across shared consumers and is replaced on reentry.The full gate passes: types, lint, format, 396 tests with 909 assertions, build, and all example gates. New runtime coverage checks early acquisition, shared consumers, closure, and reentry. Type checks reject missing or invalid host data and consumer overrides. A minor changeset is included.