[PR #31792] refactor(typing): use enum types for workflow status fields #33411

Closed
opened 2026-02-21 20:53:14 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31792

State: closed
Merged: Yes


Summary

  • Replace status: str with status: WorkflowExecutionStatus in WorkflowFinishStreamResponse.Data and WorkflowAppBlockingResponse.Data
  • Replace status: str with status: WorkflowNodeExecutionStatus in NodeFinishStreamResponse.Data and NodeRetryStreamResponse.Data
  • Remove unnecessary .value calls at assignment sites in WorkflowResponseConverter, passing enum instances directly

This aligns these four response classes with the existing pattern already used by IterationNodeCompletedStreamResponse and LoopNodeCompletedStreamResponse, which correctly use enum type annotations. Since both enums are StrEnum, JSON serialization behavior is unchanged.

Test plan

  • Verified imports succeed
  • Verified Pydantic model_dump() and json.dumps() produce identical string output with StrEnum fields
  • Pre-commit linter checks passed
  • Confirm existing workflow/node stream response tests pass in CI
**Original Pull Request:** https://github.com/langgenius/dify/pull/31792 **State:** closed **Merged:** Yes --- ## Summary - Replace `status: str` with `status: WorkflowExecutionStatus` in `WorkflowFinishStreamResponse.Data` and `WorkflowAppBlockingResponse.Data` - Replace `status: str` with `status: WorkflowNodeExecutionStatus` in `NodeFinishStreamResponse.Data` and `NodeRetryStreamResponse.Data` - Remove unnecessary `.value` calls at assignment sites in `WorkflowResponseConverter`, passing enum instances directly This aligns these four response classes with the existing pattern already used by `IterationNodeCompletedStreamResponse` and `LoopNodeCompletedStreamResponse`, which correctly use enum type annotations. Since both enums are `StrEnum`, JSON serialization behavior is unchanged. ## Test plan - [x] Verified imports succeed - [x] Verified Pydantic `model_dump()` and `json.dumps()` produce identical string output with `StrEnum` fields - [x] Pre-commit linter checks passed - [ ] Confirm existing workflow/node stream response tests pass in CI
yindo added the pull-request label 2026-02-21 20:53:14 -05:00
yindo closed this issue 2026-02-21 20:53:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33411