Skip to content

chore: port Document to TypeBase#36084

Open
asukaminato0721 wants to merge 10 commits into
langgenius:mainfrom
asukaminato0721:typebase-document
Open

chore: port Document to TypeBase#36084
asukaminato0721 wants to merge 10 commits into
langgenius:mainfrom
asukaminato0721:typebase-document

Conversation

@asukaminato0721
Copy link
Copy Markdown
Contributor

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 && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

Copilot AI review requested due to automatic review settings May 12, 2026 12:04
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 12, 2026
@asukaminato0721 asukaminato0721 enabled auto-merge May 12, 2026 12:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-14 15:02:42.625521898 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-14 15:02:35.506475809 +0000
@@ -4,6 +4,10 @@
    --> controllers/console/app/app.py:584:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
   --> controllers/console/auth/email_register.py:73:108
+ERROR Cannot set item in `None` [unsupported-operation]
+    --> controllers/console/datasets/datasets_document.py:1114:21
+ERROR Argument `str` is not assignable to parameter `value` with type `DocumentDocType | SQLCoreOperations[DocumentDocType | None] | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> controllers/console/datasets/datasets_document.py:1116:29
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
   --> controllers/console/init_validate.py:31:2
 ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
@@ -16,6 +20,10 @@
   --> controllers/console/setup.py:65:2
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
   --> controllers/console/version.py:30:2
+ERROR Argument `Literal['rag-pipeline']` is not assignable to parameter `created_from` with type `DocumentCreatedFrom` in function `PipelineGenerator._build_document` [bad-argument-type]
+   --> core/app/apps/pipeline/pipeline_generator.py:151:34
+ERROR Argument `dict[BuiltInField, DatasourceProviderType | str | Unknown] | dict[Unknown, Unknown]` is not assignable to parameter `value` with type `SQLCoreOperations[dict[str, Any] | None] | dict[str, Any] | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> core/app/apps/pipeline/pipeline_generator.py:717:37
 ERROR Class member `EasyUIBasedGenerateTaskPipeline._application_generate_entity` overrides parent class `BasedGenerateTaskPipeline` in an inconsistent manner [bad-override-mutable-attribute]
   --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:75:5
 ERROR `+=` is not supported between `list[PromptMessageContentUnionTypes]` and `str` [unsupported-operation]
@@ -542,10 +550,36 @@
    --> services/audio_service.py:151:52
 ERROR Argument `str | None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> services/conversation_service.py:131:33
+ERROR Argument `str` is not assignable to parameter `value` with type `DocumentCreatedFrom | SQLCoreOperations[DocumentCreatedFrom]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> services/dataset_service.py:2148:57
+ERROR Argument `Literal['upload_file']` is not assignable to parameter `data_source_type` with type `DataSourceType` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2162:37
+ERROR Argument `str` is not assignable to parameter `document_form` with type `IndexStructureType` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2163:37
+ERROR Argument `str` is not assignable to parameter `created_from` with type `DocumentCreatedFrom` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2166:37
+ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
+    --> services/dataset_service.py:2195:63
 ERROR `dict[str, dict[str, Any] | str | None]` is not assignable to variable `data_source_info` with type `dict[str, bool | str]` [bad-assignment]
     --> services/dataset_service.py:2202:56
+ERROR Argument `Literal['notion_import']` is not assignable to parameter `data_source_type` with type `DataSourceType` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2214:41
+ERROR Argument `str` is not assignable to parameter `document_form` with type `IndexStructureType` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2215:41
+ERROR Argument `str` is not assignable to parameter `created_from` with type `DocumentCreatedFrom` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2218:41
+ERROR Argument `Literal['website_crawl']` is not assignable to parameter `data_source_type` with type `DataSourceType` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2254:33
+ERROR Argument `str` is not assignable to parameter `document_form` with type `IndexStructureType` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2255:33
+ERROR Argument `str` is not assignable to parameter `created_from` with type `DocumentCreatedFrom` in function `DocumentService.build_document` [bad-argument-type]
+    --> services/dataset_service.py:2258:33
+ERROR Argument `dict[BuiltInField, DataSourceType | str] | dict[Unknown, Unknown]` is not assignable to parameter `value` with type `SQLCoreOperations[dict[str, Any] | None] | dict[str, Any] | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> services/dataset_service.py:2614:37
 ERROR `dict[str, dict[str, Any] | str | None]` is not assignable to variable `data_source_info` with type `dict[str, bool | str]` [bad-assignment]
     --> services/dataset_service.py:2715:44
+ERROR Argument `Literal['notion_import', 'upload_file', 'website_crawl']` is not assignable to parameter `value` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> services/dataset_service.py:2734:41
 ERROR `None` is not assignable to attribute `rules` with type `Never` [bad-assignment]
     --> services/dataset_service.py:2890:51
 ERROR Class member `DocumentIndexingTaskProxy.NORMAL_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
@@ -568,6 +602,8 @@
    --> tasks/regenerate_summary_index_task.py:276:61
 ERROR `str` is not assignable to attribute `error` with type `Never` [bad-assignment]
    --> tasks/regenerate_summary_index_task.py:277:60
+ERROR `Literal[True]` is not assignable to attribute `enabled` with type `Never` [bad-assignment]
+  --> tasks/remove_document_from_index_task.py:93:36
 ERROR Class member `AsyncWorkflowCFSPlanScheduler.plan` overrides parent class `CFSPlanScheduler` in an inconsistent manner [bad-override-mutable-attribute]
   --> tasks/workflow_cfs_scheduler/cfs_scheduler.py:19:5
 ERROR Argument `_GP` is not assignable to parameter `graph_init_params` with type `GraphInitParams` in function `core.workflow.nodes.datasource.datasource_node.DatasourceNode.__init__` [bad-argument-type]
@@ -715,17 +751,17 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:461:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:472:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:471:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:490:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:489:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:530:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:529:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:540:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:539:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:577:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:576:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:587:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:586:23
 ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_execution_repository.SQLAlchemyWorkflowExecutionRepository.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:264:29
 ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_node_execution_repository.SQLAlchemyWorkflowNodeExecutionRepository.__init__` [bad-argument-type]
@@ -778,6 +814,16 @@
   --> tests/test_containers_integration_tests/services/dataset_service_update_delete.py:41:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/dataset_service_update_delete.py:47:62
+ERROR Argument `str` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/document_service_status.py:90:30
+ERROR Argument `str` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/document_service_status.py:99:36
+ERROR `in` is not supported between `Literal['document_name']` and `None` [not-iterable]
+    --> tests/test_containers_integration_tests/services/document_service_status.py:1172:16
+ERROR `None` is not subscriptable [unsupported-operation]
+    --> tests/test_containers_integration_tests/services/document_service_status.py:1173:16
+ERROR `None` is not subscriptable [unsupported-operation]
+    --> tests/test_containers_integration_tests/services/document_service_status.py:1174:16
 ERROR Object of class `NoneType` has no attribute `version` [missing-attribute]
   --> tests/test_containers_integration_tests/services/plugin/test_plugin_service.py:50:16
 ERROR Object of class `NoneType` has no attribute `version` [missing-attribute]
@@ -1004,20 +1050,38 @@
   --> tests/test_containers_integration_tests/services/test_dataset_service.py:38:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_dataset_service.py:40:58
+ERROR Argument `str | Unknown` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_dataset_service.py:720:31
+ERROR Argument `Literal['error']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_dataset_service.py:788:32
+ERROR Argument `Literal['error']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_dataset_service.py:789:32
+ERROR Argument `str` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/test_dataset_service_batch_update_document_status.py:88:36
 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/test_containers_integration_tests/services/test_dataset_service_batch_update_document_status.py:712:64
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_dataset_service_create_dataset.py:36:18
-ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/services/test_dataset_service_delete_dataset.py:25:20
-ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/services/test_dataset_service_delete_dataset.py:32:20
+ERROR Argument `str` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/test_dataset_service_document.py:66:30
+ERROR Argument `str` is not assignable to parameter `doc_form` with type `IndexStructureType | SQLCoreOperations[IndexStructureType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/test_dataset_service_document.py:72:22
+ERROR Argument `str` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/test_dataset_service_document.py:74:36
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_dataset_service_permissions.py:38:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_dataset_service_permissions.py:40:58
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_dataset_service_permissions.py:67:20
+ERROR Argument `str` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/test_document_service_display_status.py:50:32
+ERROR Argument `Literal['completed']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/services/test_document_service_rename_document.py:76:27
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/test_containers_integration_tests/services/test_document_service_rename_document.py:155:12
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/test_containers_integration_tests/services/test_document_service_rename_document.py:156:12
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_file_service.py:69:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1044,6 +1108,8 @@
    --> tests/test_containers_integration_tests/services/test_messages_clean_service.py:263:29
 ERROR Argument `Literal['end_user']` is not assignable to parameter `created_by_role` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `models.web.SavedMessage.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_messages_clean_service.py:272:29
+ERROR `not in` is not supported between `Literal['existing_key']` and `None` [not-iterable]
+   --> tests/test_containers_integration_tests/services/test_metadata_partial_update.py:121:16
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_metadata_service.py:56:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1468,6 +1534,8 @@
   --> tests/test_containers_integration_tests/tasks/test_add_document_to_index_task.py:56:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/tasks/test_add_document_to_index_task.py:63:20
+ERROR Argument `Literal['completed']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_add_document_to_index_task.py:778:40
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/tasks/test_batch_clean_document_task.py:73:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1485,37 +1553,37 @@
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:123:20
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:295:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:294:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:298:22
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:297:22
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:419:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:418:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:422:22
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:421:22
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:495:36
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:494:36
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:498:26
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:497:26
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:552:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:551:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:555:22
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:554:22
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:638:36
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:637:36
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:641:26
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:640:26
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:751:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:750:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:754:22
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:753:22
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:845:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:844:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:848:22
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:847:22
 ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:999:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:997:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1002:22
+    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1000:22
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:100:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1529,71 +1597,75 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:352:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:364:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:363:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:434:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:433:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:451:27
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:450:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:535:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:534:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:547:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:545:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:635:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:633:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:647:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:644:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:727:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:724:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:745:27
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:742:27
 ERROR `num_segments_per_doc` may be uninitialized [unbound-name]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:788:32
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:785:32
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:832:27
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:829:27
 ERROR `>=` is not supported between `None` and `Literal[3]` [unsupported-operation]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:890:16
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:887:16
 ERROR `>=` is not supported between `None` and `Literal[9]` [unsupported-operation]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:891:16
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:888:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:936:23
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:933:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:962:27
+   --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:959:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1041:23
+    --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1038:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1054:23
+    --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1050:23
+ERROR Argument `Literal['indexing']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_create_segment_to_index_task.py:470:36
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:226:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:223:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:327:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:322:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:436:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:430:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:568:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:560:16
 ERROR Object of class `NoneType` has no attribute `error` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:569:52
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:561:52
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:639:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:630:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:715:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:705:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:922:16
+   --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:909:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1032:16
+    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1016:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1038:16
+    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1022:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1153:16
+    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1134:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1159:16
+    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1140:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1274:16
+    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1252:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1280:16
+    --> tests/test_containers_integration_tests/tasks/test_deal_dataset_vector_index_task.py:1258:16
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/tasks/test_disable_segment_from_index_task.py:56:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/tasks/test_disable_segment_from_index_task.py:64:20
+ERROR Argument `Literal['indexing']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_disable_segment_from_index_task.py:413:36
 ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
   --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:63:9
 ERROR Object of class `Account` has no attribute `type` [missing-attribute]
@@ -1602,6 +1674,16 @@
   --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:73:21
 ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
    --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:101:23
+ERROR Argument `Literal['completed']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:157:36
+ERROR Argument `Literal['indexing']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:401:36
+ERROR Argument `str` is not assignable to parameter `indexing_status` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `models.dataset.Document.__init__` [bad-argument-type]
+  --> tests/test_containers_integration_tests/tasks/test_document_indexing_sync_task.py:89:29
+ERROR `in` is not supported between `Literal['Datasource credential not found']` and `None` [not-iterable]
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_sync_task.py:284:16
+ERROR `in` is not supported between `Literal['Indexing error']` and `None` [not-iterable]
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_sync_task.py:442:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
    --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:258:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
@@ -1615,33 +1697,33 @@
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
    --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:376:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:452:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:450:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:453:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:451:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:515:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:513:20
 ERROR Object of class `NoneType` has no attribute `error` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:516:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:514:20
 ERROR `in` is not supported between `Literal['batch upload']` and `object` [not-iterable]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:517:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:515:20
 ERROR Object of class `NoneType` has no attribute `stopped_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:518:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:516:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:556:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:554:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:557:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:555:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:599:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:597:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:600:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:598:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:712:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:710:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:713:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:711:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:837:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:835:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:838:20
+   --> tests/test_containers_integration_tests/tasks/test_document_indexing_task.py:836:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
    --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:129:16
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
@@ -1649,63 +1731,55 @@
 ERROR `>` is not supported between `None` and `Literal[0]` [unsupported-operation]
    --> tests/test_containers_integration_tests/tasks/test_document_indexing_update_task.py:177:16
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:86:20
-ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:93:20
-ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:224:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:223:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:231:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:230:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:326:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:325:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:327:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:326:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:378:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:377:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:379:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:378:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:447:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:446:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:448:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:447:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:494:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:493:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:495:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:494:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:552:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:551:20
 ERROR Object of class `NoneType` has no attribute `error` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:553:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:552:20
 ERROR Object of class `object` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:554:38
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:553:38
 ERROR Object of class `NoneType` has no attribute `stopped_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:555:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:554:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:594:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:593:20
 ERROR Object of class `NoneType` has no attribute `error` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:595:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:594:20
 ERROR Object of class `object` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:596:31
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:595:31
 ERROR Object of class `NoneType` has no attribute `stopped_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:597:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:596:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:658:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:657:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:701:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:700:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:745:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:744:20
 ERROR Object of class `NoneType` has no attribute `is_paused` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:860:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:859:20
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:861:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:860:20
 ERROR Object of class `NoneType` has no attribute `display_status` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:862:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:861:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
-   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:863:20
-ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/tasks/test_enable_segments_to_index_task.py:55:20
-ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/tasks/test_enable_segments_to_index_task.py:62:20
+   --> tests/test_containers_integration_tests/tasks/test_duplicate_document_indexing_task.py:862:20
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/tasks/test_mail_account_deletion_task.py:51:20
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
@@ -1896,6 +1970,16 @@
    --> tests/unit_tests/controllers/console/explore/test_wraps.py:181:18
 ERROR Argument `Literal['app-id']` is not assignable to parameter `view` with type `(App) -> Unknown` in function `controllers.console.explore.wraps.decorator` [bad-argument-type]
    --> tests/unit_tests/controllers/console/explore/test_wraps.py:204:23
+ERROR Argument `Literal['local_file', 'notion_import', 'upload_file', 'website_crawl']` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+  --> tests/unit_tests/controllers/console/test_document_detail_api_data_source_info.py:76:34
+ERROR Argument `Literal['local_file']` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+  --> tests/unit_tests/controllers/console/test_document_detail_api_data_source_info.py:96:30
+ERROR Argument `Literal['notion_import']` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+   --> tests/unit_tests/controllers/console/test_document_detail_api_data_source_info.py:114:30
+ERROR Argument `Literal['website_crawl']` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+   --> tests/unit_tests/controllers/console/test_document_detail_api_data_source_info.py:125:30
+ERROR Argument `Literal['local_file']` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
+   --> tests/unit_tests/controllers/console/test_document_detail_api_data_source_info.py:137:30
 ERROR No attribute `MethodView` in module `builtins` [missing-attribute]
   --> tests/unit_tests/controllers/console/test_extension.py:14:5
 ERROR No attribute `MethodView` in module `builtins` [missing-attribute]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 0.00% 43.70% +43.70%
Strict coverage 0.00% 43.23% +43.23%
Typed symbols 0 22,069 +22,069
Untyped symbols 0 28,744 +28,744
Modules 0 2553 +2,553

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR begins migrating the Document ORM model in api/models/dataset.py from Base to TypeBase (SQLAlchemy MappedAsDataclass) and adjusts a container integration test helper signature to type doc_form as IndexStructureType.

Changes:

  • Switch Document to inherit from TypeBase and add Mapped[...] type annotations to many columns.
  • Update the test helper _create_test_document to type doc_form as IndexStructureType instead of str.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
api/models/dataset.py Ports Document to TypeBase and adds typed SQLAlchemy Mapped column declarations.
api/tests/test_containers_integration_tests/tasks/test_disable_segment_from_index_task.py Updates _create_test_document parameter typing for doc_form.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/models/dataset.py Outdated
Comment thread api/models/dataset.py Outdated
Comment thread api/models/dataset.py Outdated
asukaminato0721 and others added 3 commits May 12, 2026 21:15
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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