Problem
getNewEventSummary() in packages/durabletask-js/src/worker/index.ts (line 61) does not apply the ?? "UNKNOWN" fallback when enumValueToKey() returns undefined for an unrecognized event type in the single-event code path.
When a new event type is added to the protobuf definitions but not yet mapped in the JS enum, or when an unexpected event type value is received, the function produces the string [undefined] in log output instead of [UNKNOWN].
File: packages/durabletask-js/src/worker/index.ts, line 61
Root Cause
The single-event path uses enumValueToKey() directly without a nullish coalescing fallback:
const enumKey = enumValueToKey(pb.HistoryEvent.EventtypeCase, newEvents[0].getEventtypeCase());
return `[${enumKey}]`; // produces "[undefined]" when enumKey is undefined
While the multi-event path on line 67 correctly uses ?? "UNKNOWN":
const eventTypeName = enumValueToKey(...) ?? "UNKNOWN";
And getActionSummary() also correctly uses ?? "UNKNOWN" in both its single-action (line 87) and multi-action (line 95) paths.
Proposed Fix
Add ?? "UNKNOWN" fallback to the single-event path to match the multi-event path and getActionSummary().
Additionally, add comprehensive unit tests for getNewEventSummary(), getActionSummary(), and getMethodNameForAction() which had zero test coverage.
Impact
Severity: Low — affects log output only, not runtime behavior.
Scenarios: Triggered when the sidecar sends an event type not yet mapped in the JS SDK's protobuf enum bindings, producing confusing [undefined] in worker logs instead of [UNKNOWN].
Problem
getNewEventSummary()inpackages/durabletask-js/src/worker/index.ts(line 61) does not apply the?? "UNKNOWN"fallback whenenumValueToKey()returnsundefinedfor an unrecognized event type in the single-event code path.When a new event type is added to the protobuf definitions but not yet mapped in the JS enum, or when an unexpected event type value is received, the function produces the string
[undefined]in log output instead of[UNKNOWN].File:
packages/durabletask-js/src/worker/index.ts, line 61Root Cause
The single-event path uses
enumValueToKey()directly without a nullish coalescing fallback:While the multi-event path on line 67 correctly uses
?? "UNKNOWN":And
getActionSummary()also correctly uses?? "UNKNOWN"in both its single-action (line 87) and multi-action (line 95) paths.Proposed Fix
Add
?? "UNKNOWN"fallback to the single-event path to match the multi-event path andgetActionSummary().Additionally, add comprehensive unit tests for
getNewEventSummary(),getActionSummary(), andgetMethodNameForAction()which had zero test coverage.Impact
Severity: Low — affects log output only, not runtime behavior.
Scenarios: Triggered when the sidecar sends an event type not yet mapped in the JS SDK's protobuf enum bindings, producing confusing
[undefined]in worker logs instead of[UNKNOWN].