Repository navigation
Catalog workspaces: an isolated Worker for each demo - #4122
Draft
rossnelson wants to merge 1 commit into
Draft
rossnelson wants to merge 1 commit into
rossnelson wants to merge 1 commit into
Conversation
An authoring target can now declare grouping: 'per-example'. The generated registration then registers one target for each example, with its own task queue, workflow bundle, and activities. The default, 'shared', keeps the current output unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Summary
The catalog gets one new concept: the workspace. A workspace is an isolated environment with its own Worker. Examples are entry points into a workspace.
Why
The catalog runs one Worker for each target, and today every source registers a single target. That works for many small examples that exercise primitives. It does not work for demos that must stand on their own:
Adding demo fields to each example would put Worker properties in the wrong place and grow the example API with optional fields that only some consumers use. A workspace gives those properties a home that is generic to the catalog.
The model
A workspace replaces today's target. It keeps everything a target has and adds optional metadata.
Workspace definition
All metadata is optional. One Zod schema validates it and gives the TypeScript type.
Example scenarios
Scenarios are named preset inputs. Generation checks each scenario input against the example's input schema. Any catalog example can use them, including the existing corpus.
Grouping
A source declares how its examples map to workspaces:
shared(default)per-folder<prefix>-<folder>Generation fails when a derived workspace ID or task queue collides with another workspace.
Controls
Controls let a user crash, stop and start a workspace's Worker to watch Temporal recover.
controls).Each workspace with controls gets a control task queue,
<taskQueue>-control, served by a small control Worker in the same process. The browser starts a short control workflow on that queue. The command travels through the namespace the Worker already polls, so there is no new network path.stopstartcrashControls are off unless the runtime turns them on (for example,
CATALOG_CONTROL=on).Eject
ejectnames the SDKs a workspace can be exported in. Exporting a workspace produces a standalone project: its folder, shared helpers and a generatedworker.ts. The export tooling is a follow-up; this design only reserves the field.Browser artifact
The generated catalog gains a
workspaceslist next todescriptors. Each descriptor'sexecution.workspaceIdpoints into it. The browser can list workspaces (one card per demo) or examples (today's view) from the same artifact.Naming and compatibility
targetbecomesworkspacein the API:registerWorkspace,CatalogWorkspace,execution.workspaceId. The catalog's tooling is consumed through the published package, so the rename ships in one release with the consumer updated in the same version bump. No generated output changes for asharedsource other than the renamed field.Plan
per-foldergrouping, derived IDs and queues, collision checks.workspace.ts, theworkspaceslist in the artifact.per-foldersources, a source option forscaffold, a source filter for bundle builds, eject export.Not in scope