chore: clear and archive logs add HITL tables#32898
chore: clear and archive logs add HITL tables#32898hjlarry wants to merge 10 commits intolanggenius:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the data retention and cleanup capabilities for workflow runs by integrating Human-in-the-Loop (HITL) related tables into the existing archiving, restoration, and deletion processes. The changes ensure that data associated with human interactions within workflows, such as forms, deliveries, recipients, and extra execution content, are properly managed according to retention policies, improving data governance and system efficiency. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-03 07:26:11.835947807 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-03 07:26:02.877951634 +0000
@@ -1172,9 +1172,9 @@
ERROR Object of class `object` has no attribute `status` [missing-attribute]
--> repositories/sqlalchemy_api_workflow_node_execution_repository.py:189:20
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `dify_graph.entities.pause_reason.HumanInputRequired.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_api_workflow_run_repository.py:121:33
+ --> repositories/sqlalchemy_api_workflow_run_repository.py:122:33
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `core.entities.execution_extra_content.HumanInputFormDefinition.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_execution_extra_content_repository.py:140:45
+ --> repositories/sqlalchemy_execution_extra_content_repository.py:161:45
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1592,7 +1592,23 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:112:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:130:56
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:234:23
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:238:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:244:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:276:45
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:337:23
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:341:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:347:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:379:44
ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_account_service.py:513:16
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1775,6 +1791,8 @@
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:247:29
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.model.MessageFile.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:250:29
+ERROR Cannot find module `core.workflow.nodes.human_input.enums` [missing-import]
+ --> tests/test_containers_integration_tests/services/test_restore_archived_workflow_run.py:9:1
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:84:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -4298,7 +4316,7 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_batch_update_document_status.py:554:65
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
|
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive support for archiving, restoring, deleting, and counting records related to Human-in-the-Loop (HITL) tables, specifically human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents. The changes are consistently applied across various layers of the application, including command-line interfaces, repository protocols and implementations, and retention services. The updates to docstrings and logging messages accurately reflect the new functionality. Additionally, the inclusion of new unit and integration tests ensures the correctness and reliability of these new data management operations. The code is well-structured and follows good practices, such as handling empty input lists in repository methods to prevent unnecessary database queries.
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-03 07:28:01.314303789 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-03 07:27:52.222310733 +0000
@@ -1172,9 +1172,9 @@
ERROR Object of class `object` has no attribute `status` [missing-attribute]
--> repositories/sqlalchemy_api_workflow_node_execution_repository.py:189:20
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `dify_graph.entities.pause_reason.HumanInputRequired.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_api_workflow_run_repository.py:121:33
+ --> repositories/sqlalchemy_api_workflow_run_repository.py:122:33
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `core.entities.execution_extra_content.HumanInputFormDefinition.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_execution_extra_content_repository.py:140:45
+ --> repositories/sqlalchemy_execution_extra_content_repository.py:161:45
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1592,7 +1592,23 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:112:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:130:56
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:234:23
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:238:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:244:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:276:45
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:337:23
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:341:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:347:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:379:44
ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_account_service.py:513:16
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1775,6 +1791,8 @@
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:247:29
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.model.MessageFile.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:250:29
+ERROR Cannot find module `core.workflow.nodes.human_input.enums` [missing-import]
+ --> tests/test_containers_integration_tests/services/test_restore_archived_workflow_run.py:7:1
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:84:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -4298,7 +4316,7 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_batch_update_document_status.py:554:65
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-03 07:41:04.248249790 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-03 07:40:56.153319887 +0000
@@ -1172,9 +1172,9 @@
ERROR Object of class `object` has no attribute `status` [missing-attribute]
--> repositories/sqlalchemy_api_workflow_node_execution_repository.py:189:20
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `dify_graph.entities.pause_reason.HumanInputRequired.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_api_workflow_run_repository.py:121:33
+ --> repositories/sqlalchemy_api_workflow_run_repository.py:122:33
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `core.entities.execution_extra_content.HumanInputFormDefinition.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_execution_extra_content_repository.py:140:45
+ --> repositories/sqlalchemy_execution_extra_content_repository.py:161:45
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1592,7 +1592,23 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:112:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:130:56
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:234:23
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:238:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:244:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:276:45
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:337:23
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:341:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:347:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:379:44
ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_account_service.py:513:16
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1775,6 +1791,8 @@
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:247:29
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.model.MessageFile.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:250:29
+ERROR Cannot find module `core.workflow.nodes.human_input.enums` [missing-import]
+ --> tests/test_containers_integration_tests/services/test_restore_archived_workflow_run.py:7:1
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:84:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -4298,7 +4316,7 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_batch_update_document_status.py:554:65
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-03 07:56:32.983923884 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-03 07:56:23.958936327 +0000
@@ -1172,9 +1172,9 @@
ERROR Object of class `object` has no attribute `status` [missing-attribute]
--> repositories/sqlalchemy_api_workflow_node_execution_repository.py:189:20
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `dify_graph.entities.pause_reason.HumanInputRequired.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_api_workflow_run_repository.py:121:33
+ --> repositories/sqlalchemy_api_workflow_run_repository.py:122:33
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `core.entities.execution_extra_content.HumanInputFormDefinition.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_execution_extra_content_repository.py:140:45
+ --> repositories/sqlalchemy_execution_extra_content_repository.py:161:45
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1592,7 +1592,19 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:112:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:131:56
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:239:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:245:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:277:45
+ERROR Could not find name `HumanInputFormStatus` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:342:20
+ERROR Could not find name `DeliveryMethodType` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:348:34
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:380:44
ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_account_service.py:513:16
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1775,6 +1787,8 @@
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:247:29
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.model.MessageFile.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:250:29
+ERROR Cannot find module `core.workflow.nodes.human_input.enums` [missing-import]
+ --> tests/test_containers_integration_tests/services/test_restore_archived_workflow_run.py:7:1
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:84:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -4298,7 +4312,7 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_batch_update_document_status.py:554:65
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-03 08:17:52.526191018 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-03 08:17:44.444130723 +0000
@@ -1172,9 +1172,9 @@
ERROR Object of class `object` has no attribute `status` [missing-attribute]
--> repositories/sqlalchemy_api_workflow_node_execution_repository.py:189:20
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `dify_graph.entities.pause_reason.HumanInputRequired.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_api_workflow_run_repository.py:121:33
+ --> repositories/sqlalchemy_api_workflow_run_repository.py:122:33
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `core.entities.execution_extra_content.HumanInputFormDefinition.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_execution_extra_content_repository.py:140:45
+ --> repositories/sqlalchemy_execution_extra_content_repository.py:161:45
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1592,7 +1592,11 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:112:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:135:56
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:281:45
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:384:44
ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_account_service.py:513:16
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1775,6 +1779,8 @@
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:247:29
ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.model.MessageFile.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_messages_clean_service.py:250:29
+ERROR Cannot find module `core.workflow.nodes.human_input.enums` [missing-import]
+ --> tests/test_containers_integration_tests/services/test_restore_archived_workflow_run.py:7:1
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_saved_message_service.py:84:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -4298,7 +4304,7 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_batch_update_document_status.py:554:65
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-03 08:35:11.268515690 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-03 08:35:02.768382607 +0000
@@ -1172,9 +1172,9 @@
ERROR Object of class `object` has no attribute `status` [missing-attribute]
--> repositories/sqlalchemy_api_workflow_node_execution_repository.py:189:20
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `dify_graph.entities.pause_reason.HumanInputRequired.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_api_workflow_run_repository.py:121:33
+ --> repositories/sqlalchemy_api_workflow_run_repository.py:122:33
ERROR Argument `dict[str, Any]` is not assignable to parameter `resolved_default_values` with type `Mapping[LaxStr, Any]` in function `core.entities.execution_extra_content.HumanInputFormDefinition.__init__` [bad-argument-type]
- --> repositories/sqlalchemy_execution_extra_content_repository.py:140:45
+ --> repositories/sqlalchemy_execution_extra_content_repository.py:161:45
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1592,7 +1592,11 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:112:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:135:56
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:281:45
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:384:44
ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_account_service.py:513:16
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -4298,7 +4302,7 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_batch_update_document_status.py:554:65
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
|
| stmt = select(WorkflowAppLog).where(WorkflowAppLog.workflow_run_id == run_id) | ||
| return list(session.scalars(stmt)) | ||
|
|
||
| def get_execution_extra_contents_by_run_id( |
There was a problem hiding this comment.
should we move these method to separate repo?
get_execution_extra_contents_by_run_id -> ExecutionExtraContentRepository
get_human_input_forms_by_run_id & get_human_input_deliveries_by_form_ids & get_human_input_recipients_by_form_ids -> HumanInputRepository?
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-25 08:37:36.904388410 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-25 08:37:25.894250946 +0000
@@ -789,7 +789,15 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:137:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:154:56
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:258:23
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:300:45
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:361:23
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:403:44
ERROR Generator function should return `Generator` [bad-return]
--> tests/test_containers_integration_tests/repositories/test_workflow_run_repository.py:89:56
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
@@ -6886,7 +6894,9 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
+ERROR Class member `FailingRepo.delete_runs_with_related` overrides parent class `FakeRepo` in an inconsistent manner [bad-override]
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:319: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:397:13
ERROR Class member `FixedDateTime.now` overrides parent class `datetime` in an inconsistent manner [bad-override]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-25 08:39:43.707996375 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-25 08:39:32.613027460 +0000
@@ -789,7 +789,15 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_run` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:137:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:154:56
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:258:23
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `delete_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.delete_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:300:45
+ERROR Could not find name `HumanInputFormKind` [unknown-name]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:361:23
+ERROR Argument `(session: Session, run_ids: list[str]) -> int` is not assignable to parameter `count_execution_extra_contents` with type `((Session, Sequence[str]) -> int) | None` in function `repositories.sqlalchemy_api_workflow_run_repository.DifyAPISQLAlchemyWorkflowRunRepository.count_runs_with_related` [bad-argument-type]
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:403:44
ERROR Generator function should return `Generator` [bad-return]
--> tests/test_containers_integration_tests/repositories/test_workflow_run_repository.py:89:56
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
@@ -6886,7 +6894,9 @@
ERROR Argument `None` is not assignable to parameter `file` with type `FileStorage` in function `services.audio_service.AudioService.transcript_asr` [bad-argument-type]
--> tests/unit_tests/services/test_audio_service.py:318:61
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
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:130:49
+ERROR Class member `FailingRepo.delete_runs_with_related` overrides parent class `FakeRepo` in an inconsistent manner [bad-override]
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:319: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:397:13
ERROR Class member `FixedDateTime.now` overrides parent class `datetime` in an inconsistent manner [bad-override]
|
Important
Fixes #<issue number>.Summary
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods