Fix started event id reported on workflow task poll in the test server - #3079
Open
sangkyoonnam wants to merge 1 commit into
Open
sangkyoonnam wants to merge 1 commit into
sangkyoonnam wants to merge 1 commit into
Conversation
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.
What was changed
StateMachines#startWorkflowTaskImplnow sets the poll response'sstartedEventIdto the id of theWorkflowTaskStartedevent that was actually added, instead ofscheduledEventId + 1. The query-only path keeps its existing value.WorkflowTaskStartedEventIdTestin the test server module covering a signal that lands betweenWorkflowTaskScheduledandWorkflowTaskStarted.Why?
The test server hardcoded the poll response's
startedEventIdasscheduledEventId + 1. When an event such as a signal lands between the scheduled and started events, that id points at the wrong event: for a history ofWorkflowExecutionStarted(1),WorkflowTaskScheduled(2),WorkflowExecutionSignaled(3),WorkflowTaskStarted(4)the response reported 3. The real server reports the id of the started event itself (workflow_task_state_machine.gosetsStartedEventID = startedEvent.GetEventId()), and the test server already tracks the correct value indata.startedEventId; only the response was wrong. SDKs use this value to verify a workflow task's history was replayed up to the started event (#1916), so a too-small value weakens that check, and the test server binary is shared by the Python, TypeScript, .NET and Ruby SDKs through Core's ephemeral server.Checklist
No open issue for this.
How was this tested:
New
WorkflowTaskStartedEventIdTeststarts a workflow, signals it before any poll, polls, and asserts the response'sstartedEventIdequals theWorkflowTaskStartedevent id in the returned history. Run with./gradlew :temporal-test-server:test --tests "io.temporal.testserver.functional.WorkflowTaskStartedEventIdTest". It fails without the fix (expected:<4> but was:<3>) and passes with it. The test server module and the SDK signal, query, update, sticky and replay tests pass.Any docs updates needed?
No.