feat: Event Groups support (experimental)#2209
Draft
mjameswh wants to merge 2 commits into
Draft
Conversation
Introduce the Event Groups primitive in the Workflow APIs: - `createEventGroup(label)` creates explicit Event Group Markers, attachable to commands via a `groups: [...]` option or an execution scope (`marker.run(...)`, propagated through coroutines via AsyncLocalStorage). Nested scopes compose and markers dedupe by id. - Implicit markers automatically wrap the workflow main function, signal handlers, and update handlers. - Markers are serialized onto outgoing commands as `eventGroupMarkers`; explicit label marker ids are derived deterministically as `SHA1(originalExecutionRunId + label)`. Also exposes `WorkflowInfo.originalExecutionRunId` (plumbed core -> lang) and bumps the sdk-core submodule to the matching build. Includes a proof-of-concept boundary test (test-event-groups.ts) that asserts the markers attached to commands via a `concludeActivation` interceptor.
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.
Warning
Experimental / WIP — opened as a draft for self-review. Not ready for external review yet.
Summary
Initial TypeScript SDK implementation of Event Groups (see the design doc for context).
createEventGroup(label)returns a marker attachable to commands via agroups: [...]option or an execution scope (marker.run(...), propagated through coroutines viaAsyncLocalStorage). Nested scopes compose; markers dedupe by id.eventGroupMarkers. Explicit label marker ids are derived deterministically asSHA1(originalExecutionRunId + label)(sandbox-safe SHA-1 insha1.ts).WorkflowInfo.originalExecutionRunId(plumbed core → lang) and bumps thesdk-coresubmodule to the matching build.Testing
Proof-of-concept boundary test
packages/test/src/test-event-groups.tsasserts the markers attached to commands via aconcludeActivationinterceptor. Run against an Event Groups–capable dev server:```
TESTS_CLI_VERSION=v1.7.4-standalone-nexus-operations ava ./lib/test-event-groups.js
```
Currently 3/3 passing.
Follow-ups / open questions