Skip to content

Commit b26326f

Browse files
use strict nondeterminism option to enable/disable new checks
1 parent bff285f commit b26326f

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

internal/internal_activity.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,9 @@ func deSerializeFunctionResult(f interface{}, result []byte, to interface{}, dat
432432
}
433433

434434
// For everything we return result.
435-
// TODO(remove comment):
436-
// Code reaches here for 2 cases
437-
// 1. activity is executed by name (not the func pointer) and it wasn't registered
438-
// 2. activity is executed by func pointer and the signature indicates it doesn't/can't return data.
435+
// Code reaches here for 2 cases:
436+
// 1. activity is executed by name (not the func pointer) and it wasn't registered
437+
// 2. activity is executed by func pointer and the signature indicates it doesn't/can't return data.
439438
// for example it only has one return parameter (which can only be be error).
440439
return decodeArg(dataConverter, result, to)
441440
}

internal/internal_task_handlers.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,8 @@ ProcessEvents:
936936
isLast := !isInReplay && i == len(reorderedEvents)-1
937937
if !skipReplayCheck {
938938
isDecisionEventFn := isDecisionEvent
939-
if isInReplay {
939+
// when strict nondeterminism is enabled we use a different function to check for decision events during replay
940+
if !w.wth.disableStrictNonDeterminism && isInReplay {
940941
isDecisionEventFn = isDecisionEventForReplay
941942
}
942943

@@ -961,10 +962,15 @@ ProcessEvents:
961962
return nil, err
962963
}
963964

964-
// Break the event processing loop if the workflow is completed except in replay mode.
965-
// In replay mode we check for nondeterminism cases and
966-
// breaking the loop causes missing events in respondEvents which then causes false positives or false negatives.
967-
if w.isWorkflowCompleted && !isInReplay {
965+
// Break the event processing loop if either
966+
// - Workflow is completed AND strict nondeterminism checks disabled.
967+
// - Workflow is completed AND strict nondeterminism checks enabled AND NOT in replay mode.
968+
// With strict nondeterminism checks enabled, breaking the loop early causes missing events
969+
// in respondEvents which then causes false positives or false negatives.
970+
stopProcessing := (w.isWorkflowCompleted && w.wth.disableStrictNonDeterminism) ||
971+
(w.isWorkflowCompleted && !w.wth.disableStrictNonDeterminism && !isInReplay)
972+
973+
if stopProcessing {
968974
break ProcessEvents
969975
}
970976
}

0 commit comments

Comments
 (0)