sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

Pass real WorkflowId for full replay exposed to users in Worker#replayWorkflowExecution

Open Spikhalskiy opened this issue 3 years ago • 4 comments

Actual Behavior

Currently during a full replay that is explicitly exposed to users using Worker#replayWorkflowExecution, JavaSDK supplies fake WorkflowId which can break determinism if workflow code depends on these values.

Expected Behavior

Actual values from the history should be taken and supplied to the Workflow in WorkflowInfo during replay.

Additional context

https://community.temporal.io/t/recommended-approach-to-testing-backwards-compatibility/5511

Good catch from Max that the same shouldn't apply to RunID, because usage of runId in workflow code is non-deterministic (think of reset)

Spikhalskiy avatar Aug 19 '22 05:08 Spikhalskiy

The workflow code must not depend on runId as reset operation changes it.

mfateev avatar Aug 19 '22 17:08 mfateev

@mfateev Fair, good catch on runId. I will add this comment on WorkflowInfo#getRunId javadoc, because I don't think we state this unobvious fact anywhere.

Spikhalskiy avatar Aug 19 '22 17:08 Spikhalskiy

We should consider putting run_id in unsafe (might be too late though), the only issue is that the current run_id isn't stored in history so we can't provide it to the replayer, we only have original_run_id in WorkflowExecutionStarted which is the closest thing.

bergundy avatar Aug 19 '22 18:08 bergundy

There is originalRunId that is preserved on reset.

mfateev avatar Aug 20 '22 01:08 mfateev

Addressed by #1497

Spikhalskiy avatar Jan 26 '23 19:01 Spikhalskiy