Skip to content

Pass typed parent data to ActorHost factories - #87

Merged
cevr merged 1 commit into
mainfrom
feat/actor-host-data
Sep 7, 2026
Merged

Pass typed parent data to ActorHost factories#87
cevr merged 1 commit into
mainfrom
feat/actor-host-data

Conversation

@cevr

@cevr cevr commented Sep 7, 2026

Copy link
Copy Markdown
Owner

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 of spawn(request, hostInput). Existing one-argument factories keep their behavior. Host data stays with its generation across shared consumers and is replaced on reentry.

 parent state
-  host(request)
+  host(request, hostInput)
     acquire(request)
-      spawn(request)
+      spawn(request, hostInput)

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.

@cevr cevr left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review guide for parent-owned ActorHost data. Two Counsel rounds accepted this revision. The full local gate passed.

Comment thread src/actor-host.ts
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)),

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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.

Comment thread test/actor-host.test.ts
}).pipe(Effect.provide(ActorSystemDefault)),
);

it.scoped("keeps typed host data with its generation across consumers and reentry", () =>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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.

@cevr
cevr merged commit 9fb5d36 into main Sep 7, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant