Skip to content

refactor: add Mapped type annotations to model fields (#40373) - #40380

Open
mahbubsouad wants to merge 2 commits into
langgenius:mainfrom
mahbubsouad:fix/40373-add-mapped-annotations
Open

refactor: add Mapped type annotations to model fields (#40373)#40380
mahbubsouad wants to merge 2 commits into
langgenius:mainfrom
mahbubsouad:fix/40373-add-mapped-annotations

Conversation

@mahbubsouad

Copy link
Copy Markdown

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

Added Mapped type annotations to SQLAlchemy models in api/models/model.py and api/models/dataset.py to upgrade to SQLAlchemy 2.0 style syntax.

Fixes #40373

Screenshots

N/A (Backend type hint changes only)

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

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. refactor labels Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-10 01:25:14.146124006 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-10 01:25:00.370067083 +0000
@@ -460,6 +460,180 @@
    --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:891:42
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_weaviate.weaviate_vector.WeaviateVectorFactory.init_vector` [bad-argument-type]
    --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:920:42
+ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
+   --> controllers/console/datasets/data_source.py:269:51
+ERROR Cannot set item in `None` [unsupported-operation]
+    --> controllers/console/datasets/datasets_document.py:1308: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:1310:29
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:380:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:382:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:446:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:448:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:526:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:528:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:737:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/console/datasets/datasets_segments.py:739:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:209:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:211:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:300:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:302:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:428:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:430:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:574:30
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> controllers/service_api/dataset/segment.py:576:27
+ERROR Argument `str | Unknown | None` is not assignable to parameter `tenant_id` with type `str` in function `services.feature_service.FeatureService.get_vector_space` [bad-argument-type]
+   --> controllers/service_api/wraps.py:192:64
+ERROR Argument `str | Unknown | None` is not assignable to parameter `tenant_id` with type `str` in function `services.feature_service.FeatureService.get_features` [bad-argument-type]
+   --> controllers/service_api/wraps.py:194:60
+ERROR Argument `str | Unknown | None` is not assignable to parameter `tenant_id` with type `str` in function `services.feature_service.FeatureService.get_features` [bad-argument-type]
+   --> controllers/service_api/wraps.py:203:52
+ERROR Argument `str | Unknown | None` is not assignable to parameter `tenant_id` with type `str` in function `services.feature_service.FeatureService.get_features` [bad-argument-type]
+   --> controllers/service_api/wraps.py:234:52
+ERROR Argument `str | Unknown | None` is not assignable to parameter `tenant_id` with type `str` in function `services.feature_service.FeatureService.get_knowledge_rate_limit` [bad-argument-type]
+   --> controllers/service_api/wraps.py:261:80
+ERROR Argument `str | Unknown | None` is not assignable to parameter `tenant_id` with type `SQLCoreOperations[str] | str` in function `models.dataset.RateLimitLog.__init__` [bad-argument-type]
+   --> controllers/service_api/wraps.py:275:39
+ERROR Argument `str | None` is not assignable to parameter `document_form` with type `str` in function `PipelineGenerator._build_document` [bad-argument-type]
+   --> core/app/apps/pipeline/pipeline_generator.py:161:35
+ERROR Argument `str | None` is not assignable to parameter `chunk_structure` with type `bytearray | bytes | str` in function `core.entities.knowledge_entities.PipelineDataset.__init__` [bad-argument-type]
+   --> core/app/apps/pipeline/pipeline_generator.py:272:33
+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:750:37
+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]
+   --> core/app/apps/pipeline/pipeline_runner.py:334:44
+ERROR Argument `str | None` is not assignable to parameter `doc_language` with type `str` in function `IndexingRunner._transform` [bad-argument-type]
+   --> core/indexing_runner.py:119:21
+ERROR Argument `str | None` is not assignable to parameter `doc_language` with type `str` in function `IndexingRunner._transform` [bad-argument-type]
+   --> core/indexing_runner.py:213:17
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> core/indexing_runner.py:350:31
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> core/indexing_runner.py:858:27
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+  --> core/rag/datasource/vdb/vector_factory.py:69:26
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+  --> core/rag/datasource/vdb/vector_factory.py:71:23
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> core/rag/datasource/vdb/vector_factory.py:291:22
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> core/rag/datasource/vdb/vector_factory.py:293:19
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+  --> core/rag/embedding/token_counter.py:21:18
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+  --> core/rag/embedding/token_counter.py:23:15
+ERROR `dict[str, Any] | None` is not assignable to variable `summary_index_setting` with type `SummaryIndexSettingDict | None` [bad-assignment]
+  --> core/rag/index_processor/index_processor.py:89:37
+ERROR Argument `str | None` is not assignable to parameter `chunk_structure` with type `str` in function `services.vector_space_admission_service.VectorSpaceAdmissionService.ensure_pipeline_can_be_indexed` [bad-argument-type]
+   --> core/rag/index_processor/index_processor.py:113:33
+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]
+   --> core/rag/index_processor/index_processor.py:137:36
+ERROR `dict[str, Any] | None` is not assignable to variable `summary_index_setting` with type `SummaryIndexSettingDict | None` [bad-assignment]
+   --> core/rag/index_processor/index_processor.py:207:37
+ERROR Argument `dict[str, Any] | None` is not assignable to parameter `external_retrieval_parameters` with type `dict[str, Any]` in function `services.external_knowledge_service.ExternalDatasetService.fetch_external_knowledge_retrieval` [bad-argument-type]
+   --> core/rag/retrieval/dataset_retrieval.py:664:55
+ERROR `str | None` is not assignable to TypedDict key `embedding_provider_name` with type `str` [bad-assignment]
+   --> core/rag/retrieval/dataset_retrieval.py:794:76
+ERROR `str | None` is not assignable to TypedDict key `embedding_model_name` with type `str` [bad-assignment]
+   --> core/rag/retrieval/dataset_retrieval.py:797:73
+ERROR Argument `dict[str, Any] | None` is not assignable to parameter `external_retrieval_parameters` with type `dict[str, Any]` in function `services.external_knowledge_service.ExternalDatasetService.fetch_external_knowledge_retrieval` [bad-argument-type]
+    --> core/rag/retrieval/dataset_retrieval.py:1112:51
+ERROR `dict[str, Any] | None` is not assignable to variable `summary_index_setting` with type `SummaryIndexSettingDict | None` [bad-assignment]
+  --> core/rag/summary_index/summary_index.py:31:45
+ERROR Argument `dict[str, Any] | None` is not assignable to parameter `external_retrieval_parameters` with type `dict[str, Any]` in function `services.external_knowledge_service.ExternalDatasetService.fetch_external_knowledge_retrieval` [bad-argument-type]
+  --> core/tools/utils/dataset_retriever/dataset_retriever_tool.py:91:47
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.delay` [bad-argument-type]
+  --> events/event_handlers/clean_when_dataset_deleted.py:15:9
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.delay` [bad-argument-type]
+  --> events/event_handlers/clean_when_dataset_deleted.py:16:9
+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/agent/roster_service.py:484:20
+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/app_service.py:582:20
+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:2214:40
+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:2354:57
+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:2401:63
+ERROR Argument `dict[BuiltInField, 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:2836:37
+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:2958:41
+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:2973:33
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3401:26
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3403:23
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3484:34
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3486:31
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3631:39
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3691:34
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3693:31
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+    --> services/dataset_service.py:3736:39
+ERROR Argument `dict[str, Any]` is not assignable to parameter `summary_index_setting` with type `SummaryIndexSettingDict` in function `services.summary_index_service.SummaryIndexService.generate_and_vectorize_summary` [bad-argument-type]
+    --> services/dataset_service.py:3782:37
+ERROR Argument `dict[str, Any]` is not assignable to parameter `summary_index_setting` with type `SummaryIndexSettingDict` in function `services.summary_index_service.SummaryIndexService.generate_and_vectorize_summary` [bad-argument-type]
+    --> services/dataset_service.py:3822:41
+ERROR Cannot set item in `dict[str, EndUser]` [unsupported-operation]
+   --> services/end_user_service.py:153:28
+ERROR Argument `str | None` is not assignable to parameter `element` with type `str` in function `set.add` [bad-argument-type]
+   --> services/end_user_service.py:154:35
+ERROR Cannot set item in `dict[str, EndUser]` [unsupported-operation]
+   --> services/end_user_service.py:177:28
+ERROR Argument `str | None` is not assignable to parameter `chunk_structure` with type `SQLCoreOperations[str] | str` in function `models.dataset.PipelineCustomizedTemplate.__init__` [bad-argument-type]
+    --> services/rag_pipeline/rag_pipeline.py:1311:29
+ERROR `str | None` is not assignable to attribute `embedding_model` with type `str` [bad-assignment]
+   --> services/rag_pipeline/rag_pipeline_transform_service.py:182:55
+ERROR `str | None` is not assignable to attribute `embedding_model_provider` with type `str` [bad-assignment]
+   --> services/rag_pipeline/rag_pipeline_transform_service.py:183:64
+ERROR Argument `str | None` is not assignable to parameter `description` with type `SQLCoreOperations[str] | str` in function `models.dataset.Pipeline.__init__` [bad-argument-type]
+   --> services/rag_pipeline/rag_pipeline_transform_service.py:304:25
+ERROR Argument `str | None` is not assignable to parameter `pipeline_id` with type `SQLCoreOperations[str] | str` in function `models.dataset.DocumentPipelineExecutionLog.__init__` [bad-argument-type]
+   --> services/rag_pipeline/rag_pipeline_transform_service.py:354:41
+ERROR Argument `str | None` is not assignable to parameter `pipeline_id` with type `SQLCoreOperations[str] | str` in function `models.dataset.DocumentPipelineExecutionLog.__init__` [bad-argument-type]
+   --> services/rag_pipeline/rag_pipeline_transform_service.py:382:33
+ERROR Argument `str | None` is not assignable to parameter `pipeline_id` with type `SQLCoreOperations[str] | str` in function `models.dataset.DocumentPipelineExecutionLog.__init__` [bad-argument-type]
+   --> services/rag_pipeline/rag_pipeline_transform_service.py:410:33
+ERROR Argument `str | None` is not assignable to parameter `provider` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> services/summary_index_service.py:238:26
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> services/summary_index_service.py:240:23
+ERROR Argument `str | None` is not assignable to parameter `created_by` with type `SQLCoreOperations[str] | str` in function `models.trigger.WorkflowWebhookTrigger.__init__` [bad-argument-type]
+   --> services/trigger/webhook_service.py:963:36
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+  --> services/vector_service.py:62:35
+ERROR Argument `str | None` is not assignable to parameter `model` with type `str` in function `core.model_manager.ModelManager.get_model_instance` [bad-argument-type]
+   --> services/vector_space_admission_service.py:423:23
+ERROR Argument `dict[str, Any]` is not assignable to parameter `summary_index_setting` with type `SummaryIndexSettingDict` in function `services.summary_index_service.SummaryIndexService.generate_summaries_for_document` [bad-argument-type]
+  --> tasks/generate_summary_index_task.py:92:39
+ERROR Argument `dict[str, Any] | None` is not assignable to parameter `summary_index_setting` with type `SummaryIndexSettingDict` in function `services.summary_index_service.SummaryIndexService.generate_and_vectorize_summary` [bad-argument-type]
+   --> tasks/regenerate_summary_index_task.py:262:55
+ERROR `Literal[True]` is not assignable to attribute `enabled` with type `Never` [bad-assignment]
+  --> tasks/remove_document_from_index_task.py:99:36
 ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
   --> tests/helpers/legacy_model_type_migration.py:64:16
 ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
@@ -544,6 +718,10 @@
   --> tests/integration_tests/core/workflow/nodes/datasource/test_datasource_node_integration.py:86:29
 ERROR Could not import `Overflow` from `libs.broadcast_channel.channel` [missing-module-attribute]
   --> tests/integration_tests/libs/broadcast_channel/redis/utils/test_data.py:11:44
+ERROR Argument `str | None` is not assignable to parameter `tenant_id` with type `str` in function `services.api_token_service.ApiTokenCache._make_tenant_index_key` [bad-argument-type]
+   --> tests/integration_tests/libs/test_api_token_cache_integration.py:306:62
+ERROR Argument `str | None` is not assignable to parameter `tenant_id` with type `str` in function `services.api_token_service.ApiTokenCache._make_tenant_index_key` [bad-argument-type]
+   --> tests/integration_tests/libs/test_api_token_cache_integration.py:319:70
 ERROR `unpatch` may be uninitialized [unbound-name]
   --> tests/integration_tests/model_runtime/__mock/plugin_daemon.py:41:9
 ERROR Class member `MockModelClass.fetch_model_providers` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -632,6 +810,18 @@
    --> tests/integration_tests/workflow/test_response_stream_filter_pause_resume_integration.py:113:14
 ERROR Argument `Literal['image']` is not assignable to parameter `value` with type `IconType | SQLCoreOperations[IconType | None] | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> tests/test_containers_integration_tests/controllers/web/test_site.py:115:26
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:204:33
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:206:21
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:207:32
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:208:28
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:209:26
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/controllers/web/test_site.py:210:31
 ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
   --> tests/test_containers_integration_tests/controllers/web/test_wraps.py:77:33
 ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
@@ -788,6 +978,14 @@
   --> tests/test_containers_integration_tests/repositories/test_workflow_run_repository.py:25:9
 ERROR Generator function should return `Generator` [bad-return]
   --> tests/test_containers_integration_tests/repositories/test_workflow_run_repository.py:89:56
+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:1236:16
+ERROR `None` is not subscriptable [unsupported-operation]
+    --> tests/test_containers_integration_tests/services/document_service_status.py:1237:16
+ERROR `None` is not subscriptable [unsupported-operation]
+    --> tests/test_containers_integration_tests/services/document_service_status.py:1238:16
 ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_account_service.py:580:16
 ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
@@ -1038,6 +1236,18 @@
   --> 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 `None` is not subscriptable [unsupported-operation]
+   --> tests/test_containers_integration_tests/services/test_dataset_service.py:701:16
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/test_containers_integration_tests/services/test_dataset_service.py:702:16
+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:744: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:812: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:813: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:738:24
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
@@ -1046,12 +1256,22 @@
   --> 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 `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:77: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 Object of class `NoneType` has no attribute `size` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_feature_service.py:132:20
 ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
@@ -1146,6 +1366,12 @@
    --> tests/test_containers_integration_tests/services/test_messages_clean_service.py:961:22
 ERROR Object of class `str` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_messages_clean_service.py:961:52
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/test_containers_integration_tests/services/test_metadata_partial_update.py:105:16
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/test_containers_integration_tests/services/test_metadata_partial_update.py:106:16
+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:139: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_model_load_balancing_service.py:84: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]
@@ -1216,6 +1442,40 @@
   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:72:20
 ERROR Argument `Literal['emoji']` is not assignable to parameter `value` with type `IconType | SQLCoreOperations[IconType | None] | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:73:25
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_draft_variables_by_selectors` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:269:99
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.list_variables_without_values` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:307:89
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.list_node_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:358:71
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.list_conversation_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:400:70
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.delete_user_workflow_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:578:64
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.list_conversation_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:633:75
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.delete_user_workflow_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:638:64
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.delete_node_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:709:64
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService._get_conversation_id_from_draft_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:797:86
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService._get_conversation_id_from_draft_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:813:86
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.list_system_variables` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:854:64
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_conversation_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:901:97
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_system_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:905:89
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_node_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:909:102
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_conversation_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:927:105
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_system_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:929:97
+ERROR Argument `str | None` is not assignable to parameter `user_id` with type `str` in function `services.workflow_draft_variable_service.WorkflowDraftVariableService.get_node_variable` [bad-argument-type]
+   --> tests/test_containers_integration_tests/services/test_workflow_draft_variable_service.py:935:21
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
   --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:95:38
 ERROR Argument `float` is not assignable to parameter `value` with type `Decimal | SQLCoreOperations[Decimal]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
@@ -1442,6 +1702,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:779: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]
@@ -1460,34 +1722,66 @@
    --> 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:296:26
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:297:35
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:420:26
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:421:35
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:496:30
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:497:39
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:553:26
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:554:35
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:639:30
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:640:39
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:752:26
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:753:35
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:846:26
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:847:35
 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
 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
+ERROR Argument `str | None` is not assignable to parameter `index_struct` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1000:26
+ERROR Argument `str | None` is not assignable to parameter `collection_binding_id` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1001:35
 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
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1536,6 +1830,8 @@
     --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1057:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
     --> tests/test_containers_integration_tests/tasks/test_clean_notion_document_task.py:1070: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:227:16
 ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
@@ -1568,6 +1864,8 @@
   --> 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:65:9
 ERROR Object of class `Account` has no attribute `type` [missing-attribute]
@@ -1576,10 +1874,18 @@
   --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:75: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:103: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:159:36
 ERROR `str | None` is not assignable to upper bound `SupportsDunderGT[Any] | SupportsDunderLT[Any]` of type variable `SupportsRichComparisonT` [bad-specialization]
    --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:297:57
+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:403:36
 ERROR `str | None` is not assignable to upper bound `SupportsDunderGT[Any] | SupportsDunderLT[Any]` of type variable `SupportsRichComparisonT` [bad-specialization]
    --> tests/test_containers_integration_tests/tasks/test_disable_segments_from_index_task.py:725:57
+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:271:20
 ERROR Object of class `NoneType` has no attribute `processing_started_at` [missing-attribute]
@@ -1668,6 +1974,8 @@
   --> 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
+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_enable_segments_to_index_task.py:294: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_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]
@@ -4628,9 +4936,9 @@
   --> tests/unit_tests/core/ops/test_base_trace_instance.py:22:9
 ERROR Method `trace` inherited from class `BaseTraceInstance` has no implementation and cannot be accessed via `super()` [missing-attribute]
   --> tests/unit_tests/core/ops/test_base_trace_instance.py:23:9
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
+ERROR Object of type `AppModelConfig | str | None` has no attribute `id` [missing-attribute]
    --> tests/unit_tests/core/ops/test_ops_trace_manager.py:356:12
-ERROR Argument `AppModelConfig | Any | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
+ERROR Argument `AppModelConfig | str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
    --> tests/unit_tests/core/ops/test_ops_trace_manager.py:362:23
 ERROR Object of class `dict` has no attribute `message_id` [missing-attribute]
    --> tests/unit_tests/core/ops/test_ops_trace_manager.py:406:12
@@ -7540,6 +7848,8 @@
   --> tests/unit_tests/services/test_app_generate_service_streaming_integration.py:96:36
 ERROR Argument `_FakeRedisClient` is not assignable to parameter `redis_client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis.pubsub_channel.BroadcastChannel.__init__` [bad-argument-type]
    --> tests/unit_tests/services/test_app_generate_service_streaming_integration.py:116:34
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/services/test_app_service.py:324:19
 ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
    --> tests/unit_tests/services/test_app_service.py:660:84
 ERROR Argument `TestAsyncWorkflowService.test_should_dispatch_to_matching_celery_task_when_triggering_workflow.DummyAccount` is not assignable to parameter `user` with type `Account | EndUser` in function `services.async_workflow_service.AsyncWorkflowService.trigger_workflow_async` [bad-argument-type]
@@ -7626,6 +7936,8 @@
    --> tests/unit_tests/services/test_dataset_service_document.py:144:9
 ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
    --> tests/unit_tests/services/test_dataset_service_document.py:145:9
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/unit_tests/services/test_dataset_service_document.py:245:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
    --> tests/unit_tests/services/test_dataset_service_document.py:551:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
@@ -8372,6 +8684,30 @@
   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:71:5
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:72:5
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:406:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:449:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:489:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:558:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:594:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:692:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/tasks/test_dataset_indexing_task.py:926:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> tests/unit_tests/tasks/test_dataset_indexing_task.py:1022:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> tests/unit_tests/tasks/test_dataset_indexing_task.py:1161:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> tests/unit_tests/tasks/test_dataset_indexing_task.py:1203:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> tests/unit_tests/tasks/test_dataset_indexing_task.py:1241:35
+ERROR Argument `Literal['waiting']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+    --> tests/unit_tests/tasks/test_dataset_indexing_task.py:1382:35
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
    --> tests/unit_tests/tasks/test_human_input_timeout_tasks.py:170:12
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 58.26% 58.27% +0.00%
Strict coverage 57.84% 57.84% +0.00%
Typed symbols 38,287 38,288 +1
Untyped symbols 27,627 27,626 -1
Modules 3144 3144 0

auto-merge was automatically disabled August 9, 2026 15:10

Head branch was pushed to by a user without write access

@mahbubsouad
mahbubsouad force-pushed the fix/40373-add-mapped-annotations branch from 5059542 to 309a5f6 Compare August 9, 2026 15:10
@asukaminato0721

Copy link
Copy Markdown
Contributor

plz make a smaller pr, about 1-2 loc, so I can merge it first.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add Mapped to all fields

2 participants