Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
test: reclassify response filter regressions (#40706)
Asuka Minato62adebcf4ec4
diff --git a/api/tests/integration_tests/workflow/test_response_stream_filter_integration.py b/api/tests/unit_tests/core/workflow/test_response_stream_filter_issue_170.pysimilarity index 86%rename from api/tests/integration_tests/workflow/test_response_stream_filter_integration.pyrename to api/tests/unit_tests/core/workflow/test_response_stream_filter_issue_170.pyindex fd1391849fd..8056da32acd 100644--- a/api/tests/integration_tests/workflow/test_response_stream_filter_integration.py+++ b/api/tests/unit_tests/core/workflow/test_response_stream_filter_issue_170.py@@ -1,14 +1,14 @@-"""Integration coverage for Dify's ResponseStreamFilter boundary behavior."""+"""Unit coverage for Dify's in-memory ResponseStreamFilter boundary behavior."""from core.workflow.workflow_entry import iter_dify_graph_engine_eventsfrom graphon.graph_engine import GraphEngine, GraphEngineConfigfrom graphon.graph_engine.command_channels import InMemoryChannelfrom graphon.graph_events import GraphRunSucceededEvent, NodeRunStreamChunkEvent-from tests.unit_tests.core.workflow.graph_engine.test_mock_config import MockConfigBuilder+from tests.unit_tests.core.workflow.graph_engine.test_mock_config import MockConfig, MockConfigBuilderfrom tests.unit_tests.core.workflow.graph_engine.test_table_runner import WorkflowRunner-def _build_issue_170_mock_config():+def _build_issue_170_mock_config() -> tuple[WorkflowRunner, MockConfig]:runner = WorkflowRunner()mock_config = (MockConfigBuilder()@@ -71,5 +71,7 @@ def test_dify_response_stream_filter_handles_issue_170_shape() -> None:actual_answer = "".join(event.chunk for event in stream_chunk_events)assert actual_answer.strip() == expected_answerassert stream_chunk_events[-1].is_final is True- assert success_events[-1].outputs["answer"].strip() == expected_answer- assert actual_answer.strip() == success_events[-1].outputs["answer"].strip()+ final_answer = success_events[-1].outputs["answer"]+ assert isinstance(final_answer, str)+ assert final_answer.strip() == expected_answer+ assert actual_answer.strip() == final_answer.strip()diff --git a/api/tests/integration_tests/workflow/test_response_stream_filter_pause_resume_integration.py b/api/tests/unit_tests/core/workflow/test_response_stream_filter_pause_resume.pysimilarity index 93%rename from api/tests/integration_tests/workflow/test_response_stream_filter_pause_resume_integration.pyrename to api/tests/unit_tests/core/workflow/test_response_stream_filter_pause_resume.pyindex 08ebbfb31a1..e3267cc8466 100644--- a/api/tests/integration_tests/workflow/test_response_stream_filter_pause_resume_integration.py+++ b/api/tests/unit_tests/core/workflow/test_response_stream_filter_pause_resume.py@@ -1,4 +1,4 @@-"""Regression test: if-else branch + human_input pause + downstream answer nodes.+"""In-memory regression test: if-else branch + human_input pause + downstream answer nodes.Reproduces https://github.com/langgenius/dify/issues/38525 at theiter_dify_graph_engine_events layer: without a restored ResponseStreamFilter,@@ -10,7 +10,11 @@ from datetime import timedeltafrom unittest.mock import MagicMockfrom core.app.entities.app_invoke_entities import InvokeFrom, UserFrom-from core.repositories.human_input_repository import HumanInputFormEntity, HumanInputFormRepository+from core.repositories.human_input_repository import (+ HumanInputFormEntity,+ HumanInputFormRecipientEntity,+ HumanInputFormRepository,+)from core.workflow.nodes.human_input.callback import DifyHITLCallbackfrom core.workflow.nodes.human_input.entities import HumanInputNodeData, UserActionConfigfrom core.workflow.nodes.human_input.enums import HumanInputFormStatus@@ -23,6 +27,7 @@ from graphon.graph_engine.command_channels import InMemoryChannelfrom graphon.graph_events import GraphRunPausedEvent, GraphRunSucceededEvent, NodeRunStreamChunkEventfrom graphon.nodes.answer.answer_node import AnswerNodefrom graphon.nodes.answer.entities import AnswerNodeData+from graphon.nodes.human_input.entities import HumanInputNodeData as GraphonHumanInputNodeDatafrom graphon.nodes.human_input.human_input_node import HumanInputNodefrom graphon.nodes.if_else.entities import IfElseNodeDatafrom graphon.nodes.if_else.if_else_node import IfElseNode@@ -41,7 +46,7 @@ def _mock_repo_paused() -> HumanInputFormRepository:form = MagicMock(spec=HumanInputFormEntity)form.id = "form-1"form.submission_token = "token-1"- form.recipients = []+ form.recipients = list[HumanInputFormRecipientEntity]()form.rendered_content = "rendered"form.submitted = Falserepo.create_form.return_value = form@@ -54,11 +59,11 @@ def _mock_repo_resumed(action_id: str = "continue") -> HumanInputFormRepository:form = MagicMock(spec=HumanInputFormEntity)form.id = "form-1"form.submission_token = "token-1"- form.recipients = []+ form.recipients = list[HumanInputFormRecipientEntity]()form.rendered_content = "rendered"form.submitted = Trueform.selected_action_id = action_id- form.submitted_data = {}+ form.submitted_data = dict[str, object]()form.status = HumanInputFormStatus.WAITINGform.expiration_time = naive_utc_now() + timedelta(hours=1)repo.get_form.return_value = form@@ -110,7 +115,7 @@ def _build_graph(runtime_state: GraphRuntimeState, form_repository: HumanInputFo)human_node = HumanInputNode(node_id="human_input",- data=human_data,+ data=GraphonHumanInputNodeData.model_validate(human_data.model_dump()),graph_init_params=params,graph_runtime_state=runtime_state,hitl_callback=DifyHITLCallback(form_repository=form_repository, node_data=human_data),