Skip to content

fix: preserve V2 entity operation info for index zero#279

Merged
YunchuWang merged 2 commits into
mainfrom
copilot-finds/bug/fix-v2-entity-operationinfos-falsy-zero
Jul 7, 2026
Merged

fix: preserve V2 entity operation info for index zero#279
YunchuWang merged 2 commits into
mainfrom
copilot-finds/bug/fix-v2-entity-operationinfos-falsy-zero

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #224

When a framework-level exception occurs during V2 entity batch execution,
resultsCount is 0 (zero individual results). The expression
`resultsCount || operationInfos.length` evaluates to operationInfos.length
because 0 is falsy in JavaScript, causing all operationInfos to be
included despite there being no corresponding results.

Replace with `resultsCount` directly, which is always a number from
.length and needs no fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 18, 2026 17:15

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 falsy-zero bug in the V2 entity execution path so that when a framework-level error produces zero per-operation results, the worker includes zero operationInfos (instead of incorrectly including all infos). This aligns the response payload with the documented intent and avoids confusing/misleading routing metadata for DTS.

Changes:

  • Fix operationInfos slicing in _executeEntityInternal() by using resultsCount directly (preserves the 0 case).
  • Add/extend Jest coverage around V2 operationInfos behavior for success, not-found, multi-operation, and framework-error scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/durabletask-js/src/worker/task-hub-grpc-worker.ts Fixes the `resultsCount
packages/durabletask-js/test/worker-entity.spec.ts Adds tests validating V2 operationInfos count matches the number of results, including the framework-error zero-results regression case.

Comment thread packages/durabletask-js/test/worker-entity.spec.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@YunchuWang
YunchuWang merged commit 9ee163f into main Jul 7, 2026
28 checks passed
@YunchuWang
YunchuWang deleted the copilot-finds/bug/fix-v2-entity-operationinfos-falsy-zero branch July 7, 2026 17:01
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: V2 entity execution includes all operationInfos on framework error due to falsy zero

4 participants