Conversation
…n, and completion paths Replace truthy checks with explicit !== undefined checks when serializing inputs and results in RuntimeOrchestrationContext. Previously, falsy values like 0, empty string, false, and null were silently dropped because the code used 'if (input)' instead of 'if (input !== undefined)'. Affected paths: - callActivity: input serialization - callSubOrchestrator: input serialization - setComplete: orchestration result serialization - getActions (continue-as-new): newInput and carryover event serialization Note: sendEvent, signalEntity, and callEntity already used the correct !== undefined check and were not affected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes serialization so falsy JavaScript values (0, "", false, null) are no longer silently dropped when encoding orchestration/activity inputs and outputs.
Changes:
- Replaced truthy checks with explicit
!== undefinedchecks across runtime serialization paths. - Added a new Jest spec file covering activity input, sub-orchestrator input, orchestration results, and
continueAsNewbehavior for falsy values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/durabletask-js/src/worker/runtime-orchestration-context.ts | Ensures serialization includes falsy values by checking !== undefined before JSON encoding. |
| packages/durabletask-js/test/falsy-input-serialization.spec.ts | Adds unit tests to prevent regressions for falsy-value serialization across multiple APIs. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Fix activity-executor.ts: activityOutput ? activityOutput !== undefined ? (same truthy bug as the input paths, causing 0, '', false, null to be dropped from activity return values) - Add 5 unit tests for activity output falsy values - Add 9 e2e tests verifying falsy value round-trips against real DTS: - 4 activity round-trips (0, '', false, null) - 1 sub-orchestration round-trip (0) - 3 orchestration results (0, false, '') - 1 continueAsNew with zero input
torosent
approved these changes
Mar 6, 2026
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.
Summary
Fixes #127
Falsy JavaScript values (
0,"",false,null) were silently dropped when passed as activity input, sub-orchestration input, orchestration return values, andcontinueAsNewinput. This happened because the serialization code used truthy checks (if (input)) instead of explicit undefined checks (if (input !== undefined)).Changes
runtime-orchestration-context.ts:callActivity—input ? JSON.stringify(input)→input !== undefined ? JSON.stringify(input)callSubOrchestrator— same patternsetComplete—if (result)→if (result !== undefined)getActions(continue-as-new input) —this._newInput ?→this._newInput !== undefined ?getActions(carryover events) —eventValue ?→eventValue !== undefined ?Tests
14 new unit tests in
falsy-input-serialization.spec.ts:callActivitywith each falsy value (0, "", false, null)callSubOrchestratorwith each falsy valuecontinueAsNewwith zero inputAll existing unit tests continue to pass.