Skip to content

feat: add orchestration state status predicates - #376

Merged
wangbill (YunchuWang) merged 1 commit into
mainfrom
yunchuwang-orchestration-status-predicates
Oct 1, 2026
Merged

wangbill (YunchuWang) merged 1 commit into
mainfrom
yunchuwang-orchestration-status-predicates

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

What changed?

  • Add getter-only OrchestrationState.isRunning and isCompleted, computed from the current mutable runtimeStatus.
  • isRunning is true only for RUNNING. isCompleted is true only for COMPLETED, FAILED, or TERMINATED: completion does not imply success. PENDING, SUSPENDED, CONTINUED_AS_NEW, and CANCELED return false for both.
  • Add status-table, mutation, and getter-only regression tests plus core release notes. No constructor, enum, query, lifecycle, provider, or HTTP changes.

Why is this change needed?

Issues / work items

  • N/A.

Project checklist

  • Release notes are not required for the next release
    • Otherwise: Notes added to CHANGELOG.md
  • Backport is not required
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • All required tests have been added/updated (unit tests, E2E tests)
  • Breaking change?
    • If yes:
      • Impact: N/A; additive concrete-class getters.
      • Migration guidance: N/A.

AI-assisted code disclosure (required)

Was an AI tool used? (select one)

  • No
  • Yes, AI helped write parts of this PR (e.g., GitHub Copilot)
  • Yes, an AI agent generated most of this PR

If AI was used:

  • Tool(s): GitHub Copilot.
  • AI-assisted areas/files: Core state getters, their unit tests, and CHANGELOG.md.
  • What you changed after AI output: Agent self-review and automated verification only; no human review is claimed.

AI verification (required if AI was used):

  • I understand the code and can explain it
  • I verified referenced APIs/types exist and are correct
  • I reviewed edge cases/failure paths (timeouts, retries, cancellation, exceptions)
  • I reviewed concurrency/async behavior
  • I checked for unintended breaking or behavior changes

Human attestations above are intentionally left for the reviewer.


Testing

Automated tests

  • Result: Passed. TDD RED: 12 new tests failed at runtime for missing predicates while 10 existing tests passed. GREEN: 40/40 tests across orchestration-state.spec.ts, new-orchestration-state.spec.ts, and test-client-serialization.spec.ts.
  • npm run build:core and a public declaration consumer type-check passed, including boolean reads, rejected writes, and the client return type.
  • Scoped ESLint and git diff --check passed. Added-code Prettier comparison passed against the base; two pre-existing wrapping differences remain untouched, and CRLF is preserved.
  • Broad suites, sidecar/Azure tests, and hosted CI were not run locally.

Manual validation (only if runtime/behavior changed)

  • Environment (OS, Node.js version, components): Windows, Node.js v24.14.0; local core SDK only.
  • Steps + observed results: N/A; the pure computed getters are covered by automated checks for all eight statuses, unknown numeric status, mutation, and getter-only behavior.
  • Evidence (optional): Local red/green JSON and validation logs retained in the agent session.

Notes for reviewers

  • This PR is independent of durable HTTP work. CANCELED is deliberately excluded to preserve the exact .NET predicate semantics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e0af01a5-0dfa-4e71-a660-c4186e65d7e0
Copilot AI balanced review requested due to automatic review settings September 29, 2026 16:42

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.

Copilot review overview

🟢 Approval recommended

The implementation matches the documented .NET semantics and has comprehensive focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Adds .NET-aligned runtime-status predicates to OrchestrationState.

Changes:

  • Adds getter-only isRunning and isCompleted properties.
  • Tests all statuses, mutation behavior, and getter-only semantics.
  • Documents the public API addition.
File Description
packages/​durabletask-js/​src/​orchestration/​orchestration-state.ts Implements status predicates.
packages/​durabletask-js/​test/​orchestration-state.spec.ts Adds predicate regression tests.
CHANGELOG.md Records the new API.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@YunchuWang
wangbill (YunchuWang) merged commit 7886256 into main Oct 1, 2026
31 checks passed
@YunchuWang
wangbill (YunchuWang) deleted the yunchuwang-orchestration-status-predicates branch October 1, 2026 18:55
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.

3 participants