fix: validate invalid createTimer inputs#288
Merged
YunchuWang merged 3 commits intoJul 8, 2026
Merged
Conversation
…alid Date createTimer() silently accepted NaN, Infinity, and invalid Date objects, producing timers with corrupted protobuf Timestamps (defaulting to Unix epoch). This caused timers to fire immediately instead of at the intended time, with no error reported to the orchestrator author. Add validation for: - Non-finite number inputs (NaN, Infinity, -Infinity): throws with descriptive message - Invalid Date objects (NaN timestamp): throws with descriptive message - Valid inputs (finite numbers, valid Dates, zero, negatives): accepted as before Fixes #220 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens RuntimeOrchestrationContext.createTimer() input handling so invalid values don’t silently produce corrupted durable timer timestamps (notably falling back to the Unix epoch), addressing issue #220.
Changes:
- Added runtime validation in
createTimer()to reject non-finite numeric delays (NaN,±Infinity) and invalidDateobjects. - Added Jest coverage for rejected/accepted
createTimer()inputs via executor-driven orchestration execution.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/durabletask-js/src/worker/runtime-orchestration-context.ts | Adds validation for createTimer() inputs before creating timer actions. |
| packages/durabletask-js/test/createtimer-validation.spec.ts | Adds unit tests covering invalid and valid createTimer() inputs and expected outcomes. |
Reject finite numeric timer delays that overflow Date after conversion, preventing invalid timestamps from reaching protobuf serialization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate number, Date, and invalid runtime input handling before validating the computed timer date. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kaibocai
approved these changes
Jul 8, 2026
YunchuWang
deleted the
copilot-finds/bug/createtimer-invalid-input-validation
branch
July 8, 2026 19:50
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 #220