Skip to content

fix: add input validation guards to signalEntity() and getEntity()#325

Open
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/bug/fix-entity-client-missing-input-validation
Open

fix: add input validation guards to signalEntity() and getEntity()#325
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/bug/fix-entity-client-missing-input-validation

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Fixes #214.

signalEntity() and getEntity() client methods were missing input validation guards, allowing invalid arguments to fail deep in the call stack. This adds explicit validation.


Opens the existing fix branch copilot-finds/bug/fix-entity-client-missing-input-validation as a PR (automated triage of active [copilot-finds] issues that had a ready fix branch but no open PR).

…nd getEntity() client methods

The signalEntity() and getEntity() methods on TaskHubGrpcClient lack the input
validation guards that all comparable public API methods have (e.g.
raiseOrchestrationEvent, terminateOrchestration, suspendOrchestration). Without
validation, passing null or undefined for the required 'id' parameter produces a
confusing TypeError ('Cannot read properties of null') instead of a clear error
message. Similarly, signalEntity() does not validate its required 'operationName'
parameter.

Add validation to both methods matching the established pattern:
- signalEntity: validate 'id' and 'operationName'
- getEntity: validate 'id'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds explicit runtime input validation to the Durable Task JavaScript client’s entity APIs so invalid arguments fail fast with clear, actionable errors (instead of surfacing as deeper TypeErrors), aligning behavior with other public client methods.

Changes:

  • Add required-parameter guards to TaskHubGrpcClient.signalEntity() for id and operationName.
  • Add required-parameter guard to TaskHubGrpcClient.getEntity() for id.
  • Add Jest unit tests covering the new validation error cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/durabletask-js/src/client/client.ts Adds early argument validation for signalEntity() and getEntity() to produce clear errors for invalid inputs.
packages/durabletask-js/test/entity-client.spec.ts Adds unit tests asserting the new validation errors are thrown for null/undefined/empty inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[copilot-finds] Bug: signalEntity() and getEntity() client methods missing input validation guards

3 participants