fix: add input validation guards to signalEntity() and getEntity()#325
Open
YunchuWang wants to merge 1 commit into
Open
fix: add input validation guards to signalEntity() and getEntity()#325YunchuWang wants to merge 1 commit into
YunchuWang wants to merge 1 commit into
Conversation
…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>
Contributor
There was a problem hiding this comment.
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()foridandoperationName. - Add required-parameter guard to
TaskHubGrpcClient.getEntity()forid. - 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. |
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.
Fixes #214.
signalEntity()andgetEntity()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-validationas a PR (automated triage of active [copilot-finds] issues that had a ready fix branch but no open PR).