Propagate backlinks on Signal and Signal-with-Start responses#9897
Propagate backlinks on Signal and Signal-with-Start responses#9897long-nt-tran wants to merge 2 commits intotemporalio:mainfrom
Conversation
589224e to
4c69cc2
Compare
bergundy
left a comment
There was a problem hiding this comment.
Here's what's missing:
- Adding to the map that tracks request ID to event ID
- A functional test that verifies that request IDs for all of these requests are added to the map
- Ensure that the workflow start link is only populated if an execution was started
51b9594 to
52c0da3
Compare
|
Addressed feedback, I think the cleanest way to have the requestID be in the mutable state is to have it on the event is to have it be a new field in Also put all testing at functional test level so we can end-to-end assert on request ID presence + concrete event ID resolution -- edited summary to reflect this. |
That makes sense to me because the signal could be cherry picked into a new history branch on conflict resolution and reset and you'll want to carry over the same request ID when that happens. |
| if requestID != "" { | ||
| ms.AttachRequestID(requestID, enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED, common.BufferedEventID) | ||
| } |
There was a problem hiding this comment.
Not quite seeing the value of attaching the buffered event ID here. It's supposed to be a temporary ID.
Also not quite sure how the request ID mapping works with signal-with-start where the same request ID maps to two history events. We shouldn't override the request ID of the WorkflowExecutionStarted event.
I think we may need to extend the proto to allow a single request ID to reference two separate events.
There was a problem hiding this comment.
captured offline discussion in summary -- mapping request ID to multiple events. Will get review from foundation as well before merging
…responses (#761) <!-- Describe what has changed in this PR --> **What changed?** Added `link` fields on `SignalWorkflowExecutionResponse` and `SignalWithStartWorkflowExecutionRequest`. I think a singular link should suffice but if reviewers feel otherwise (especially w.r.t. `SignalWithStartWorkflowExecutionRequest`) let me know. <!-- Tell your future self why have you made these changes --> **Why?** To propagate backlinks on signal and signal-with-start executions back to the caller. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** Not a breaking change (unused field) <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** temporalio/temporal#9897
…responses (#761) <!-- Describe what has changed in this PR --> **What changed?** Added `link` fields on `SignalWorkflowExecutionResponse` and `SignalWithStartWorkflowExecutionRequest`. I think a singular link should suffice but if reviewers feel otherwise (especially w.r.t. `SignalWithStartWorkflowExecutionRequest`) let me know. <!-- Tell your future self why have you made these changes --> **Why?** To propagate backlinks on signal and signal-with-start executions back to the caller. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** Not a breaking change (unused field) <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** temporalio/temporal#9897
52c0da3 to
5209f9b
Compare
5209f9b to
2831286
Compare
What changed?
High level
With temporalio/api#761 to add the linking on the Signal and Signal-with-Start responses, This PR adds logic from the server that:
requestIDfrom Signal and Signal-with-Start requests to the mutable state + event store so these requestIDs stay in bufferrequestIDrequestIDto a concreteeventID, which would allow users to later know which event correlated w/ this requestImportant note: request ID mapping to multiple events
Additionally, because a Signal-with-Start already attaches a
requestIDonto theEVENT_TYPE_WORKFLOW_EXECUTION_STARTEDevent, after offline discussion w/ @bergundy and @Quinn-With-Two-Ns, we decided to augmentRequestIDInfostruct with a slice ofevents_metadatato map to a request ID to multiple events. For compatibility, serde logic still have to populate both -- can be deleted in a future PR once everything is upgraded.Everywhere else in code, I shifted to extract / populate the
events_metadatawhen attaching a request ID to an event. The interesting change is inservice/history/api/describeworkflow/api.go, where we will return theEVENT_TYPE_WORKFLOW_EXECUTION_SIGNALEDevent if there are multiple events mapping to a request ID -- that's because Signal-with-Start is the only request ID where there could be multiple events mapping to that request ID nowadays.Why?
This will enable the caller of the signal to have a backlink to the cross-namespace signal invoked, which will become more relevant for Nexus SDK ergonomics.
How did you test it?
In functional tests, I augmented existing tests for Signal and Signal-with-Start to:
DescribeWorkflowto ensure that we get a concrete EventID (mapped when buffer flushed)requestIDgets de-dupedPotential risks
Need to test end-to-end to see that the link shows up correctly in the Web UI.