fix(api): strip leftover type/config when sensitive-word avoidance is disabled#38338
Open
SquabbyZ wants to merge 1 commit into
Open
fix(api): strip leftover type/config when sensitive-word avoidance is disabled#38338SquabbyZ wants to merge 1 commit into
SquabbyZ wants to merge 1 commit into
Conversation
… disabled
When a chat request carries {"sensitive_word_avoidance": {"enabled": false,
"type": "", "config": {}}}, the existing _normalize_raw() in
core/app/app_config/common/sensitive_word_avoidance/manager.py falls
through every branch: enabled is not None (it's False), enabled is not
True, so the leftover type/config fields are passed straight through to
the discriminator-tagged union.
SensitiveWordAvoidanceDisabledConfig is declared with extra="forbid",
so pydantic raises ValidationError("Extra inputs are not permitted:
type, config") and the API returns HTTP 400 invalid_param — which
matches the trace in issue langgenius#38327.
This change extends _normalize_raw() to drop every key other than
"enabled" when enabled is False, matching the intent of the disabled
schema (only enabled matters). Two new parametrize cases cover the
regression: one with empty leftover fields and one with non-empty
leftover fields, asserting that the call now succeeds and the result
stays {enabled: False}.
diff --stat:
api/core/app/app_config/common/sensitive_word_avoidance/manager.py | 6 ++++++
api/tests/unit_tests/core/app/app_config/common/test_sensitive_word_avoidance_manager.py | 5 +++++
2 files changed, 11 insertions(+)
Generated via peaks-loop (session 2026-07-02-session-95565c, request
2026-07-02-fix-sensitive-word-avoidance-disabled). Red-line scope was
limited to the sensitive_word_avoidance/manager.py module and the
matching parametrize list in its unit-test file.
Member
|
Thanks for the contribution. Before we review this PR, please open an issue first to describe the problem, expected behavior, and proposed approach, then link that issue here. This helps us confirm the scope and align on the fix before moving forward. |
6 tasks
Contributor
Author
|
@crazywoola Thanks for the guidance. Opened issue #38409 describing the chat API HTTP 400 |
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-07-04 09:35:42.003177150 +0000
+++ /tmp/pyrefly_pr.txt 2026-07-04 09:35:26.861136817 +0000
@@ -724,12 +724,10 @@
--> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:593:23
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:603:23
-ERROR Argument `core.workflow.nodes.human_input.entities.HumanInputNodeData` is not assignable to parameter `data` with type `graphon.nodes.human_input.entities.HumanInputNodeData` in function `graphon.nodes.human_input.human_input_node.HumanInputNode.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:126:14
ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_execution_repository.SQLAlchemyWorkflowExecutionRepository.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:269:29
+ --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:265:29
ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_node_execution_repository.SQLAlchemyWorkflowNodeExecutionRepository.__init__` [bad-argument-type]
- --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:275:29
+ --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:271:29
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/helpers/execution_extra_content.py:48:14
ERROR Returned type `int | str` is not assignable to declared return type `str` [bad-return]
@@ -747,9 +745,9 @@
ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:122:70
ERROR Class member `_TestWorkflowRunRepository.save` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:45:9
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:44:9
ERROR Generator function should return `Generator` [bad-return]
- --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:139:56
+ --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:138:56
ERROR Argument `str | None` is not assignable to parameter `tenant_id` with type `str` in function `_create_node_execution_model` [bad-argument-type]
--> tests/test_containers_integration_tests/repositories/test_sqlalchemy_workflow_node_execution_repository.py:181:23
ERROR Argument `str | None` is not assignable to parameter `tenant_id` with type `str` in function `_create_node_execution_model` [bad-argument-type]
@@ -883,19 +881,19 @@
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_app_generate_service.py:190:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:489:23
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:449:23
ERROR Argument `Literal['invalid_mode']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:568:20
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:518:20
ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:811:64
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:736:64
ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:838:64
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:763:64
ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:864:68
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:789:68
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:914:23
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:834:23
ERROR Argument `Literal['agent-chat']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_app_generate_service.py:1050:20
+ --> tests/test_containers_integration_tests/services/test_app_generate_service.py:960:20
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_app_service.py:87:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1862,10 +1860,6 @@
--> tests/unit_tests/commands/test_clean_expired_messages.py:94:9
ERROR Expected a callable, got `None` [not-callable]
--> tests/unit_tests/commands/test_clean_expired_messages.py:176:9
-ERROR Object of class `object` has no attribute `package` [missing-attribute]
- --> tests/unit_tests/commands/test_data_migration_commands.py:182:12
-ERROR Object of class `object` has no attribute `options_override` [missing-attribute]
- --> tests/unit_tests/commands/test_data_migration_commands.py:183:12
ERROR `(self: list[Unknown], object: Unknown, /) -> None` is not assignable to attribute `echo` with type `(message: Any | None = None, file: IO[Any] | None = None, nl: bool = True, err: bool = False, color: bool | None = None) -> None` [bad-assignment]
--> tests/unit_tests/commands/test_data_migration_wizard.py:142:33
ERROR Generator function should return `Generator` [bad-return]
@@ -1919,75 +1913,75 @@
ERROR No attribute `MethodView` in module `builtins` [missing-attribute]
--> tests/unit_tests/controllers/common/test_fields.py:8:5
ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:664:12
+ERROR Cannot index into `object` [bad-index]
--> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:665:12
ERROR Cannot index into `object` [bad-index]
--> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:666:12
ERROR Cannot index into `object` [bad-index]
--> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:667:12
-ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:668:12
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_build_chat_finalization_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1436:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1429:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_build_chat_finalization_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1437:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1430:23
ERROR Argument `test_drain_streaming_generate_response_returns_on_message_end.ClosableResponse` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1484:69
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1476:69
ERROR Argument `Iterator[Any]` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1492:66
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1484:66
ERROR Argument `Iterator[Any]` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1499:66
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1491:66
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1530:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1521:74
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1531:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1521:98
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1570:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1558:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1571:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1559:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1599:22
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1586:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1600:19
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1587:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1605:22
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1592:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._resolve_current_user_agent_debug_conversation_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1606:19
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1593:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1657:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1644:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1658:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1645:27
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1741:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1727:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1742:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1728:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1743:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1729:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1755:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1741:67
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1781:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1767:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1782:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1768:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1783:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1769:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1797:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1783:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account | None` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1797:91
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1783:91
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1817:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1803:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account | None` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1818:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1804:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1833:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1819:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1834:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1820:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1870:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1856:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1871:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1857:23
ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1872:24
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1858:24
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:38
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -2003,19 +1997,19 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.conversation._get_conversation` [bad-argument-type]
--> tests/unit_tests/controllers/console/app/test_conversation_api.py:105:47
ERROR Missing argument `app_model` in function `handler` [missing-argument]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:41:19
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:104:19
ERROR Unexpected keyword argument `app_id` in function `handler` [unexpected-keyword]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:41:20
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:104:20
ERROR Missing argument `app_model` in function `handler` [missing-argument]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:54:16
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:117:16
ERROR Unexpected keyword argument `app_id` in function `handler` [unexpected-keyword]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:54:17
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:117:17
ERROR Missing argument `app_model` in function `handler` [missing-argument]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:63:16
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:126:16
ERROR Missing argument `app_model` in function `Handler.get` [missing-argument]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:85:25
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:148:25
ERROR Unexpected keyword argument `app_id` in function `Handler.get` [unexpected-keyword]
- --> tests/unit_tests/controllers/console/app/test_wraps.py:85:35
+ --> tests/unit_tests/controllers/console/app/test_wraps.py:148:26
ERROR Cannot set item in `OrderedDict[str, bool | list[str] | str]` [unsupported-operation]
--> tests/unit_tests/controllers/console/app/workflow_draft_variables_test.py:137:47
ERROR `None` is not subscriptable [unsupported-operation]
@@ -2247,9 +2241,9 @@
ERROR Object of class `NoneType` has no attribute `total_tokens` [missing-attribute]
--> tests/unit_tests/controllers/openapi/test_models.py:13:12
ERROR Argument `test_verify_approval_grant_raises_on_missing_field._FakeKeyset` is not assignable to parameter `keyset` with type `KeySet` in function `libs.jws.sign` [bad-argument-type]
- --> tests/unit_tests/controllers/openapi/test_oauth_sso_claims.py:69:9
+ --> tests/unit_tests/controllers/openapi/test_oauth_sso_claims.py:67:9
ERROR Argument `test_verify_approval_grant_raises_on_missing_field._FakeKeyset` is not assignable to parameter `keyset` with type `KeySet` in function `libs.device_flow_security.verify_approval_grant` [bad-argument-type]
- --> tests/unit_tests/controllers/openapi/test_oauth_sso_claims.py:75:52
+ --> tests/unit_tests/controllers/openapi/test_oauth_sso_claims.py:73:52
ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
--> tests/unit_tests/controllers/openapi/test_workspaces.py:38:12
ERROR `in` is not supported between `Literal['GET']` and `None` [not-iterable]
@@ -2284,14 +2278,6 @@
--> tests/unit_tests/controllers/service_api/app/test_audio.py:186:16
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_completion.py:152:20
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_completion.py:252:45
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_completion.py:264:40
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_completion.py:274:40
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_completion.py:284:40
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_conversation.py:82:35
ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
@@ -2301,27 +2287,27 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AdvancedChatAppGenerateEntity | WorkflowAppGenerateEntity` in function `core.app.apps.common.workflow_response_converter.WorkflowResponseConverter.__init__` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:99:37
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `WorkflowSnapshot` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:435:22
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:434:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:436:27
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:435:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `ConversationSnapshot` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:437:26
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:436:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `MessageSnapshot` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:438:21
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:437:21
ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:448:37
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:447:37
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:528:22
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:527:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:529:27
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:528:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | EndUser` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:530:18
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:529:18
ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:532:37
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:531:37
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.app.apps.common.workflow_response_converter.WorkflowResponseConverter.workflow_pause_to_stream_response` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:628:33
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:627:33
ERROR Argument `() -> TestHitlServiceApi.test_snapshot_events_include_pause_payload_contract._SessionContext` is not assignable to parameter `session_maker` with type `sessionmaker[Session] | None` in function `services.workflow_event_snapshot_service._build_snapshot_events` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:703:27
+ --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:702:27
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_message.py:90:63
ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
@@ -2348,14 +2334,6 @@
--> tests/unit_tests/controllers/service_api/app/test_workflow.py:239:16
ERROR Object of class `dict` has no attribute `limit` [missing-attribute]
--> tests/unit_tests/controllers/service_api/app/test_workflow.py:240:16
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:270:45
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:287:40
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:301:40
-ERROR Missing argument `session` in function `services.app_generate_service.AppGenerateService.generate` [missing-argument]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:315:45
ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
--> tests/unit_tests/controllers/service_api/app/test_workflow.py:367:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunStatusField.output` [bad-argument-type]
@@ -2548,78 +2526,44 @@
--> tests/unit_tests/core/agent/test_cot_agent_runner.py:24:9
ERROR `None` is not assignable to attribute `agent_callback` with type `DifyAgentCallbackHandler` [bad-assignment]
--> tests/unit_tests/core/agent/test_cot_agent_runner.py:80:29
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:83:5
ERROR Missing required key `action` for TypedDict `ActionDict` [bad-typed-dict-key]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:113:44
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:112:44
ERROR Missing required key `action_input` for TypedDict `ActionDict` [bad-typed-dict-key]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:113:44
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:112:44
ERROR Key `invalid` is not defined in TypedDict `ActionDict` [bad-typed-dict-key]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:113:45
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:167:55
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:180:55
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:204:35
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:112:45
ERROR `None` is not assignable to attribute `agent_callback` with type `DifyAgentCallbackHandler` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:223:33
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:226:29
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:222:33
ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:229:9
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:228:9
ERROR `None` is not assignable to attribute `agent_callback` with type `DifyAgentCallbackHandler` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:245:33
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:248:29
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:259:35
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:244:33
ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:263:9
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:275:29
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:262:9
ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:280:9
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:279:9
ERROR `Literal[1]` is not assignable to attribute `prompt_price` with type `Decimal` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:286:32
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:285:32
ERROR `Literal[1]` is not assignable to attribute `completion_price` with type `Decimal` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:287:36
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:286:36
ERROR `Literal[2]` is not assignable to attribute `total_price` with type `Decimal` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:288:31
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:287:31
ERROR `Literal[1]` is not assignable to attribute `prompt_price` with type `Decimal` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:294:32
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:293:32
ERROR `Literal[1]` is not assignable to attribute `completion_price` with type `Decimal` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:295:36
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:294:36
ERROR `Literal[2]` is not assignable to attribute `total_price` with type `Decimal` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:296:31
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:324:35
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:343:35
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:357:25
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:295:31
ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:377:9
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:376:9
ERROR `None` is not assignable to attribute `agent_callback` with type `DifyAgentCallbackHandler` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:385:33
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:387:25
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:384:33
ERROR `list[str]` is not assignable to attribute `_agent_scratchpad` with type `list[AgentScratchpadUnit]` [bad-assignment]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:417:36
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:439:55
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:416:36
ERROR Object of class `FunctionType` has no attribute `assert_called` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:443:9
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:442:9
ERROR Class member `BadValue.__str__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:453:17
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:509:35
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:523:35
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:537:35
-ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_cot_agent_runner.py:552:35
+ --> tests/unit_tests/core/agent/test_cot_agent_runner.py:452:17
ERROR `list[DummyTool]` is not assignable to attribute `_prompt_messages_tools` with type `Sequence[PromptMessageTool]` [bad-assignment]
--> tests/unit_tests/core/agent/test_cot_chat_agent_runner.py:49:37
ERROR `DummyGenerateEntity` is not assignable to attribute `application_generate_entity` with type `AgentChatAppGenerateEntity` [bad-assignment]
@@ -2642,54 +2586,34 @@
--> tests/unit_tests/core/agent/test_fc_agent_runner.py:31:30
ERROR `Literal[0]` is not assignable to attribute `total_price` with type `Decimal` [bad-assignment]
--> tests/unit_tests/core/agent/test_fc_agent_runner.py:32:25
-ERROR Missing argument `session` in function `core.agent.base_agent_runner.BaseAgentRunner.__init__` [missing-argument]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:102:37
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:133:5
ERROR Argument `DummyChunk` is not assignable to parameter `llm_result_chunk` with type `LLMResultChunk` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner.check_tool_calls` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:153:40
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:152:40
ERROR Argument `DummyResult` is not assignable to parameter `llm_result` with type `LLMResult` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner.check_blocking_tool_calls` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:158:49
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:157:49
ERROR Argument `DummyChunk` is not assignable to parameter `llm_result_chunk` with type `LLMResultChunk` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner.extract_tool_calls` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:174:43
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:173:43
ERROR Argument `DummyChunk` is not assignable to parameter `llm_result_chunk` with type `LLMResultChunk` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner.extract_tool_calls` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:185:43
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:184:43
ERROR Argument `DummyResult` is not assignable to parameter `llm_result` with type `LLMResult` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner.extract_blocking_tool_calls` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:196:52
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:195:52
ERROR Argument `None` is not assignable to parameter `query` with type `str` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner._organize_user_query` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:232:46
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:300:35
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:231:46
ERROR Object of class `FunctionType` has no attribute `assert_called` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:302:9
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:301:9
ERROR Object of class `FunctionType` has no attribute `call_args_list` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:304:23
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:303:23
ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:312:57
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:319:35
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:311:57
ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:332:57
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:342:35
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:331:57
ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:348:46
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:353:35
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:347:46
ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:355:16
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:382:35
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:400:35
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:429:35
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:354:16
ERROR Object of class `FunctionType` has no attribute `call_args_list` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:435:25
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:434:25
ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:439:9
-ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:454:29
+ --> tests/unit_tests/core/agent/test_fc_agent_runner.py:438:9
ERROR Missing argument `description` in function `core.agent.plugin_entities.AgentStrategyEntity.__init__` [missing-argument]
--> tests/unit_tests/core/agent/test_plugin_entities.py:281:32
ERROR Invalid key for TypedDict `AppParametersDict`, got `Unknown` [bad-typed-dict-key]
@@ -3355,62 +3279,62 @@
--> tests/unit_tests/core/app/apps/chat/test_app_config_manager.py:35:34
ERROR Argument `dict[str, str]` is not assignable to parameter `override_config_dict` with type `AppModelConfigDict | None` in function `core.app.apps.chat.app_config_manager.ChatAppConfigManager.get_app_config` [bad-argument-type]
--> tests/unit_tests/core/app/apps/chat/test_app_config_manager.py:37:38
-ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (session=MagicMock, app_model=SimpleNamespace, user=SimpleNamespace, args=dict[str, dict[@_, @_]], invoke_from=Literal[InvokeFrom.SERVICE_API], streaming=Literal[False]) [no-matching-overload]
+ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (app_model=SimpleNamespace, user=SimpleNamespace, args=dict[str, dict[@_, @_]], invoke_from=Literal[InvokeFrom.SERVICE_API], streaming=Literal[False]) [no-matching-overload]
--> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:50:31
-ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (session=MagicMock, app_model=SimpleNamespace, user=SimpleNamespace, args=dict[str, dict[@_, @_] | int], invoke_from=Literal[InvokeFrom.SERVICE_API], streaming=Literal[False]) [no-matching-overload]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:62:31
-ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (MagicMock, SimpleNamespace, SimpleNamespace, dict[str, dict[Unknown, Unknown] | str | dict[str, str]], Literal[InvokeFrom.DEBUGGER], streaming=Literal[False]) [no-matching-overload]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:110:40
-ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (session=MagicMock, app_model=SimpleNamespace, user=SimpleNamespace, args=dict[str, dict[@_, @_] | str | dict[str, str]], invoke_from=Literal[InvokeFrom.SERVICE_API], streaming=Literal[False]) [no-matching-overload]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:123:35
+ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (app_model=SimpleNamespace, user=SimpleNamespace, args=dict[str, dict[@_, @_] | int], invoke_from=Literal[InvokeFrom.SERVICE_API], streaming=Literal[False]) [no-matching-overload]
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:61:31
+ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (SimpleNamespace, SimpleNamespace, dict[str, dict[Unknown, Unknown] | str | dict[str, str]], Literal[InvokeFrom.DEBUGGER], streaming=Literal[False]) [no-matching-overload]
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:108:40
+ERROR No matching overload found for function `core.app.apps.chat.app_generator.ChatAppGenerator.generate` called with arguments: (app_model=SimpleNamespace, user=SimpleNamespace, args=dict[str, dict[@_, @_] | str | dict[str, str]], invoke_from=Literal[InvokeFrom.SERVICE_API], streaming=Literal[False]) [no-matching-overload]
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:121:35
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_generator.ChatAppGenerator._generate_worker` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:146:45
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:142:45
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_generator.ChatAppGenerator._generate_worker` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:147:31
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:143:31
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_generator.ChatAppGenerator._generate_worker` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:163:45
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:158:45
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_generator.ChatAppGenerator._generate_worker` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:164:31
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:159:31
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:192:34
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:186:28
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:192:55
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:186:49
ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `Conversation` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:192:76
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:186:70
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:192:95
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:186:89
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:225:30
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:217:24
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:225:51
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:217:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `Conversation` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:225:72
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:217:66
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:225:91
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:217:85
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:263:37
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:254:24
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:263:58
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:254:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `Conversation` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:263:73
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:254:60
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:263:92
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:254:79
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:299:30
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:289:24
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:299:51
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:289:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `Conversation` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:299:72
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:289:66
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:299:91
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:289:85
ERROR Argument `DummyGenerateEntity` is not assignable to parameter `application_generate_entity` with type `ChatAppGenerateEntity` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:353:37
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:342:24
ERROR Argument `DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:353:58
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:342:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `Conversation` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:353:73
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:342:60
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.chat.app_runner.ChatAppRunner.run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:353:92
+ --> tests/unit_tests/core/app/apps/chat/test_app_generator_and_runner.py:342:79
ERROR Cannot index into `str` [bad-index]
--> tests/unit_tests/core/app/apps/chat/test_generate_response_converter.py:60:16
ERROR Cannot index into `str` [bad-index]
@@ -3436,11 +3360,11 @@
ERROR Object of class `CompletionAppGenerator` has no attribute `generate_entity` [missing-attribute]
--> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:36:5
ERROR Object of class `FunctionType` has no attribute `assert_not_called` [missing-attribute]
- --> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:108:9
+ --> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:105:9
ERROR Object of class `FunctionType` has no attribute `assert_called_once` [missing-attribute]
- --> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:141:9
+ --> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:137:9
ERROR Key `msg` is not defined in TypedDict `InitErrorDetails` [bad-typed-dict-key]
- --> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:307:57
+ --> tests/unit_tests/core/app/apps/completion/test_completion_completion_app_generator.py:297:57
ERROR Cannot index into `str` [bad-index]
--> tests/unit_tests/core/app/apps/completion/test_completion_generate_response_converter.py:124:16
ERROR Cannot index into `str` [bad-index]
@@ -3686,92 +3610,90 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `pause_state_config` with type `PauseStateLayerConfig | None` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator.resume` [bad-argument-type]
--> tests/unit_tests/core/app/apps/test_workflow_app_generator.py:321:28
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:53:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:52:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:60:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:59:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:92:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:91:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:121:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:120:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._prepare_single_node_execution` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:126:51
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:125:51
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:129:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:128:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._get_graph_and_variable_pool_for_single_node_run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:168:22
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:167:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:183:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:182:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._get_graph_and_variable_pool_for_single_node_run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:219:22
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:218:22
ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:248:27
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:247:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `variable_loader` with type `VariableLoader` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:249:29
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:248:29
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._get_graph_and_variable_pool_for_single_node_run` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:312:22
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:311:22
ERROR Object of class `NoneType` has no attribute `value` [missing-attribute]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:321:16
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:320:16
ERROR Argument `TestWorkflowBasedAppRunner.test_handle_graph_run_events_and_pause_notifications._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:330:55
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:329:55
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:366:30
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:355:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:367:30
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner_core.py:356:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._handle_event` [bad-argument-type]
- -->\n\n... (truncated) ... |
Contributor
Pyrefly Type Coverage
|
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 #38409
Summary
When a chat request carries
{"sensitive_word_avoidance": {"enabled": false, "type": "", "config": {}}}, the existing_normalize_raw()incore/app/app_config/common/sensitive_word_avoidance/manager.pyfalls through every branch:enabledis notNone,enabledis notTrue, so the leftovertype/configfields are passed straight through to the discriminator-tagged union.SensitiveWordAvoidanceDisabledConfigis declared withextra="forbid", so pydantic raisesValidationError("Extra inputs are not permitted: type, config")and the API returns HTTP 400invalid_param??matching the trace in issue #38327.Changes
api/core/app/app_config/common/sensitive_word_avoidance/manager.py: extend_normalize_raw()to drop every key other than"enabled"whenenabled is False. This matches the intent of the disabled schema (onlyenabledmatters).api/tests/unit_tests/core/app/app_config/common/test_sensitive_word_avoidance_manager.py: add two parametrize cases totest_validate_disables_when_enabled_false_or_missingcovering the regression (empty leftover fields and non-empty leftover fields).Diff stat
Test plan
{"enabled": False, "type": "", "config": {}}and{"enabled": False, "type": "keywords", "config": {"k": "v"}}pass ??confirming the normalize step strips leftover fields and the union no longer raisesExtra inputs are not permitted.TestSensitiveWordAvoidanceConfigManager*tests continue to pass.ruff check api/core/app/app_config/common/sensitive_word_avoidance/manager.pyclean.Risk / behavior preservation
Nonefromconvert()and only persists{enabled: False}fromvalidate_and_set_defaults().model_dump(), so the cleanup only affects the input-normalization boundary, not the persisted shape.enabled is Truebranch and theenabled is Nonebranch are untouched.ModerationFactory.validate_configis still called for each enabled config, unchanged.Related
peaks-loopsession2026-07-02-session-95565cduring an issue sweep on 2026-07-02.Automation
Generated via peaks-loop (full-auto mode). Red-line scope was limited to
core/app/app_config/common/sensitive_word_avoidance/manager.pyand the matching parametrize list in its unit-test file. Commit message includes the peaks-loop provenance line for traceability.?? Generated with Claude Code via peaks-loop