Problem
TaskHubGrpcClient.getEntities() passes the instanceIdStartsWith query parameter directly to the gRPC backend without normalizing it. Entity names are stored in lowercase with the @name@key format (e.g., @counter@my-key), but the client sends the raw user-provided prefix.
File: packages/durabletask-js/src/client/client.ts, lines 1106-1110
This means:
getEntities({ instanceIdStartsWith: "Counter" }) sends "Counter" instead of "@counter"
getEntities({ instanceIdStartsWith: "Counter@User" }) sends "Counter@User" instead of "@counter@User"
Queries with mixed-case names or missing @ prefix silently return zero results.
Root Cause
The normalizeInstanceIdPrefix() utility function was specifically created to handle this normalization (adding @ prefix, lowercasing the name portion while preserving key case). It is well-tested in entity-query.spec.ts and exported from the package. However, the getEntities() method in client.ts does not call it.
The createEntityQuery() helper that wraps this normalization is also exported for user convenience, but the client itself never applies it internally.
Proposed Fix
Import normalizeInstanceIdPrefix and apply it to query.instanceIdStartsWith before sending the query to the backend. This is a one-line change that connects the existing normalization utility to the client method that needs it.
Impact
Severity: Medium — Entity queries with non-normalized prefixes return empty results with no error, making it a silent data loss issue. Users who happen to pass already-normalized prefixes (e.g., "@counter@") are not affected.
Affected scenarios: Any call to getEntities() where the instanceIdStartsWith value uses mixed-case entity names or omits the leading @.
Problem
TaskHubGrpcClient.getEntities()passes theinstanceIdStartsWithquery parameter directly to the gRPC backend without normalizing it. Entity names are stored in lowercase with the@name@keyformat (e.g.,@counter@my-key), but the client sends the raw user-provided prefix.File:
packages/durabletask-js/src/client/client.ts, lines 1106-1110This means:
getEntities({ instanceIdStartsWith: "Counter" })sends"Counter"instead of"@counter"getEntities({ instanceIdStartsWith: "Counter@User" })sends"Counter@User"instead of"@counter@User"Queries with mixed-case names or missing
@prefix silently return zero results.Root Cause
The
normalizeInstanceIdPrefix()utility function was specifically created to handle this normalization (adding@prefix, lowercasing the name portion while preserving key case). It is well-tested inentity-query.spec.tsand exported from the package. However, thegetEntities()method inclient.tsdoes not call it.The
createEntityQuery()helper that wraps this normalization is also exported for user convenience, but the client itself never applies it internally.Proposed Fix
Import
normalizeInstanceIdPrefixand apply it toquery.instanceIdStartsWithbefore sending the query to the backend. This is a one-line change that connects the existing normalization utility to the client method that needs it.Impact
Severity: Medium — Entity queries with non-normalized prefixes return empty results with no error, making it a silent data loss issue. Users who happen to pass already-normalized prefixes (e.g.,
"@counter@") are not affected.Affected scenarios: Any call to
getEntities()where theinstanceIdStartsWithvalue uses mixed-case entity names or omits the leading@.