test: migrate recommended_app_service tests to testcontainers#34751
Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom Apr 9, 2026
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-08 23:24:43.181848949 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-08 23:24:34.185777862 +0000
@@ -1097,6 +1097,16 @@
--> tests/test_containers_integration_tests/services/test_model_provider_service.py:149:24
ERROR Argument `str` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_model_provider_service.py:187:24
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:199:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:214:20
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:264:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:265:20
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:266:20
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:87:38
ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates RecommendedAppService tests from mocked db.session unit tests to Testcontainers-backed integration tests using a real PostgreSQL container, while retaining pure-logic tests with mocked external dependencies.
Changes:
- Removed legacy unit-test suite for
RecommendedAppService. - Added Testcontainers integration tests covering trial-app DB persistence and enrichment behavior.
- Kept existing pure-logic tests for factory mode selection, fallback behavior, and language handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| api/tests/unit_tests/services/test_recommended_app_service.py | Deleted mocked db.session unit tests as part of moving to containerized DB-backed tests. |
| api/tests/test_containers_integration_tests/services/test_recommended_app_service.py | Added pure-logic tests plus Postgres(Testcontainers) integration tests for trial-app persistence/enrichment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
asukaminato0721
approved these changes
Apr 8, 2026
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-08 23:43:56.249987069 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-08 23:43:48.559806229 +0000
@@ -17,9 +17,9 @@
ERROR Class member `EasyUIBasedGenerateTaskPipeline._application_generate_entity` overrides parent class `BasedGenerateTaskPipeline` in an inconsistent manner [bad-override]
--> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:75:5
ERROR `+=` is not supported between `list[PromptMessageContentUnionTypes]` and `str` [unsupported-operation]
- --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:321:29
+ --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:323:29
ERROR Argument `list[Unknown]` is not assignable to parameter `value` with type `SQLCoreOperations[dict[str, Any]] | dict[str, Any]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
- --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:388:27
+ --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:390:27
ERROR `defaultdict[str, dict[Unknown, Unknown]]` is not assignable to `defaultdict[ModelType, dict[str, ModelSettings]]` [bad-assignment]
--> core/entities/provider_configuration.py:1531:79
ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, int], stream=Literal[False]) [no-matching-overload]
@@ -356,9 +356,9 @@
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` [unsafe-overlap]
--> tasks/app_generate/workflow_execute_task.py:494:37
ERROR `Literal['error']` is not assignable to attribute `status` with type `Never` [bad-assignment]
- --> tasks/regenerate_summary_index_task.py:276:61
+ --> tasks/regenerate_summary_index_task.py:278:61
ERROR `str` is not assignable to attribute `error` with type `Never` [bad-assignment]
- --> tasks/regenerate_summary_index_task.py:277:60
+ --> tasks/regenerate_summary_index_task.py:279:60
ERROR Class member `AsyncWorkflowCFSPlanScheduler.plan` overrides parent class `CFSPlanScheduler` in an inconsistent manner [bad-override]
--> tasks/workflow_cfs_scheduler/cfs_scheduler.py:19:5
ERROR Argument `Literal['normal']` is not assignable to parameter `value` with type `AppStatus | SQLCoreOperations[AppStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
@@ -1095,6 +1095,16 @@
--> tests/test_containers_integration_tests/services/test_model_provider_service.py:149:24
ERROR Argument `str` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_model_provider_service.py:187:24
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:198:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:213:20
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:263:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:264:20
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/test_containers_integration_tests/services/test_recommended_app_service.py:265:20
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:87:38
ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
@@ -3070,129 +3080,129 @@
ERROR Cannot index into `str` [bad-index]
--> tests/unit_tests/core/app/apps/workflow/test_generate_response_converter.py:134:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:83:18
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:82:18
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:84:23
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:83:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:85:14
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:84:14
ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:87:33
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:86:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `publisher` with type `AppGeneratorTTSPublisher | None` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._listen_audio_msg` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:145:57
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:144:57
ERROR `(err: Unknown) -> Unknown` is not assignable to attribute `error_to_stream_response` with type `(self: BasedGenerateTaskPipeline, e: Exception) -> ErrorStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:160:65
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:159:65
ERROR `(**kwargs: Unknown) -> Literal['started']` is not assignable to attribute `workflow_start_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_run_id: str, workflow_id: str, reason: WorkflowStartReason) -> WorkflowStartStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:172:83
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:171:83
ERROR `(**kwargs: Unknown) -> Literal['done']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:188:89
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:187:89
ERROR `(**kwargs: Unknown) -> Literal['finish']` is not assignable to attribute `workflow_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_id: str, status: WorkflowExecutionStatus, graph_runtime_state: GraphRuntimeState, error: str | None = None, exceptions_count: int = 0) -> WorkflowFinishStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:213:84
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:212:84
ERROR `(err: Unknown) -> Unknown` is not assignable to attribute `error_to_stream_response` with type `(self: BasedGenerateTaskPipeline, e: Exception) -> ErrorStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:215:65
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:214:65
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_handle_text_chunk_event_publishes_tts._Publisher` is not assignable to parameter `tts_publisher` with type `AppGeneratorTTSPublisher | None` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._handle_text_chunk_event` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:235:68
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:234:68
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_message` with type `MessageQueueMessage | WorkflowQueueMessage | None` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._handle_text_chunk_event` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:235:96
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:234:96
ERROR Object of class `StreamResponse` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:238:16
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:237:16
ERROR `(**kwargs: Unknown) -> Literal['done']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:243:89
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:242:89
ERROR `(**kwargs: Unknown) -> Literal['finish']` is not assignable to attribute `workflow_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_id: str, status: WorkflowExecutionStatus, graph_runtime_state: GraphRuntimeState, error: str | None = None, exceptions_count: int = 0) -> WorkflowFinishStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:265:84
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:264:84
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_save_workflow_app_log_created_from._Session` is not assignable to parameter `session` with type `Session` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._save_workflow_app_log` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:285:49
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:284:49
ERROR `(**kwargs: Unknown) -> Literal['iter']` is not assignable to attribute `workflow_iteration_start_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_execution_id: str, event: QueueIterationStartEvent) -> IterationNodeStartStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:292:93
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:291:93
ERROR `(**kwargs: Unknown) -> Literal['next']` is not assignable to attribute `workflow_iteration_next_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_execution_id: str, event: QueueIterationNextEvent) -> IterationNodeNextStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:293:92
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:292:92
ERROR `(**kwargs: Unknown) -> Literal['done']` is not assignable to attribute `workflow_iteration_completed_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_execution_id: str, event: QueueIterationCompletedEvent) -> IterationNodeCompletedStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:294:97
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:293:97
ERROR `(**kwargs: Unknown) -> Literal['loop']` is not assignable to attribute `workflow_loop_start_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_execution_id: str, event: QueueLoopStartEvent) -> LoopNodeStartStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:295:88
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:294:88
ERROR `(**kwargs: Unknown) -> Literal['loop_next']` is not assignable to attribute `workflow_loop_next_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_execution_id: str, event: QueueLoopNextEvent) -> LoopNodeNextStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:296:87
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:295:87
ERROR `(**kwargs: Unknown) -> Literal['loop_done']` is not assignable to attribute `workflow_loop_completed_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_execution_id: str, event: QueueLoopCompletedEvent) -> LoopNodeCompletedStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:297:92
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:296:92
ERROR `(**kwargs: Unknown) -> Literal['filled']` is not assignable to attribute `human_input_form_filled_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueHumanInputFormFilledEvent, task_id: str) -> HumanInputFormFilledResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:298:92
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:297:92
ERROR `(**kwargs: Unknown) -> Literal['timeout']` is not assignable to attribute `human_input_form_timeout_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueHumanInputFormTimeoutEvent, task_id: str) -> HumanInputFormTimeoutResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:299:93
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:298:93
ERROR `(**kwargs: Unknown) -> Literal['log']` is not assignable to attribute `handle_agent_log` with type `(self: WorkflowResponseConverter, task_id: str, event: QueueAgentLogEvent) -> AgentLogStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:300:66
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:299:66
ERROR `(**kwargs: Unknown) -> Iterator[Any]` is not assignable to attribute `_process_stream_response` with type `(self: WorkflowAppGenerateTaskPipeline, tts_publisher: AppGeneratorTTSPublisher | None = None, trace_manager: TraceQueueManager | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:392:45
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:391:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:448:22
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:447:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:449:27
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:448:27
ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:452:37
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:451:37
ERROR `(**kwargs: Unknown) -> Iterator[Any]` is not assignable to attribute `_wrapper_process_stream_response` with type `(self: WorkflowAppGenerateTaskPipeline, trace_manager: TraceQueueManager | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:461:53
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:460:53
ERROR Object of class `tuple` has no attribute `workflow_run_id` [missing-attribute]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:465:16
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:464:16
ERROR `(**kwargs: Unknown) -> Iterator[Any]` is not assignable to attribute `_wrapper_process_stream_response` with type `(self: WorkflowAppGenerateTaskPipeline, trace_manager: TraceQueueManager | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:468:53
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:467:53
ERROR Object of class `Generator` has no attribute `workflow_run_id` [missing-attribute]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:490:16
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:489:16
ERROR `(**kwargs: Unknown) -> Iterator[Any]` is not assignable to attribute `_process_stream_response` with type `(self: WorkflowAppGenerateTaskPipeline, tts_publisher: AppGeneratorTTSPublisher | None = None, trace_manager: TraceQueueManager | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:534:45
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:533:45
ERROR `(**kwargs: Unknown) -> Iterator[Any]` is not assignable to attribute `_process_stream_response` with type `(self: WorkflowAppGenerateTaskPipeline, tts_publisher: AppGeneratorTTSPublisher | None = None, trace_manager: TraceQueueManager | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:544:45
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:543:45
ERROR `(**kwargs: Unknown) -> Iterator[Any]` is not assignable to attribute `_process_stream_response` with type `(self: WorkflowAppGenerateTaskPipeline, tts_publisher: AppGeneratorTTSPublisher | None = None, trace_manager: TraceQueueManager | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:581:45
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:580:45
ERROR `(**kwargs: Unknown) -> Literal['retry']` is not assignable to attribute `workflow_node_retry_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueNodeRetryEvent, task_id: str) -> NodeRetryStreamResponse | None` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:671:88
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:670:88
ERROR `(**kwargs: Unknown) -> Literal['started']` is not assignable to attribute `workflow_node_start_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueNodeStartedEvent, task_id: str) -> NodeStartStreamResponse | None` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:676:88
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:675:88
ERROR `(**kwargs: Unknown) -> Literal['failed']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:682:89
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:681:89
ERROR `(**kwargs: Unknown) -> Literal['finish']` is not assignable to attribute `workflow_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, task_id: str, workflow_id: str, status: WorkflowExecutionStatus, graph_runtime_state: GraphRuntimeState, error: str | None = None, exceptions_count: int = 0) -> WorkflowFinishStreamResponse` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:708:84
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:707:84
ERROR `(**kwargs: Unknown) -> list[str]` is not assignable to attribute `workflow_pause_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueWorkflowPausedEvent, task_id: str, graph_runtime_state: GraphRuntimeState) -> list[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:716:83
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:715:83
ERROR `(event: QueuePingEvent, **kwargs: Unknown) -> Iterator[PingStreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_ping_event` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueuePingEvent, **kwargs: Unknown) -> Generator[PingStreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:735:39
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:734:39
ERROR `(event: QueueStopEvent | QueueWorkflowFailedEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_workflow_failed_and_stop_events` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueStopEvent | QueueWorkflowFailedEvent, *, trace_manager: TraceQueueManager | None = None, **kwargs: Unknown) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:738:60
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:737:60
ERROR Argument `SimpleNamespace` is not assignable to parameter `event` with type `AppQueueEvent` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._dispatch_event` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:743:46
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:742:46
ERROR `() -> Iterator[MessageQueueMessage | WorkflowQueueMessage] | Iterator[Any]` is not assignable to attribute `listen` with type `(self: AppQueueManager) -> Generator[MessageQueueMessage | WorkflowQueueMessage, Unknown]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:751:61
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:750:61
ERROR `(event: QueueWorkflowStartedEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_workflow_started_event` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueWorkflowStartedEvent, **kwargs: Unknown) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:759:51
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:758:51
ERROR `(event: QueueTextChunkEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_text_chunk_event` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueTextChunkEvent, *, tts_publisher: AppGeneratorTTSPublisher | None = None, queue_message: MessageQueueMessage | WorkflowQueueMessage | None = None, **kwargs: Unknown) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:760:45
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:759:45
ERROR `(event: AppQueueEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_dispatch_event` with type `(self: WorkflowAppGenerateTaskPipeline, event: AppQueueEvent, *, tts_publisher: AppGeneratorTTSPublisher | None = None, trace_manager: TraceQueueManager | None = None, queue_message: MessageQueueMessage | WorkflowQueueMessage | None = None) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:761:36
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:760:36
ERROR `(event: QueueErrorEvent, **kwargs: Unknown) -> Iterator[ErrorStreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_error_event` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueErrorEvent, **kwargs: Unknown) -> Generator[ErrorStreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:762:40
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:761:40
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_process_stream_response_main_match_paths_and_cleanup._Publisher` is not assignable to parameter `tts_publisher` with type `AppGeneratorTTSPublisher | None` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._process_stream_response` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:769:74
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:768:74
ERROR `() -> Iterator[MessageQueueMessage | WorkflowQueueMessage] | Iterator[Any]` is not assignable to attribute `listen` with type `(self: AppQueueManager) -> Generator[MessageQueueMessage | WorkflowQueueMessage, Unknown]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:776:61
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:775:61
ERROR `(event: QueueStopEvent | QueueWorkflowFailedEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_workflow_failed_and_stop_events` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueStopEvent | QueueWorkflowFailedEvent, *, trace_manager: TraceQueueManager | None = None, **kwargs: Unknown) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:779:60
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:778:60
ERROR `() -> Iterator[MessageQueueMessage | WorkflowQueueMessage] | Iterator[Any]` is not assignable to attribute `listen` with type `(self: AppQueueManager) -> Generator[MessageQueueMessage | WorkflowQueueMessage, Unknown]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:782:61
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:781:61
ERROR `(event: QueueWorkflowPausedEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_workflow_paused_event` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueWorkflowPausedEvent, **kwargs: Unknown) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:785:50
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:784:50
ERROR `() -> Iterator[MessageQueueMessage | WorkflowQueueMessage] | Iterator[Any]` is not assignable to attribute `listen` with type `(self: AppQueueManager) -> Generator[MessageQueueMessage | WorkflowQueueMessage, Unknown]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:788:61
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:787:61
ERROR `(event: QueueStopEvent | QueueWorkflowFailedEvent, **kwargs: Unknown) -> Iterator[StreamResponse] | Iterator[Any]` is not assignable to attribute `_handle_workflow_failed_and_stop_events` with type `(self: WorkflowAppGenerateTaskPipeline, event: QueueStopEvent | QueueWorkflowFailedEvent, *, trace_manager: TraceQueueManager | None = None, **kwargs: Unknown) -> Generator[StreamResponse]` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:791:60
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:790:60
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_save_workflow_app_log_covers_invoke_from_variants._Session` is not assignable to parameter `session` with type `Session` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._save_workflow_app_log` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:804:49
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:803:49
ERROR Object of class `object` has no attribute `created_from` [missing-attribute]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:805:16
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:804:16
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_save_workflow_app_log_covers_invoke_from_variants._Session` is not assignable to parameter `session` with type `Session` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._save_workflow_app_log` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:808:49
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:807:49
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_save_workflow_app_log_covers_invoke_from_variants._Session` is not assignable to parameter `session` with type `Session` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._save_workflow_app_log` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:813:49
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:812:49
ERROR Argument `TestWorkflowGenerateTaskPipeline.test_save_workflow_app_log_covers_invoke_from_variants._Session` is not assignable to parameter `session` with type `Session` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline._save_workflow_app_log` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:817:49
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:816:49
ERROR `(**kwargs: Unknown) -> TestWorkflowGenerateTaskPipeline.test_save_output_for_event_writes_draft_variables._Saver` is not assignable to attribute `_draft_var_saver_factory` with type `DraftVariableSaverFactory` [bad-assignment]
- --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:833:45
+ --> tests/unit_tests/core/app/apps/workflow/test_generate_task_pipeline_core.py:832:45
ERROR `Literal['unknown']` is not assignable to attribute `stopped_by` with type `QueueStopEvent.StopBy` [bad-assignment]
--> tests/unit_tests/core/app/entities/test_queue_entities.py:11:28
ERROR Object of class `Mapping` has no attribute `close` [missing-attribute]
@@ -6397,9 +6407,9 @@
ERROR Argument `FakeRepo` is not assignable to parameter `workflow_run_repo` with type `APIWorkflowRunRepository | None` in function `services.retention.workflow_run.clear_free_plan_expired_workflow_run_logs.WorkflowRunCleanup.__init__` [bad-argument-type]
--> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:114:49
ERROR Class member `FixedDateTime.now` overrides parent class `datetime` in an inconsistent manner [bad-override]
- --> tests/unit_tests/services/test_clear_free_plan_tenant_expired_logs.py:407:13
+ --> tests/unit_tests/services/test_clear_free_plan_tenant_expired_logs.py:411:13
ERROR Class member `FixedDateTime.now` overrides parent class `datetime` in an inconsistent manner [bad-override]
- --> tests/unit_tests/services/test_clear_free_plan_tenant_expired_logs.py:501:13
+ --> tests/unit_tests/services/test_clear_free_plan_tenant_expired_logs.py:505:13
ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_dataset.py:310:93
ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
@@ -6677,29 +6687,29 @@
ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
--> tests/unit_tests/services/test_webhook_service.py:535:83
ERROR Argument `dict[str, dict[str, str] | str]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService._validate_http_metadata` [bad-argument-type]
- --> tests/unit_tests/services/test_webhook_service.py:1036:53
+ --> tests/unit_tests/services/test_webhook_service.py:1021:53
ERROR Argument `dict[str, dict[str, int] | dict[str, str]]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService.build_workflow_inputs` [bad-argument-type]
- --> tests/unit_tests/services/test_webhook_service.py:1059:51
+ --> tests/unit_tests/services/test_webhook_service.py:1044:51
ERROR Argument `dict[str, dict[str, int]]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService.trigger_workflow_execution` [bad-argument-type]
- --> tests/unit_tests/services/test_webhook_service.py:1092:64
+ --> tests/unit_tests/services/test_webhook_service.py:1077:64
ERROR Missing required key `method` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1129:68
+ --> tests/unit_tests/services/test_webhook_service.py:1114:68
ERROR Missing required key `headers` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1129:68
+ --> tests/unit_tests/services/test_webhook_service.py:1114:68
ERROR Missing required key `query_params` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1129:68
+ --> tests/unit_tests/services/test_webhook_service.py:1114:68
ERROR Missing required key `files` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1129:68
+ --> tests/unit_tests/services/test_webhook_service.py:1114:68
ERROR Missing required key `method` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1154:68
+ --> tests/unit_tests/services/test_webhook_service.py:1139:68
ERROR Missing required key `headers` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1154:68
+ --> tests/unit_tests/services/test_webhook_service.py:1139:68
ERROR Missing required key `query_params` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1154:68
+ --> tests/unit_tests/services/test_webhook_service.py:1139:68
ERROR Missing required key `files` for TypedDict `RawWebhookDataDict` [bad-typed-dict-key]
- --> tests/unit_tests/services/test_webhook_service.py:1154:68
+ --> tests/unit_tests/services/test_webhook_service.py:1139:68
ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
- --> tests/unit_tests/services/test_webhook_service.py:1304:61
+ --> tests/unit_tests/services/test_webhook_service.py:1290:61
ERROR Missing required key `id` for TypedDict `NodeConfigDict` [bad-typed-dict-key]
--> tests/unit_tests/services/test_workflow_service.py:2682:71
ERROR Missing required key `data` for TypedDict `NodeConfigDict` [bad-typed-dict-key]
|
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
…nius#34751) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
RecommendedAppServicetests from unit-test style (mockeddb.session) to Testcontainers-based integration tests backed by a real PostgreSQL container.Changes:
api/tests/unit_tests/services/test_recommended_app_service.pyapi/tests/test_containers_integration_tests/services/test_recommended_app_service.pyWhat changed:
TrialApp,AccountTrialAppRecord) now use real PostgreSQL via testcontainersadd_trial_app_recordtests verify actual DB persistence (record creation, count increment)get_recommended_apps_and_categoriesandget_recommend_app_detailtrial enrichment tests use realTrialApprecordsRecommendAppRetrievalFactory,FeatureService,dify_configremain mockedPart of #32454