fix: normalize entity query prefix in client.getEntities#286
Merged
YunchuWang merged 1 commit intoJul 8, 2026
Merged
Conversation
The getEntities() method was passing the instanceIdStartsWith query parameter directly to the gRPC backend without normalizing it. Entity names are stored lowercase with '@' prefix format (@name@key), so queries with mixed-case names or missing '@' prefix would silently return zero results. The normalizeInstanceIdPrefix() utility already existed for this purpose but was not called by the client. This change applies the normalization before sending the query to the backend. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a client-side entity-query usability bug by normalizing getEntities()’s instanceIdStartsWith prefix into the backend’s expected entity ID prefix form (e.g., @name@key, with name lowercased). This aligns TaskHubGrpcClient.getEntities() with the existing entity-query normalization utilities and prevents silent “zero results” failures when users pass mixed-case or non-@-prefixed names.
Changes:
- Normalize
query.instanceIdStartsWithinTaskHubGrpcClient.getEntities()usingnormalizeInstanceIdPrefixbefore sending the gRPC request. - Add unit tests that assert the normalized prefix is what gets serialized into the protobuf request.
- Add coverage for undefined prefixes and already-normalized prefixes to ensure behavior remains stable.
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 | Applies normalizeInstanceIdPrefix() to getEntities() query prefixes before calling the backend. |
| packages/durabletask-js/test/entity-client.spec.ts | Adds unit tests that validate prefix normalization is reflected in the protobuf request sent by getEntities(). |
kaibocai
approved these changes
Jul 8, 2026
YunchuWang
deleted the
copilot-finds/bug/fix-getentities-query-normalization
branch
July 8, 2026 19:51
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 #222