refactor(api): replace SimpleNamespace with typed mocks in 5 test files 🤖🤖🤖#34872
Open
jeanibarz wants to merge 2 commits intolanggenius:mainfrom
Open
refactor(api): replace SimpleNamespace with typed mocks in 5 test files 🤖🤖🤖#34872jeanibarz wants to merge 2 commits intolanggenius:mainfrom
jeanibarz wants to merge 2 commits intolanggenius:mainfrom
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-10 11:26:33.662885512 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-10 11:26:25.475935175 +0000
@@ -1,7 +1,7 @@
ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
--> controllers/console/app/app.py:561:13
ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
- --> controllers/console/auth/email_register.py:75:108
+ --> controllers/console/auth/email_register.py:78:108
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/init_validate.py:31:2
ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
@@ -38,26 +38,6 @@
--> core/llm_generator/llm_generator.py:394:60
ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[SystemPromptMessage | UserPromptMessage], model_parameters=dict[str, float], stream=Literal[False]) [no-matching-overload]
--> core/llm_generator/llm_generator.py:582:60
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:172:17
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:197:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:217:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:239:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:256:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:281:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:309:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:328:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:344:13
-ERROR Missing positional argument `function` in function `ModelInstance._round_robin_invoke` [bad-argument-count]
- --> core/model_manager.py:361:13
ERROR Argument `dict[str, list[str] | str | None]` is not assignable to parameter `attributes` with type `dict[str, str] | None` in function `mlflow.tracing.fluent.start_span_no_context` [bad-argument-type]
--> core/ops/mlflow_trace/mlflow_trace.py:271:24
ERROR Argument `dict[str, dict[str, Any] | str | None]` is not assignable to parameter `attributes` with type `dict[str, str] | None` in function `mlflow.tracing.fluent.start_span_no_context` [bad-argument-type]
@@ -142,22 +122,24 @@
--> core/rag/datasource/vdb/elasticsearch/elasticsearch_vector.py:355:40
ERROR Unpacked keyword argument `bool | Unknown | None` is not assignable to parameter `max_retries` with type `Decimal | bool | bytes | float | int | str` in function `ElasticSearchConfig.__init__` [bad-argument-type]
--> core/rag/datasource/vdb/elasticsearch/elasticsearch_vector.py:355:40
+ERROR `tuple[str, str]` is not assignable to TypedDict key `basic_auth` with type `bool | int | list[str]` [bad-typed-dict-key]
+ --> core/rag/datasource/vdb/huawei/huawei_cloud_vector.py:51:36
ERROR Class member `LindormVectorStore.add_texts` overrides parent class `BaseVector` in an inconsistent manner [bad-override]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:93:9
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:84:9
ERROR `str | None` is not assignable to TypedDict key `routing` with type `str` [bad-typed-dict-key]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:142:57
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:133:57
ERROR Object of class `NoneType` has no attribute `get` [missing-attribute]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:392:35
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:383:35
ERROR `None` is not subscriptable [unsupported-operation]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:395:29
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:386:29
ERROR `None` is not subscriptable [unsupported-operation]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:396:30
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:387:30
ERROR `None` is not subscriptable [unsupported-operation]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:397:33
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:388:33
ERROR `None` is not subscriptable [unsupported-operation]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:398:33
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:389:33
ERROR `None` is not subscriptable [unsupported-operation]
- --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:401:30
+ --> core/rag/datasource/vdb/lindorm/lindorm_vector.py:392:30
ERROR Cannot index into `Coroutine[Unknown, Unknown, Unknown]` [bad-index]
--> core/rag/datasource/vdb/milvus/milvus_vector.py:96:50
ERROR Argument `dict[Unknown, Unknown] | str` is not assignable to parameter `version` with type `str` in function `packaging.version.parse` [bad-argument-type]
@@ -166,10 +148,12 @@
--> core/rag/datasource/vdb/oceanbase/oceanbase_vector.py:160:28
ERROR Class member `OceanBaseVector.add_texts` overrides parent class `BaseVector` in an inconsistent manner [bad-override]
--> core/rag/datasource/vdb/oceanbase/oceanbase_vector.py:240:9
+ERROR `tuple[Never, Never]` is not assignable to TypedDict key `http_auth` with type `type[Urllib3HttpConnection] | bool | int | list[dict[str, int | str]]` [bad-typed-dict-key]
+ --> core/rag/datasource/vdb/opensearch/opensearch_vector.py:72:35
ERROR Class member `OpenSearchVector.add_texts` overrides parent class `BaseVector` in an inconsistent manner [bad-override]
- --> core/rag/datasource/vdb/opensearch/opensearch_vector.py:110:9
+ --> core/rag/datasource/vdb/opensearch/opensearch_vector.py:95:9
ERROR `dict[str, dict[Field | str, list[float] | Any]]` is not assignable to TypedDict key with type `dict[Field, dict[Field | str, list[float] | Any]]` [bad-typed-dict-key]
- --> core/rag/datasource/vdb/opensearch/opensearch_vector.py:204:33
+ --> core/rag/datasource/vdb/opensearch/opensearch_vector.py:189:33
ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, str | None]) [no-matching-overload]
--> core/rag/datasource/vdb/oracle/oraclevector.py:139:31
ERROR Function declared to return `bool`, but one or more paths are missing an explicit `return` [bad-return]
@@ -286,17 +270,17 @@
ERROR Object of class `BaseOxmlElement` has no attribute `body` [missing-attribute]
--> core/rag/extractor/word_extractor.py:426:24
ERROR Object of class `Document` has no attribute `score` [missing-attribute]
- --> core/rag/index_processor/processor/paragraph_index_processor.py:203:33
+ --> core/rag/index_processor/processor/paragraph_index_processor.py:198:33
ERROR Object of class `Document` has no attribute `score` [missing-attribute]
- --> core/rag/index_processor/processor/paragraph_index_processor.py:204:16
+ --> core/rag/index_processor/processor/paragraph_index_processor.py:199:16
ERROR Object of class `Document` has no attribute `score` [missing-attribute]
- --> core/rag/index_processor/processor/parent_child_index_processor.py:245:33
+ --> core/rag/index_processor/processor/parent_child_index_processor.py:239:33
ERROR Object of class `Document` has no attribute `score` [missing-attribute]
- --> core/rag/index_processor/processor/parent_child_index_processor.py:246:16
+ --> core/rag/index_processor/processor/parent_child_index_processor.py:240:16
ERROR Object of class `Document` has no attribute `score` [missing-attribute]
- --> core/rag/index_processor/processor/qa_index_processor.py:209:33
+ --> core/rag/index_processor/processor/qa_index_processor.py:204:33
ERROR Object of class `Document` has no attribute `score` [missing-attribute]
- --> core/rag/index_processor/processor/qa_index_processor.py:210:16
+ --> core/rag/index_processor/processor/qa_index_processor.py:205:16
ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[SystemPromptMessage | UserPromptMessage], tools=list[PromptMessageTool], stream=Literal[False], model_parameters=dict[str, float | int]) [no-matching-overload]
--> core/rag/retrieval/router/multi_dataset_function_call_router.py:32:58
ERROR Class member `MCPToolProviderController.entity` overrides parent class `ToolProviderController` in an inconsistent manner [bad-override]
@@ -316,7 +300,7 @@
ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None, socket_timeout=Literal[5], socket_connect_timeout=Literal[5], health_check_interval=Literal[30]) [no-matching-overload]
--> schedule/queue_monitor_task.py:14:21
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
- --> services/account_service.py:1154:13
+ --> services/account_service.py:1153:13
ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
--> services/audio_service.py:144:56
ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
@@ -1089,10 +1073,6 @@
--> tests/test_containers_integration_tests/services/test_model_provider_service.py:149:24
ERROR Argument `str` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_model_provider_service.py:187:24
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_ops_service.py:59:13
-ERROR Argument `dict[Unknown, Unknown] | object | None` is not assignable to parameter `tracing_config` with type `SQLCoreOperations[dict[Unknown, Unknown] | None] | dict[Unknown, Unknown] | None` in function `models.model.TraceAppConfig.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_ops_service.py:84:28
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/test_containers_integration_tests/services/test_recommended_app_service.py:198:16
ERROR `None` is not subscriptable [unsupported-operation]
@@ -1186,9 +1166,9 @@
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_webapp_auth_service.py:142:20
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_webapp_auth_service.py:345:20
+ --> tests/test_containers_integration_tests/services/test_webapp_auth_service.py:346: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_webapp_auth_service.py:715:20
+ --> tests/test_containers_integration_tests/services/test_webapp_auth_service.py:717:20
ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_webhook_service.py:288:88
ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
@@ -3213,28 +3193,6 @@
--> tests/unit_tests/core/app/features/rate_limiting/test_rate_limit.py:448:9
ERROR Argument `Mapping[str, Any] | RateLimitGenerator` is not assignable to parameter `i` with type `SupportsNext[@_]` in function `next` [bad-argument-type]
--> tests/unit_tests/core/app/features/rate_limiting/test_rate_limit.py:451:18
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:17:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:18:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:34:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:35:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:77:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:78:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:124:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:125:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:155:32
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:156:29
-ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `prompt_messages` with type `list[PromptMessage]` in function `core.app.features.hosting_moderation.hosting_moderation.HostingModerationFeature.check` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_hosting_moderation.py:23:65
ERROR Argument `object` is not assignable to parameter `event` with type `GraphEngineEvent` in function `core.app.layers.suspend_layer.SuspendLayer.on_event` [bad-argument-type]
--> tests/unit_tests/core/app/layers/test_suspend_layer.py:19:24
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
@@ -6290,7 +6248,7 @@
ERROR Argument `None` is not assignable to parameter `response` with type `Response` in function `httpx._exceptions.HTTPStatusError.__init__` [bad-argument-type]
--> tests/unit_tests/services/enterprise/test_plugin_manager_service.py:61:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `metadata_condition` with type `MetadataFilteringCondition | None` in function `services.external_knowledge_service.ExternalDatasetService.fetch_external_knowledge_retrieval` [bad-argument-type]
- --> tests/unit_tests/services/external_dataset_service.py:852:36
+ --> tests/unit_tests/services/external_dataset_service.py:851:36
ERROR Cannot index into `list[Unknown]` [bad-index]
--> tests/unit_tests/services/hit_service.py:430:20
ERROR Cannot index into `object` [bad-index]
@@ -6483,31 +6441,31 @@
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/services/test_dataset_service_document.py:1070:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_document.py:1201:72
+ --> tests/unit_tests/services/test_dataset_service_document.py:1174:72
ERROR `SimpleNamespace` is not assignable to attribute `process_rule` with type `ProcessRule | None` [bad-assignment]
- --> tests/unit_tests/services/test_dataset_service_document.py:1206:41
+ --> tests/unit_tests/services/test_dataset_service_document.py:1179:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset_process_rule` with type `DatasetProcessRule | None` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_document.py:1245:38
+ --> tests/unit_tests/services/test_dataset_service_document.py:1218:38
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset_process_rule` with type `DatasetProcessRule | None` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_document.py:1325:38
+ --> tests/unit_tests/services/test_dataset_service_document.py:1298:38
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset_process_rule` with type `DatasetProcessRule | None` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_document.py:1376:38
+ --> tests/unit_tests/services/test_dataset_service_document.py:1349:38
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:1530:70
+ --> tests/unit_tests/services/test_dataset_service_document.py:1503:70
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:1557:65
+ --> tests/unit_tests/services/test_dataset_service_document.py:1530:65
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:1580:65
+ --> tests/unit_tests/services/test_dataset_service_document.py:1553:65
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:1595:65
+ --> tests/unit_tests/services/test_dataset_service_document.py:1568:65
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:1630:70
+ --> tests/unit_tests/services/test_dataset_service_document.py:1603:70
ERROR Object of class `NoneType` has no attribute `rules` [missing-attribute]
- --> tests/unit_tests/services/test_dataset_service_document.py:1929:22
+ --> tests/unit_tests/services/test_dataset_service_document.py:1902:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset_process_rule` with type `DatasetProcessRule | None` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_document.py:2043:42
+ --> tests/unit_tests/services/test_dataset_service_document.py:2016:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset_process_rule` with type `DatasetProcessRule | None` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_document.py:2066:42
+ --> tests/unit_tests/services/test_dataset_service_document.py:2039:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `knowledge_config` with type `KnowledgeConfig` in function `services.dataset_service.DocumentService.save_document_with_dataset_id` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_lock_not_owned.py:103:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.SegmentService.create_child_chunk` [bad-argument-type]
@@ -6559,9 +6517,9 @@
ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
--> tests/unit_tests/services/test_external_dataset_service.py:880:31
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/services/test_external_dataset_service.py:1421:16
+ --> tests/unit_tests/services/test_external_dataset_service.py:1417:16
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/services/test_external_dataset_service.py:1422:16
+ --> tests/unit_tests/services/test_external_dataset_service.py:1418:16
ERROR Argument `Literal['invalid']` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown] | None` in function `services.file_service.FileService.__init__` [bad-argument-type]
--> tests/unit_tests/services/test_file_service.py:48:41
ERROR `in` is not supported between `Literal['form_id=test-form']` and `None` [not-iterable]
@@ -6632,6 +6590,14 @@
--> tests/unit_tests/services/test_model_load_balancing_service.py:673:37
ERROR `(tenant_id: str) -> service_with_fake_configurations._FakeProviderManager` is not assignable to attribute `_get_provider_manager` with type `(tenant_id: str) -> ProviderManager` [bad-assignment]
--> tests/unit_tests/services/test_model_provider_service_sanitization.py:74:33
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/services/test_ops_service.py:87:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/services/test_ops_service.py:112:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/services/test_ops_service.py:134:16
+ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/services/test_ops_service.py:156:16
ERROR Argument `Literal['']` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
--> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:409:109
ERROR Argument `None` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
@@ -6742,26 +6708,6 @@
--> tests/unit_tests/services/workflow/test_workflow_converter_additional.py:773:15
ERROR Argument `dict[str, list[dict[str, dict[str, str | Unknown] | str | Unknown | None]] | list[Unknown]]` is not assignable to parameter `graph` with type `WorkflowGraph` in function `services.workflow.workflow_converter.WorkflowConverter._append_node` [bad-argument-type]
--> tests/unit_tests/services/workflow/test_workflow_converter_additional.py:797:44
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:70:23
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:71:21
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:104:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:105:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:140:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:141:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:179:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:180:17
-ERROR Argument `dict[str, dict[str, bool | str] | dict[str, bool] | dict[str, dict[str, bool | int | list[str]]] | list[Unknown] | str]` is not assignable to parameter `features` with type `dict[str, object]` in function `_create_workflow` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_restore.py:62:18
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_restore.apply_published_workflow_snapshot_to_draft` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_restore.py:70:17
ERROR Object of class `FunctionType` has no attribute `reset_mock` [missing-attribute]
--> tests/unit_tests/tasks/test_dataset_indexing_task.py:64:5
ERROR Object of class `FunctionType` has no attribute `reset_mock` [missing-attribute]
|
This was referenced Apr 10, 2026
Part of langgenius#34636 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51deea0 to
7dfda6c
Compare
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-17 17:46:20.611802451 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-17 17:46:09.481670776 +0000
@@ -3582,28 +3582,6 @@
--> tests/unit_tests/core/app/features/rate_limiting/test_rate_limit.py:448:9
ERROR Argument `Mapping[str, Any] | RateLimitGenerator` is not assignable to parameter `i` with type `SupportsNext[@_]` in function `next` [bad-argument-type]
--> tests/unit_tests/core/app/features/rate_limiting/test_rate_limit.py:451:18
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:17:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:18:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:34:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:35:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:77:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:78:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:124:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:125:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:155:32
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:156:29
-ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `prompt_messages` with type `list[PromptMessage]` in function `core.app.features.hosting_moderation.hosting_moderation.HostingModerationFeature.check` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_hosting_moderation.py:23:65
ERROR Argument `object` is not assignable to parameter `event` with type `GraphEngineEvent` in function `core.app.layers.suspend_layer.SuspendLayer.on_event` [bad-argument-type]
--> tests/unit_tests/core/app/layers/test_suspend_layer.py:18:24
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
@@ -6391,26 +6369,6 @@
--> tests/unit_tests/services/workflow/test_workflow_converter_additional.py:773:15
ERROR Argument `dict[str, list[dict[str, dict[str, str | Unknown] | str | Unknown | None]] | list[Unknown]]` is not assignable to parameter `graph` with type `WorkflowGraph` in function `services.workflow.workflow_converter.WorkflowConverter._append_node` [bad-argument-type]
--> tests/unit_tests/services/workflow/test_workflow_converter_additional.py:797:44
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:70:23
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:71:21
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:104:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:105:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:140:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:141:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:179:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:180:17
-ERROR Argument `dict[str, dict[str, bool | str] | dict[str, bool] | dict[str, dict[str, bool | int | list[str]]] | list[Unknown] | str]` is not assignable to parameter `features` with type `dict[str, object]` in function `_create_workflow` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_restore.py:62:18
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_restore.apply_published_workflow_snapshot_to_draft` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_restore.py:70:17
ERROR Object of class `FunctionType` has no attribute `reset_mock` [missing-attribute]
--> tests/unit_tests/tasks/test_dataset_indexing_task.py:64:5
ERROR Object of class `FunctionType` has no attribute `reset_mock` [missing-attribute]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-17 17:48:14.485372410 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-17 17:48:03.588167883 +0000
@@ -3582,28 +3582,6 @@
--> tests/unit_tests/core/app/features/rate_limiting/test_rate_limit.py:448:9
ERROR Argument `Mapping[str, Any] | RateLimitGenerator` is not assignable to parameter `i` with type `SupportsNext[@_]` in function `next` [bad-argument-type]
--> tests/unit_tests/core/app/features/rate_limiting/test_rate_limit.py:451:18
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:17:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:18:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:34:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:35:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:77:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:78:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:124:28
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:125:25
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_record` with type `App` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:155:32
-ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.features.annotation_reply.annotation_reply.AnnotationReplyFeature.query` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_annotation_reply.py:156:29
-ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `prompt_messages` with type `list[PromptMessage]` in function `core.app.features.hosting_moderation.hosting_moderation.HostingModerationFeature.check` [bad-argument-type]
- --> tests/unit_tests/core/app/features/test_hosting_moderation.py:23:65
ERROR Argument `object` is not assignable to parameter `event` with type `GraphEngineEvent` in function `core.app.layers.suspend_layer.SuspendLayer.on_event` [bad-argument-type]
--> tests/unit_tests/core/app/layers/test_suspend_layer.py:18:24
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
@@ -6391,26 +6369,6 @@
--> tests/unit_tests/services/workflow/test_workflow_converter_additional.py:773:15
ERROR Argument `dict[str, list[dict[str, dict[str, str | Unknown] | str | Unknown | None]] | list[Unknown]]` is not assignable to parameter `graph` with type `WorkflowGraph` in function `services.workflow.workflow_converter.WorkflowConverter._append_node` [bad-argument-type]
--> tests/unit_tests/services/workflow/test_workflow_converter_additional.py:797:44
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:70:23
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:71:21
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:104:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:105:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:140:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:141:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:179:19
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_service.WorkflowService.test_human_input_delivery` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_human_input_delivery.py:180:17
-ERROR Argument `dict[str, dict[str, bool | str] | dict[str, bool] | dict[str, dict[str, bool | int | list[str]]] | list[Unknown] | str]` is not assignable to parameter `features` with type `dict[str, object]` in function `_create_workflow` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_restore.py:62:18
-ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.workflow_restore.apply_published_workflow_snapshot_to_draft` [bad-argument-type]
- --> tests/unit_tests/services/workflow/test_workflow_restore.py:70:17
ERROR Object of class `FunctionType` has no attribute `reset_mock` [missing-attribute]
--> tests/unit_tests/tasks/test_dataset_indexing_task.py:64:5
ERROR Object of class `FunctionType` has no attribute `reset_mock` [missing-attribute]
|
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.
Summary
SimpleNamespacewithMock(spec=App),Mock(spec=Message),Mock(spec=Account),Mock(spec=PromptMessage), and realModuleExtensioninstances across 5 test files to fix pyreflybad-argument-typeerrors_make_app()/_make_message()/_make_account()helpers to reduce repetitiontest_workflow_restore.pyto fix a pre-existing pyreflybad-argument-typeerrorPart of #34636
Files changed
test_annotation_reply.pyMock(spec=App),Mock(spec=Message),Mock()test_hosting_moderation.pyMock(spec=PromptMessage),Mock()test_workflow_human_input_delivery.pyMock(spec=App),Mock(spec=Account)test_workflow_restore.pyMock(spec=Account)test_code_based_extension_service.pyModuleExtension(...)(real instances)Test plan
pyrefly checkreports 0 errors on all 5 filespytest -v)ruff checkandruff formatpassCo-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com