fix: external dataset tenant checks for bound knowledge APIs #34734
Merged
QuantumGhost merged 3 commits intomainfrom Apr 13, 2026
Merged
fix: external dataset tenant checks for bound knowledge APIs #34734QuantumGhost merged 3 commits intomainfrom
QuantumGhost merged 3 commits intomainfrom
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-08 09:41:19.951498911 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-08 09:41:11.774582491 +0000
@@ -322,11 +322,11 @@
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 `dict[str, bool | 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:2117:56
+ --> services/dataset_service.py:2118:56
ERROR `dict[str, bool | 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:2630:44
+ --> services/dataset_service.py:2631:44
ERROR `None` is not assignable to attribute `rules` with type `Never` [bad-assignment]
- --> services/dataset_service.py:2805:51
+ --> services/dataset_service.py:2806:51
ERROR Class member `DocumentIndexingTaskProxy.NORMAL_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
--> services/document_indexing_proxy/document_indexing_task_proxy.py:11:5
ERROR Class member `DocumentIndexingTaskProxy.PRIORITY_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
@@ -6174,13 +6174,13 @@
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/models/test_app_models.py:1459:20
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/models/test_dataset_models.py:147:16
-ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/models/test_dataset_models.py:148:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/models/test_dataset_models.py:149:16
ERROR `in` is not supported between `Literal['pre_processing_rules']` and `None` [not-iterable]
- --> tests/unit_tests/models/test_dataset_models.py:823:16
+ --> tests/unit_tests/models/test_dataset_models.py:842:16
ERROR `in` is not supported between `Literal['segmentation']` and `None` [not-iterable]
- --> tests/unit_tests/models/test_dataset_models.py:824:16
+ --> tests/unit_tests/models/test_dataset_models.py:843:16
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModel.__init__` [bad-argument-type]
--> tests/unit_tests/models/test_provider_models.py:296:24
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModel.__init__` [bad-argument-type]
@@ -6409,37 +6409,37 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_dataset.py:377:25
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:665:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:694:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:675:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:704:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:714:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:743:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:737:74
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:766:74
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:804:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:833:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:842:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:871:9
ERROR Argument `None` is not assignable to parameter `embedding_model_provider` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:908:38
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:937:38
ERROR Argument `None` is not assignable to parameter `embedding_model` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:909:29
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:938:29
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:967:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:996:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1002:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1031:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1410:67
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1439:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1413:81
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1442:81
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1426:67
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1455:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1439:71
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1468:71
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1498:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1527:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1520:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1549:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.dataset_service.DocumentService.prepare_document_batch_download_zip` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_document.py:340:34
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.dataset_service.DocumentService.prepare_document_batch_download_zip` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-08 09:56:27.552598041 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-08 09:56:19.356504944 +0000
@@ -322,11 +322,11 @@
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 `dict[str, bool | 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:2117:56
+ --> services/dataset_service.py:2118:56
ERROR `dict[str, bool | 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:2630:44
+ --> services/dataset_service.py:2631:44
ERROR `None` is not assignable to attribute `rules` with type `Never` [bad-assignment]
- --> services/dataset_service.py:2805:51
+ --> services/dataset_service.py:2806:51
ERROR Class member `DocumentIndexingTaskProxy.NORMAL_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
--> services/document_indexing_proxy/document_indexing_task_proxy.py:11:5
ERROR Class member `DocumentIndexingTaskProxy.PRIORITY_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
@@ -1004,9 +1004,9 @@
ERROR Argument `Literal['knowledge']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_dataset_service_retrieval.py:179: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_update_dataset.py:28:20
+ --> tests/test_containers_integration_tests/services/test_dataset_service_update_dataset.py:29: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_update_dataset.py:33:61
+ --> tests/test_containers_integration_tests/services/test_dataset_service_update_dataset.py:34:61
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_end_user_service.py:37: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]
@@ -6174,13 +6174,13 @@
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/models/test_app_models.py:1459:20
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/models/test_dataset_models.py:147:16
-ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/models/test_dataset_models.py:148:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/models/test_dataset_models.py:149:16
ERROR `in` is not supported between `Literal['pre_processing_rules']` and `None` [not-iterable]
- --> tests/unit_tests/models/test_dataset_models.py:823:16
+ --> tests/unit_tests/models/test_dataset_models.py:842:16
ERROR `in` is not supported between `Literal['segmentation']` and `None` [not-iterable]
- --> tests/unit_tests/models/test_dataset_models.py:824:16
+ --> tests/unit_tests/models/test_dataset_models.py:843:16
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModel.__init__` [bad-argument-type]
--> tests/unit_tests/models/test_provider_models.py:296:24
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModel.__init__` [bad-argument-type]
@@ -6409,37 +6409,37 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_dataset.py:377:25
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:665:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:694:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:675:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:704:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:714:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:743:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:737:74
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:766:74
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:804:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:833:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:842:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:871:9
ERROR Argument `None` is not assignable to parameter `embedding_model_provider` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:908:38
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:937:38
ERROR Argument `None` is not assignable to parameter `embedding_model` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:909:29
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:938:29
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:967:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:996:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1002:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1031:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1410:67
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1439:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1413:81
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1442:81
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1426:67
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1455:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1439:71
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1468:71
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1498:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1527:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1520:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1549:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.dataset_service.DocumentService.prepare_document_batch_download_zip` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_document.py:340:34
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.dataset_service.DocumentService.prepare_document_batch_download_zip` [bad-argument-type]
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34734 +/- ##
=======================================
Coverage 83.90% 83.91%
=======================================
Files 4190 4190
Lines 177214 177218 +4
Branches 35454 35454
=======================================
+ Hits 148699 148708 +9
+ Misses 25622 25615 -7
- Partials 2893 2895 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
QuantumGhost
reviewed
Apr 9, 2026
QuantumGhost
reviewed
Apr 9, 2026
Contributor
QuantumGhost
left a comment
There was a problem hiding this comment.
Is it better to add some integration tests for the relevant changes?
Other changes LGTM.
17127b1 to
f4b202c
Compare
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-10 11:20:36.834275427 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-10 11:20:27.178162333 +0000
@@ -324,11 +324,11 @@
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 `dict[str, bool | 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:2117:56
+ --> services/dataset_service.py:2119:56
ERROR `dict[str, bool | 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:2630:44
+ --> services/dataset_service.py:2632:44
ERROR `None` is not assignable to attribute `rules` with type `Never` [bad-assignment]
- --> services/dataset_service.py:2805:51
+ --> services/dataset_service.py:2807:51
ERROR Class member `DocumentIndexingTaskProxy.NORMAL_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
--> services/document_indexing_proxy/document_indexing_task_proxy.py:11:5
ERROR Class member `DocumentIndexingTaskProxy.PRIORITY_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
@@ -996,9 +996,9 @@
ERROR Argument `Literal['knowledge']` is not assignable to parameter `type` with type `SQLCoreOperations[TagType] | TagType` in function `models.model.Tag.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_dataset_service_retrieval.py:179: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_update_dataset.py:28:20
+ --> tests/test_containers_integration_tests/services/test_dataset_service_update_dataset.py:29: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_update_dataset.py:33:61
+ --> tests/test_containers_integration_tests/services/test_dataset_service_update_dataset.py:34:61
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_end_user_service.py:37: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]
@@ -6182,13 +6182,13 @@
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/models/test_app_models.py:1459:20
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/models/test_dataset_models.py:147:16
-ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/models/test_dataset_models.py:148:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/models/test_dataset_models.py:149:16
ERROR `in` is not supported between `Literal['pre_processing_rules']` and `None` [not-iterable]
- --> tests/unit_tests/models/test_dataset_models.py:823:16
+ --> tests/unit_tests/models/test_dataset_models.py:842:16
ERROR `in` is not supported between `Literal['segmentation']` and `None` [not-iterable]
- --> tests/unit_tests/models/test_dataset_models.py:824:16
+ --> tests/unit_tests/models/test_dataset_models.py:843:16
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModel.__init__` [bad-argument-type]
--> tests/unit_tests/models/test_provider_models.py:296:24
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModel.__init__` [bad-argument-type]
@@ -6417,37 +6417,37 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_dataset.py:377:25
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:665:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:694:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:675:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:704:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:714:70
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:743:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:737:74
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:766:74
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:804:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:833:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:842:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:871:9
ERROR Argument `None` is not assignable to parameter `embedding_model_provider` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:908:38
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:937:38
ERROR Argument `None` is not assignable to parameter `embedding_model` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:909:29
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:938:29
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:967:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:996:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1002:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1031:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1410:67
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1439:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1413:81
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1442:81
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1426:67
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1455:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1439:71
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1468:71
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1498:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1527:9
ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_dataset.py:1520:9
+ --> tests/unit_tests/services/test_dataset_service_dataset.py:1549:9
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.dataset_service.DocumentService.prepare_document_batch_download_zip` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_document.py:340:34
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.dataset_service.DocumentService.prepare_document_batch_download_zip` [bad-argument-type]
|
QuantumGhost
approved these changes
Apr 13, 2026
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #
Summary
This PR closes the cross-tenant authorization gap for external dataset knowledge bindings.
external_knowledge_api_idagainst the dataset tenant before updating external dataset bindingstenant_idin retrieval and dataset detail paths so mismatched bindings fail closedexternal_knowledge_infoScreenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods