0.2.0: one way to author — Workflow.toLayer hosted by workflowBundle - #2
Merged
Conversation
bweis
force-pushed
the
spike/plain-workflow-syntax
branch
from
August 26, 2026 18:52
cdf9d12 to
65198cf
Compare
bweis
force-pushed
the
spike/plain-workflow-syntax
branch
from
August 26, 2026 18:58
65198cf to
4d8157b
Compare
Prompted by Mattia Manzati's suggestion that a real WorkflowEngine service could retire makeTemporalWorkflow. It does, fully: workflowBundle(layer) hosts `Workflow.toLayer` registrations behind ONE dynamic Temporal default export — a registration-phase engine collects engine.register calls into a per-context registry (memoized, reuseV8Context-safe, duplicate tags rejected loudly) and dispatches workflow types through the per-run wrapper, now runInSandbox. "workflowBundle" is Temporal's own name for this exact artifact: the thing workflowsPath points at. BREAKING: makeTemporalWorkflow is removed. One way to author; the project is young enough to afford the break. (If per-type workflowDefinitionOptions — e.g. Worker Versioning behavior — becomes a need, the worker-level defaultVersioningBehavior covers the dynamic workflow, and a per-type escape hatch can return.) The erased handler seam is typed honestly (contravariant `never` payload, the provided-services union for R): no `any`, exactly one SAFETY-commented cast, replacing the one the old code had. Registered handlers can require services provided by ordinary Layers in the registration environment — proven in registry.test.ts. Every test fixture bundle (16) and both examples use the bundle form, so the entire feature surface — activities, compensation, mailboxes, updates, state cells, children and attach, continue-as-new, versioning chains, nexus, schedules — runs through the registry path: 57 tests green. Docs teach the single authoring form throughout; CHANGELOG carries the breaking 0.2.0 entry.
bweis
force-pushed
the
spike/plain-workflow-syntax
branch
from
August 26, 2026 19:01
4d8157b to
0346977
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prompted by Mattia Manzati's Discord suggestion that a real
WorkflowEngineservice could retiremakeTemporalWorkflowin favor of plain@effect/workflowsyntax. It does — fully. This PR makesWorkflow.toLayerthe only authoring form, hosted byworkflowBundle.What
workflowBundle(layer)— hostsWorkflow.toLayerregistrations behind ONE dynamic Temporal default export ("workflow bundle" is Temporal's own name for this artifact — the thingworkflowsPathpoints at). A registration-phase engine collectsengine.registercalls into a per-V8-context registry (memoized,reuseV8Context-safe, duplicate tags rejected loudly); the default export dispatches by workflow type into the shared per-run wrapper.makeTemporalWorkflowis removed. One way to author; the project is young enough to afford the break. If per-typeworkflowDefinitionOptions(e.g. Worker Versioning behavior) ever becomes a need, the worker-leveldefaultVersioningBehaviorcovers the dynamic workflow, and a per-type escape hatch can be reintroduced.Strictly-better check
neverpayload and the provided-services union forR— noany, exactly oneSAFETY-commented cast, replacing the one the old code had at the same spot.Release after merge:
git tag v0.2.0 && git push --tags(trusted publishing).🤖 Generated with Claude Code