Skip to content

refactor: use match cases for workflow stream responses#36267

Merged
asukaminato0721 merged 1 commit into
langgenius:mainfrom
D-393Patel:codex-workflow-response-match-case
May 17, 2026
Merged

refactor: use match cases for workflow stream responses#36267
asukaminato0721 merged 1 commit into
langgenius:mainfrom
D-393Patel:codex-workflow-response-match-case

Conversation

@D-393Patel
Copy link
Copy Markdown
Contributor

@D-393Patel D-393Patel commented May 17, 2026

Summary

#35902

Refactors workflow stream response conversion to use Python match cases instead of isinstance branching.

Updated:

  • api/core/app/apps/workflow/generate_response_converter.py
  • api/core/app/apps/pipeline/generate_response_converter.py

Behavior is unchanged for:

  • ping events
  • error events
  • node start/finish events
  • default stream events

From Codex

Screenshots

Before After
Not applicable, backend refactor only. Not applicable, backend refactor only.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

Testing:

  • Ran py -3 -m py_compile api/core/app/apps/workflow/generate_response_converter.py api/core/app/apps/pipeline/generate_response_converter.py

Could not run the full backend test/lint suite locally because uv is not installed on PATH and local Python does not have pytest.

@D-393Patel D-393Patel requested a review from QuantumGhost as a code owner May 17, 2026 10:13
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. refactor labels May 17, 2026
@asukaminato0721 asukaminato0721 requested a review from Copilot May 17, 2026 19:57
@asukaminato0721 asukaminato0721 enabled auto-merge May 17, 2026 19:57
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 0.00% 43.70% +43.70%
Strict coverage 0.00% 43.22% +43.22%
Typed symbols 0 22,132 +22,132
Untyped symbols 0 28,831 +28,831
Modules 0 2557 +2,557

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@asukaminato0721 asukaminato0721 added this pull request to the merge queue May 17, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 17, 2026
Merged via the queue into langgenius:main with commit 127fbf2 May 17, 2026
31 of 32 checks passed
zhangtaodemama added a commit to zhangtaodemama/langgenius-dify-bfaadcb0c706 that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants