Skip to content

fix: normalize entity query prefix in client.getEntities#286

Merged
YunchuWang merged 1 commit into
mainfrom
copilot-finds/bug/fix-getentities-query-normalization
Jul 8, 2026
Merged

fix: normalize entity query prefix in client.getEntities#286
YunchuWang merged 1 commit into
mainfrom
copilot-finds/bug/fix-getentities-query-normalization

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #222

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>
Copilot AI review requested due to automatic review settings July 7, 2026 21:56

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

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.instanceIdStartsWith in TaskHubGrpcClient.getEntities() using normalizeInstanceIdPrefix before 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().

@YunchuWang
YunchuWang merged commit 1a36fc8 into main Jul 8, 2026
29 checks passed
@YunchuWang
YunchuWang deleted the copilot-finds/bug/fix-getentities-query-normalization branch July 8, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[copilot-finds] Bug: client.getEntities() does not normalize instanceIdStartsWith prefix, causing silent query failures

3 participants