Skip to content

chore: clear and archive logs add HITL tables#32898

Open
hjlarry wants to merge 10 commits intolanggenius:mainfrom
hjlarry:p365
Open

chore: clear and archive logs add HITL tables#32898
hjlarry wants to merge 10 commits intolanggenius:mainfrom
hjlarry:p365

Conversation

@hjlarry
Copy link
Copy Markdown
Contributor

@hjlarry hjlarry commented Mar 3, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

Checklist

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

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 3, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Expanded Data Retention Scope: Extended workflow run archiving and deletion processes to include Human-in-the-Loop (HITL) related tables: workflow_runs, workflow_app_logs, human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents.
  • New Repository Methods for HITL Data: Introduced new repository methods for managing ExecutionExtraContent data, specifically for deletion and counting by workflow run IDs, and updated APIWorkflowRunRepository to handle fetching, deleting, and counting of all HITL-related data.
  • Comprehensive Cleanup Integration: Ensured that both paid plan archiving and free plan log clearing mechanisms now correctly handle the new HITL tables for comprehensive data retention and deletion across all relevant services.

🧠 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
  • api/commands.py
    • Updated the docstring for archive_workflow_runs to explicitly list workflow_runs, workflow_app_logs, human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents as tables being archived.
    • Modified the docstring for archive_workflow_runs to clarify that archived tables remain in the DB unless --delete-after-archive is provided.
    • Updated the docstring for restore_workflow_runs to include workflow_runs, workflow_app_logs, human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents as tables being restored.
  • api/repositories/api_workflow_run_repository.py
    • Imported ExecutionExtraContent, HumanInputDelivery, HumanInputForm, and HumanInputFormRecipient models.
    • Updated the docstring for delete_runs_with_related to mention the deletion of human input forms, recipients, deliveries, and execution extra contents.
    • Added a new parameter delete_execution_extra_contents to the delete_runs_with_related method signature.
    • Added new abstract methods: get_execution_extra_contents_by_run_id, get_human_input_forms_by_run_id, get_human_input_deliveries_by_form_ids, and get_human_input_recipients_by_form_ids.
    • Updated the docstring for count_runs_with_related to mention the counting of human input forms, recipients, deliveries, and execution extra contents.
    • Added a new parameter count_execution_extra_contents to the count_runs_with_related method signature.
  • api/repositories/execution_extra_content_repository.py
    • Imported Session.
    • Added abstract methods delete_by_workflow_run_ids and count_by_workflow_run_ids.
  • api/repositories/sqlalchemy_api_workflow_run_repository.py
    • Imported ExecutionExtraContent, HumanInputDelivery, HumanInputForm, and HumanInputFormRecipient models.
    • Added delete_execution_extra_contents parameter to delete_runs_with_related method.
    • Initialized counts for human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents in delete_runs_with_related.
    • Implemented deletion logic for HumanInputFormRecipient, HumanInputDelivery, HumanInputForm, and ExecutionExtraContent within delete_runs_with_related.
    • Updated the return dictionary of delete_runs_with_related to include counts for the newly deleted HITL tables.
    • Implemented get_execution_extra_contents_by_run_id, get_human_input_forms_by_run_id, get_human_input_deliveries_by_form_ids, and get_human_input_recipients_by_form_ids.
    • Added a static method _collect_human_input_form_ids_by_run_ids.
    • Added count_execution_extra_contents parameter to count_runs_with_related method.
    • Initialized counts for human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents in count_runs_with_related.
    • Implemented counting logic for HumanInputForm, HumanInputDelivery, HumanInputFormRecipient, and ExecutionExtraContent within count_runs_with_related.
    • Updated the return dictionary of count_runs_with_related to include counts for the newly counted HITL tables.
  • api/repositories/sqlalchemy_execution_extra_content_repository.py
    • Imported cast, delete, func, and CursorResult.
    • Implemented delete_by_workflow_run_ids to delete ExecutionExtraContentModel records.
    • Implemented count_by_workflow_run_ids to count ExecutionExtraContentModel records.
  • api/schedule/clean_workflow_runlogs_precise.py
    • Imported SQLAlchemyExecutionExtraContentRepository.
    • Added _delete_execution_extra_contents helper function to delete ExecutionExtraContent records.
    • Passed _delete_execution_extra_contents to workflow_run_repo.delete_runs_with_related.
  • api/services/retention/workflow_run/archive_paid_plan_workflow_run.py
    • Updated the module docstring to include human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents in the list of archived tables.
    • Imported SQLAlchemyExecutionExtraContentRepository.
    • Updated ARCHIVE_TABLES list to include the new HITL tables.
    • Added delete_execution_extra_contents parameter to _archive_run.
    • Added logic within _extract_data to fetch and include ExecutionExtraContent, HumanInputForm, HumanInputDelivery, and HumanInputFormRecipient data in the archive.
    • Added _delete_execution_extra_contents method to delete ExecutionExtraContent records.
  • api/services/retention/workflow_run/clear_free_plan_expired_workflow_run_logs.py
    • Imported SQLAlchemyExecutionExtraContentRepository.
    • Added count_execution_extra_contents parameter to run method.
    • Added delete_execution_extra_contents parameter to run method.
    • Updated _empty_related_counts to include counts for HITL tables.
    • Updated _format_related_counts to include HITL table counts in the log message.
    • Added _count_execution_extra_contents static method to count ExecutionExtraContent records.
    • Added _delete_execution_extra_contents static method to delete ExecutionExtraContent records.
  • api/services/retention/workflow_run/delete_archived_workflow_run.py
    • Imported SQLAlchemyExecutionExtraContentRepository.
    • Added delete_execution_extra_contents parameter to _delete_run.
    • Added _delete_execution_extra_contents static method to delete ExecutionExtraContent records.
  • api/services/retention/workflow_run/restore_archived_workflow_run.py
    • Imported ExecutionExtraContent, HumanInputDelivery, HumanInputForm, and HumanInputFormRecipient models.
    • Updated ARCHIVE_TABLE_MAP to include mappings for human_input_forms, human_input_form_deliveries, human_input_form_recipients, and execution_extra_contents to their respective models.
  • api/tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py
    • Imported DeliveryMethodType, HumanInputFormKind, HumanInputFormStatus, HumanInputContent, HumanInputDelivery, HumanInputForm, and HumanInputFormRecipient.
    • Updated _cleanup_scope_data to delete HumanInputContent, HumanInputFormRecipient, HumanInputDelivery, and HumanInputForm records associated with the test scope.
    • Modified test_uses_trigger_log_repository to create and assert deletion of HumanInputForm, HumanInputDelivery, HumanInputFormRecipient, and HumanInputContent records.
    • Modified test_uses_trigger_log_repository (second instance, for counting) to create and assert counting of HumanInputForm, HumanInputDelivery, HumanInputFormRecipient, and HumanInputContent records.
  • api/tests/test_containers_integration_tests/services/test_restore_archived_workflow_run.py
    • Imported HumanInputFormKind, HumanInputFormStatus, and HumanInputForm.
    • Added an integration test case to verify the successful restoration of human_input_forms.
  • api/tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py
    • Updated FakeAPIWorkflowRunRepository constructor to initialize counts for HITL tables.
    • Updated delete_runs_with_related and count_runs_with_related methods in FakeAPIWorkflowRunRepository to accept delete_execution_extra_contents and count_execution_extra_contents parameters respectively.
    • Updated test_run_dry_run_skips_deletions to include HITL table counts in assertions.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Pyrefly Diff

base → 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]

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Pyrefly Diff

base → 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]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Pyrefly Diff

base → 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]

@hjlarry hjlarry requested a review from hj24 March 3, 2026 07:55
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Pyrefly Diff

base → 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]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Pyrefly Diff

base → 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]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Pyrefly Diff

base → 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(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@QuantumGhost any suggestions?

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → 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]

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → 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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-linear size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants