fix: remove overly strict guard in dataset deletion handler to prevent orphaned vector collections#38548
Open
AndrianBalanescu wants to merge 1 commit into
Conversation
…t orphaned vector collections When a dataset with empty doc_form or indexing_technique (common in datasets created by older Dify versions) was deleted, the signal handler in clean_when_dataset_deleted.py returned early and never dispatched clean_dataset_task. This left the corresponding vector store collection (e.g. Qdrant Collection_index_<uuid>_Node) permanently orphaned. The cleanup task already handles empty doc_form by falling back to PARAGRAPH_INDEX, and indexing_technique is not used to select the cleanup path — so the guard was stricter than the task it protected. Removed the early return so cleanup is always dispatched. Updated the three integration tests that codified the old (buggy) behavior. Closes langgenius#38537
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-07-09 04:06:37.480123371 +0000
+++ /tmp/pyrefly_pr.txt 2026-07-09 04:06:28.194024246 +0000
@@ -1,3 +1,7 @@
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.delay` [bad-argument-type]
+ --> events/event_handlers/clean_when_dataset_deleted.py:18:9
+ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.delay` [bad-argument-type]
+ --> events/event_handlers/clean_when_dataset_deleted.py:21:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_alibabacloud_mysql.alibabacloud_mysql_vector.AlibabaCloudMySQLVectorFactory.init_vector` [bad-argument-type]
--> providers/vdb/vdb-alibabacloud-mysql/tests/unit_tests/test_alibabacloud_mysql_factory.py:42:38
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_alibabacloud_mysql.alibabacloud_mysql_vector.AlibabaCloudMySQLVectorFactory.init_vector` [bad-argument-type]
@@ -614,8 +618,6 @@
--> tests/integration_tests/workflow/test_response_stream_filter_integration.py:74:12
ERROR Object of class `object` has no attribute `strip` [missing-attribute]
--> tests/integration_tests/workflow/test_response_stream_filter_integration.py:75:37
-ERROR Argument `core.workflow.nodes.human_input.entities.HumanInputNodeData` is not assignable to parameter `data` with type `graphon.nodes.human_input.entities.HumanInputNodeData` in function `graphon.nodes.human_input.human_input_node.HumanInputNode.__init__` [bad-argument-type]
- --> tests/integration_tests/workflow/test_response_stream_filter_pause_resume_integration.py:113:14
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:671:51
ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
@@ -647,29 +649,29 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/web/test_wraps.py:182:33
ERROR Attribute `file_service` of class `TestPauseStatePersistenceLayerTestContainers` is a read-only descriptor with no `__set__` and cannot be set [read-only]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:174:9
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:156:9
ERROR Attribute `workflow_run_service` of class `TestPauseStatePersistenceLayerTestContainers` is a read-only descriptor with no `__set__` and cannot be set [read-only]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:175:9
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:157:9
ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Session]` in function `core.app.layers.pause_state_persist_layer.PauseStatePersistenceLayer.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:313:29
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:295:29
ERROR Argument `dict[str, str]` is not assignable to parameter `outputs` with type `dict[str, object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:331:21
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:312:21
ERROR Argument `dict[tuple[str, str], dict[str, str] | str]` is not assignable to parameter `variables` with type `dict[tuple[str, str], object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:334:23
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:315:23
ERROR Argument `dict[tuple[str, str], dict[str, str] | list[int] | str]` is not assignable to parameter `variables` with type `dict[tuple[str, str], object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:398:23
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:379:23
ERROR Object of class `FixtureFunctionDefinition` has no attribute `_workflow_run_repo` [missing-attribute]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:410:24
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:391:24
ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:424:16
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:405:16
ERROR Argument `dict[str, LiteralString]` is not assignable to parameter `outputs` with type `dict[str, object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:465:21
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:446:21
ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:489:16
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:470:16
ERROR Object of class `FixtureFunctionDefinition` has no attribute `_workflow_run_repo` [missing-attribute]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:551:24
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:532:24
ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
- --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:554:16
+ --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:535:16
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:38:23
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1333,6 +1335,12 @@
ERROR Cannot index into `object` [bad-index]
--> tests/test_containers_integration_tests/services/test_workspace_service.py:602:16
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/tools/test_api_tools_manage_service.py:60:20
+ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/tools/test_api_tools_manage_service.py:69:20
+ERROR Argument `Literal['bad-schema-type']` is not assignable to parameter `schema_type` with type `ApiProviderSchemaType` in function `services.tools.api_tools_manage_service.ApiToolManageService.test_api_tool_preview` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/tools/test_api_tools_manage_service.py:862:29
+ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/tools/test_mcp_tools_manage_service.py:63:20
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/tools/test_mcp_tools_manage_service.py:72:20
@@ -1793,23 +1801,17 @@
ERROR Argument `dict[str, object]` is not assignable to parameter `configs` with type `Mapping[str, LayerConfigInput] | None` in function `agenton.compositor.core.Compositor._create_run` [bad-argument-type]
--> tests/unit_tests/clients/agent_backend/test_cleanup_composition_compositor_integration.py:97:17
ERROR Cannot index into `bool` [bad-index]
- --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:55:12
+ --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:54:12
ERROR Cannot index into `float` [bad-index]
- --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:55:12
+ --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:54:12
ERROR Cannot index into `int` [bad-index]
- --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:55:12
+ --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:54:12
ERROR Cannot index into `list[JsonValue]` [bad-index]
- --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:55:12
+ --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:54:12
ERROR Cannot index into `str` [bad-index]
- --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:55:12
+ --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:54:12
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:55:12
-ERROR Object of class `list` has no attribute `startswith` [missing-attribute]
- --> tests/unit_tests/clients/agent_backend/test_request_builder.py:159:12
-ERROR Class member `_FailedStatusClient.wait_run` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/clients/agent_backend/test_session_cleanup.py:75:9
-ERROR Class member `_WaitRunFailureClient.wait_run` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/clients/agent_backend/test_session_cleanup.py:103:9
+ --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:54:12
ERROR Expected a callable, got `None` [not-callable]
--> tests/unit_tests/commands/test_clean_expired_messages.py:33:9
ERROR Expected a callable, got `None` [not-callable]
@@ -1901,67 +1903,63 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_build_chat_finalization_message` [bad-argument-type]
--> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1558:23
ERROR Argument `test_drain_streaming_generate_response_returns_on_message_end.ClosableResponse` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1606:69
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1605:69
ERROR Argument `Iterator[Any]` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1614:66
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1613:66
ERROR Argument `Iterator[Any]` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1621:66
-ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1652:26
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1653:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1620:66
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1700:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1651:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1701:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1652:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1737:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1691:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1738:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1692:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1766:22
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1720:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1767:19
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1721:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1772:22
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1726:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1773:19
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1727:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1824:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1778:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1825:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1779:27
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1908:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1862:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1909:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1863:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1910:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1864:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1922:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1876:67
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1948:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1902:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1949:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1903:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1950:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1904:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1974:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1928:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account | None` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1974:91
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1928:91
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1995:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1949:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account | None` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1996:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1950:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2011:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1965:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2012:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1966:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2048:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2002:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2049:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2003:23
ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2050:24
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2004:24
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:219:38
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -3146,33 +3144,39 @@
ERROR Argument `DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator.generate` [bad-argument-type]
--> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:69:22
ERROR Argument `DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator.generate` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:235:18
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:162:18
ERROR Argument `DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator.generate` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:273:18
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:200:18
+ERROR Argument `DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator.generate_stateless` [bad-argument-type]
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:221:18
+ERROR Argument `DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator.generate_stateless` [bad-argument-type]
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:242:22
+ERROR Argument `DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_stateless` [bad-argument-type]
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:258:18
+ERROR Argument `float | None` is not assignable to parameter `text_delta_debounce_seconds` with type `float` in function `core.app.apps.agent_app.app_runner.AgentAppRunner.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:422:37
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:512:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:479:12
ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:513:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:480:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:595:12
-ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:615:12
-ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:662:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:506:12
ERROR Object of class `NoneType` has no attribute `usage` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:663:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:507:12
ERROR Object of class `NoneType` has no attribute `usage` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:664:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:508:12
ERROR Object of class `NoneType` has no attribute `usage` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:665:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:509:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:686:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:524:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:704:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:538:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:722:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:552:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:743:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:589:12
+ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:604:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
--> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:67:12
ERROR Object of class `NoneType` has no attribute `prompt_messages` [missing-attribute]
@@ -3231,33 +3235,25 @@
ERROR Object of class `LayerConfig` has no attribute `user_from`
ERROR Object of class `LayerConfig` has no attribute `invoke_from`
ERROR Object of class `LayerConfig` has no attribute `agent_mode`
-ERROR Object of class `LayerConfig` has no attribute `prefix`
-ERROR Object of class `object` has no attribute `startswith` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:225:16
-ERROR `in` is not supported between `Literal['```text\nYou are Iris.\n\n... (truncated) ... |
Contributor
Pyrefly Type Coverage
|
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.
Important
Fixes #<issue number>.Summary
Fixes #38537
When a dataset with empty
doc_formorindexing_technique(common in datasets created by older Dify versions and migrated forward) was deleted, the signal handler inclean_when_dataset_deleted.pyreturned early and never dispatchedclean_dataset_task. This left the corresponding vector store collection (e.g. QdrantVector_index_<uuid>_Node) permanently orphaned — the cleanup task was never run, and there was no retry/reconcile path.The cleanup task already handles empty
doc_formby falling back toPARAGRAPH_INDEX(seeclean_dataset_task.pylines 79-89), andindexing_techniqueis not used to select the cleanup path — it is only stored on the reconstructedDatasetobject. So the guard was stricter than the task it protected, blocking exactly the case the task already handles.Changes:
if not dataset.doc_form or not dataset.indexing_technique: returnearly-return guard inapi/events/event_handlers/clean_when_dataset_deleted.pyso cleanup is always dispatched.test_dataset_service_delete_dataset.pythat codified the old (buggy) behavior — they now assertclean_dataset_task.delayis called with the correct arguments instead of asserting it was never called.Screenshots
N/A — backend-only change.
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods