Add experimental Event Groups support - #1784
Conversation
09293a3 to
426d273
Compare
2f4c4b2 to
fa34107
Compare
fa34107 to
7a893ae
Compare
| if not label: | ||
| raise ValueError("Event group label cannot be empty") | ||
| if id is None: | ||
| # Salted with the run id so that the label cannot be recovered from the |
There was a problem hiding this comment.
Why do we care about the label being recoverable from the id?
There was a problem hiding this comment.
Because we're also processing them through codecs, specifically because we admit that users may want to put sensitive data in their labels. But encoding your label is moot if a hacker can easily break your label's derived ID.
| def _inbound_event_group(event_id: int) -> EventGroup: | ||
| """Create the implicit Event Group for an inbound signal's history event.""" | ||
| if event_id <= 0: | ||
| # Invalid event ID. Don't fail the WFT — return a stub Implicit EG Marker instead. |
There was a problem hiding this comment.
Is this unexpected enough that a warning log is warranted?
| "_Definition", | ||
| "_is_unbound_method_on_cls", | ||
| "_parameters_identical_up_to_naming", | ||
| "_capture_event_group_markers", |
There was a problem hiding this comment.
We put the previous private things in here for legacy reasons when we broke up the file (since they were exported by default previously) but we probably don't want to export them unless you specifically want them to be available off of workflow, which seems unlikely.
There was a problem hiding this comment.
Thanks for the context, I was wondering why we cared. I'll remove my additions.
Sushisource
left a comment
There was a problem hiding this comment.
Overall makes sense to me. Will let Tim approve, his comment about the exports seems important.
Boy oh boy is adding these parameters to 8 billion function overrides annoying. Thank god the LLMs can do it now.
| @@ -0,0 +1,251 @@ | |||
| """Event Groups, a way to regroup logically related workflow events. | |||
There was a problem hiding this comment.
| """Event Groups, a way to regroup logically related workflow events. | |
| """Event Groups, a way to group logically related workflow events. |
Summary
Add experimental support for Event Groups.
Event Groups is a new form of Workflow-level metadata that allows for improved visibility into a Workflow execution's history by grouping logically related Events together based on user-defined or system-inferred criteria.
create_event_group(label)returns a marker attachable to commands via aevent_groups=[...]option or an execution scope (with group.scope():, propagated through coroutines viacontextvars). 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
Event Groups support requires Server v1.32.0-158.0, which has not yet been included in a published CLI release. In the mean time, tests can be run using the following CLI specifier: