Skip to content

WCP 3/X: Use correct BatchID in Timeout, Terminated and ContinueAsNew events#10418

Open
simvlad wants to merge 3 commits into
temporalio:mainfrom
simvlad:fix-event-batching-terminate-timeout-can
Open

WCP 3/X: Use correct BatchID in Timeout, Terminated and ContinueAsNew events#10418
simvlad wants to merge 3 commits into
temporalio:mainfrom
simvlad:fix-event-batching-terminate-timeout-can

Conversation

@simvlad
Copy link
Copy Markdown
Contributor

@simvlad simvlad commented May 28, 2026

What changed?

Change HistoryBuilder.Add*Event for Terminate, Timeout and ContinueAsNew events to return batchID alongside the event, so that the callers that previously computed their own batchID just read it from there. Simplifies TerminateWorkflow and TimeoutWorkflow as they no longer have to track eventBatchFirstEventID.

Stacked on #10412

Why?

Pushing batching knowledge to every caller was already error-prone, but after #10357 it is also wrong, since the event may fall on an unexpected batch.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

It's a bit hard to track why the code in TerminateWorkflow guesses the batch id, even though it could have get it from the EventStore, like this PR does. So the risk is that there is some case that I'm not taking into the account.

@simvlad simvlad requested review from a team as code owners May 28, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant