Skip to content

test(api): add unit tests for metadata filtering entities - #45262

Merged
asukaminato0721 merged 4 commits into
langgenius:mainfrom
TINGyu123644:test/rag-metadata-entities
Nov 8, 2026
Merged

asukaminato0721 merged 4 commits into
langgenius:mainfrom
TINGyu123644:test/rag-metadata-entities

Conversation

@TINGyu123644

@TINGyu123644 TINGyu123644 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Unit tests for api/core/rag/entities/metadata_entities.py — Condition and
MetadataFilteringCondition, the metadata-filter models used by the RAG
retrieval pipeline. No production code is changed.

api/tests/unit_tests/core/rag/entities/ previously had no test coverage at
all. This PR adds a new test module test_metadata_entities.py (plus the
package __init__.py); no existing test file is touched — the diff is
purely additive (+104/-0)
.

Covered behavior:

  • Condition defaults: value omitted → None;
  • all 19 supported comparison operators accepted (10 string, 6 numeric, 3 time);
  • supported value types kept as-is: string, string list, empty list, int,
    float, None; booleans coerce to int (pydantic lax mode);
  • mapping values (dicts) rejected with ValidationError;
  • required fields (name, comparison_operator) enforced;
  • MetadataFilteringCondition defaults: logical_operator="and",
    conditions=None; "or" accepted;
    conditions accepts model instances, plain mappings, and empty lists;
    invalid condition entries rejected.

Verification: 35 tests pass locally (Python 3.13, pydantic 2.14) — every
expectation was first probed against the real implementation, and a mutation
check (breaking the value default) confirmed the suite fails when behavior
changes. ruff check + ruff format clean with api/.ruff.toml.

AI assistance declaration: the test cases in this PR were drafted with AI
assistance (Claude) and reviewed by @TINGyu123644 before submission.

Checklist

  • This change requires a documentation update, included: Dify Document - test-only change, no documentation impact
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - tests only, no behavioral change
  • I've verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • I've updated the documentation accordingly. - not needed
  • I ran lint on the touched files - clean on the touched test file.

Review follow-up (2026-11-02)

wylswz flagged the type check. Root cause: api/tests/unit_tests/pyrefly.toml runs pyrefly with preset = "strict", which requires return annotations on every function and flags iterating/subscripting Optional fields. Commit 17ea83d:

  • adds -> None to every test method and annotates the parametrized value/expected parameters with ConditionValue;
  • builds invalid payloads through Model.model_validate({...}) (the pattern the repo's own controller tests use) instead of calling constructors with missing required arguments;
  • narrows the Optional conditions field with an assert before subscript/iteration.

Test count and assertions are unchanged (37 cases, all passing locally); the diff stays purely additive (+108/-0). The file is also clean under tests/unit_tests/.ruff.toml (base config + ANN401/ARG).

Review follow-up (2026-11-07)

@asukaminato0721 pointed at the failing Style Check / Python Style job
(Run Type Checks). pyrefly reported three errors on the previous head:

  1. Argument \str` is not assignable to parameter `comparison_operator`— the parametrized operator argument was annotatedstr, while Condition.comparison_operatoris aLiteral` alias.
  2. Argument \Literal['like']` is not assignable ...—test_unknown_operator_is_rejected` deliberately passed an invalid literal.
  3. Argument \Literal['xor']` is not assignable to `logical_operator`— same pattern fortest_unknown_logical_operator_is_rejected`.

Commit 09ad3df fixes all three:

  • the parametrized argument now uses the repo's own
    SupportedComparisonOperator alias, so all 19 operators are still covered;
  • the two invalid-literal rejection cases are removed. They only re-assert what
    the type checker already reports statically (the same point raised on test(api): add unit tests for rag document models #45261),
    and keeping them would have required # type: ignore on a test file.

No existing test file is touched and no production code changes. Current diff:
+104/-0
(one new test module + an empty __init__.py); 35 tests pass locally
on Python 3.13 / pydantic 2.14.1, and ruff check + ruff format --check are
clean under api/tests/unit_tests/.ruff.toml. The earlier 11-02 section above
describes the preceding revision (37 cases / +108/-0) and is kept for review
history only.

AI assistance declaration: unchanged — the tests were drafted with AI
assistance and reviewed by @TINGyu123644 before submission.

Add a new standalone test module for
api/core/rag/entities/metadata_entities.py (Condition and
MetadataFilteringCondition), which previously had no test coverage.

Covered behavior: Condition defaults (value omitted -> None), all 19
supported comparison operators (string/numeric/time), supported value
types (string, string list, int, float, null, bool coerced to int),
rejection of unknown operators and mapping values, required-field
validation; MetadataFilteringCondition defaults (logical_operator
'and', conditions None), 'or' accepted, unknown logical operator
rejected, conditions accepting model instances and mappings.

No existing test file is modified; the diff is purely additive.
@github-actions github-actions Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-11-04 07:05:15.071137672 +0000
+++ /tmp/pyrefly_pr.txt	2026-11-04 07:05:03.719051445 +0000
@@ -198,6 +198,12 @@
    --> tests/e2e_tests/containers/controllers/console/app/test_chat_conversation_status_count_api.py:123:27
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `MessageStatus | SQLCoreOperations[MessageStatus]` in function `models.model.Message.__init__` [bad-argument-type]
    --> tests/e2e_tests/containers/controllers/console/app/test_chat_conversation_status_count_api.py:125:16
+ERROR Returned type `set[str | None]` is not assignable to declared return type `set[str]` [bad-return]
+   --> tests/e2e_tests/containers/controllers/console/test_apikey.py:221:16
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+  --> tests/e2e_tests/containers/controllers/openapi/test_account.py:24:22
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+  --> tests/e2e_tests/containers/controllers/openapi/test_account.py:49:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/e2e_tests/containers/controllers/openapi/test_account_sessions.py:62:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
@@ -211,6 +217,8 @@
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
    --> tests/e2e_tests/containers/controllers/openapi/test_account_sessions.py:153:17
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+  --> tests/e2e_tests/containers/controllers/openapi/test_app_run.py:46:13
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/e2e_tests/containers/controllers/openapi/test_workspaces.py:27:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/e2e_tests/containers/controllers/openapi/test_workspaces.py:47:22
@@ -218,6 +226,10 @@
   --> tests/e2e_tests/containers/controllers/openapi/test_workspaces.py:64:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/e2e_tests/containers/controllers/openapi/test_workspaces.py:87:17
+ERROR Cannot index into `str` [bad-index]
+  --> tests/e2e_tests/containers/controllers/service_api/dataset/test_dataset.py:49:20
+ERROR Cannot index into `str` [bad-index]
+  --> tests/e2e_tests/containers/controllers/service_api/dataset/test_dataset.py:51:31
 ERROR Argument `Literal['browser']` is not assignable to parameter `type` with type `EndUserType | SQLCoreOperations[EndUserType]` in function `models.model.EndUser.__init__` [bad-argument-type]
   --> tests/e2e_tests/containers/controllers/web/test_site.py:55:14
 ERROR Argument `Literal['emoji']` is not assignable to parameter `icon_type` with type `IconType | SQLCoreOperations[IconType | None] | None` in function `models.model.Site.__init__` [bad-argument-type]
@@ -324,6 +336,8 @@
    --> tests/e2e_tests/containers/models/test_types_enum_text.py:147:20
 ERROR Object of class `NoneType` has no attribute `user_type_nullable` [missing-attribute]
    --> tests/e2e_tests/containers/models/test_types_enum_text.py:148:20
+ERROR Generator function should return `Generator` [bad-return]
+   --> tests/e2e_tests/containers/repositories/test_sqlalchemy_api_workflow_run_repository.py:150:56
 ERROR Argument `Literal['chat']` is not assignable to parameter `mode` with type `AppMode | SQLCoreOperations[AppMode]` in function `models.model.App.__init__` [bad-argument-type]
    --> tests/e2e_tests/containers/repositories/test_sqlalchemy_execution_extra_content_repository.py:103:14
 ERROR Argument `Literal['emoji']` is not assignable to parameter `icon_type` with type `IconType | SQLCoreOperations[IconType | None] | None` in function `models.model.App.__init__` [bad-argument-type]
@@ -398,6 +412,8 @@
    --> tests/e2e_tests/containers/repositories/test_sqlalchemy_workflow_node_execution_repository.py:385:27
 ERROR Argument `Literal['account']` is not assignable to parameter `value` with type `CreatorUserRole | SQLCoreOperations[CreatorUserRole]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> tests/e2e_tests/containers/repositories/test_sqlalchemy_workflow_node_execution_repository.py:390:36
+ERROR Generator function should return `Generator` [bad-return]
+  --> tests/e2e_tests/containers/repositories/test_workflow_run_repository.py:89:56
 ERROR Argument `Literal['chat']` is not assignable to parameter `mode` with type `AppMode | SQLCoreOperations[AppMode]` in function `models.model.App.__init__` [bad-argument-type]
   --> tests/e2e_tests/containers/services/dataset_service_update_delete.py:95:18
 ERROR Argument `Literal['emoji']` is not assignable to parameter `icon_type` with type `IconType | SQLCoreOperations[IconType | None] | None` in function `models.model.App.__init__` [bad-argument-type]
@@ -716,6 +732,8 @@
   --> tests/e2e_tests/containers/services/test_dataset_service_permissions.py:42:58
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/e2e_tests/containers/services/test_dataset_service_permissions.py:69:20
+ERROR Argument `str` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+  --> tests/e2e_tests/containers/services/test_document_service_display_status.py:50:32
 ERROR Argument `Literal['completed']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
   --> tests/e2e_tests/containers/services/test_document_service_rename_document.py:78:27
 ERROR `None` is not subscriptable [unsupported-operation]
@@ -966,6 +984,8 @@
    --> tests/e2e_tests/containers/services/test_message_service_execution_extra_content.py:102:12
 ERROR `None` is not subscriptable [unsupported-operation]
    --> tests/e2e_tests/containers/services/test_message_service_execution_extra_content.py:102:12
+ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `MessageStatus | SQLCoreOperations[MessageStatus]` in function `models.model.Message.__init__` [bad-argument-type]
+  --> tests/e2e_tests/containers/services/test_message_service_extra_contents.py:44:16
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
    --> tests/e2e_tests/containers/services/test_messages_clean_service.py:129: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]
@@ -2096,6 +2116,10 @@
    --> tests/helpers/workflow/table_runner.py:390:37
 WARN `URLError` is already caught earlier in this `try` statement, so it never matches here [unreachable-except-clause]
    --> tests/pytest_dify.py:155:34
+ERROR Object of class `object` has no attribute `package` [missing-attribute]
+   --> tests/unit_tests/commands/test_data_migration.py:218:16
+ERROR Object of class `object` has no attribute `options_override` [missing-attribute]
+   --> tests/unit_tests/commands/test_data_migration.py:219:16
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
    --> tests/unit_tests/commands/test_retention.py:188:20
 ERROR Expected a callable, got `None` [not-callable]
@@ -2138,6 +2162,8 @@
    --> tests/unit_tests/context/test_flask_app_context.py:266:20
 ERROR Object of class `Flask` has no attribute `_get_current_object` [missing-attribute]
    --> tests/unit_tests/context/test_flask_app_context.py:295:20
+ERROR Object of class `Task` has no attribute `queue` [missing-attribute]
+   --> tests/unit_tests/controllers/console/app/test_annotation.py:100:16
 ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
    --> tests/unit_tests/controllers/console/app/test_app.py:173:13
 ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
@@ -2407,9 +2433,9 @@
 ERROR Missing argument `endpoint_id` in function `controllers.console.workspace.endpoint.EndpointIdPayload.__init__` [missing-argument]
    --> tests/unit_tests/controllers/console/workspace/test_endpoint.py:561:46
 ERROR Argument `Literal['team']` is not assignable to parameter `plan` with type `CloudPlan | None` in function `services.workspace.contracts.EffectiveCreditPool.__init__` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/workspace/test_model_providers.py:360:18
+   --> tests/unit_tests/controllers/console/workspace/test_model_providers.py:359:18
 ERROR `in` is not supported between `Literal['knowledge-retrieval']` and `object` [not-iterable]
-   --> tests/unit_tests/controllers/console/workspace/test_snippets.py:235:12
+   --> tests/unit_tests/controllers/console/workspace/test_snippets.py:213:12
 ERROR Argument `Literal['file-id']` is not assignable to parameter `file_id` with type `UUID` in function `controllers.files.upload_file_delivery.ImagePreviewApi.get` [bad-argument-type]
   --> tests/unit_tests/controllers/files/test_upload_file_delivery.py:47:53
 ERROR Argument `Literal['file-id']` is not assignable to parameter `file_id` with type `UUID` in function `controllers.files.upload_file_delivery.ImagePreviewApi.get` [bad-argument-type]
@@ -2866,14 +2892,8 @@
    --> tests/unit_tests/controllers/service_api/test_wraps.py:415:16
 ERROR Argument `Literal['abnormal']` is not assignable to parameter `value` with type `AppStatus | SQLCoreOperations[AppStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> tests/unit_tests/controllers/service_api/test_wraps.py:450:28
-ERROR Object of class `NoneType` has no attribute `tenant_id` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/test_wraps.py:893:16
-ERROR Object of class `NoneType` has no attribute `dataset_ids` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/test_wraps.py:894:16
-ERROR Object of class `NoneType` has no attribute `dataset_ids` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/test_wraps.py:961:16
 ERROR Object of class `NoneType` has no attribute `last_used_at` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/test_wraps.py:963:16
+   --> tests/unit_tests/controllers/service_api/test_wraps.py:951:16
 ERROR `object` is not assignable to attribute `request` with type `Request` [bad-assignment]
   --> tests/unit_tests/controllers/trigger/test_trigger.py:11:22
 ERROR Object of class `tuple` has no attribute `status_code` [missing-attribute]
@@ -3148,6 +3168,8 @@
    --> tests/unit_tests/core/agent/test_fc_agent_runner.py:717:29
 ERROR Missing argument `description` in function `core.agent.plugin_entities.AgentStrategyEntity.__init__` [missing-argument]
    --> tests/unit_tests/core/agent/test_plugin_entities.py:292:32
+ERROR Argument `dict[str, dict[str, str | dict[str, float | list[str]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.model_config.manager.ModelConfigManager.convert` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/model_config/test_manager.py:368:45
 ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/variables/test_manager.py:14:67
 ERROR Argument `dict[str, list[dict[str, bool | str | dict[str, str]] | dict[str, bool]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
@@ -3156,6 +3178,8 @@
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/variables/test_manager.py:68:67
 ERROR Argument `dict[str, list[dict[VariableEntityType, dict[str, str]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/variables/test_manager.py:85:67
+ERROR Expected a mapping, got object | None [invalid-argument]
+  --> tests/unit_tests/core/app/apps/advanced_chat/test_app_config_manager.py:41:29
 ERROR Argument `SimpleNamespace` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.single_loop_generate` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:261:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.single_loop_generate` [bad-argument-type]
@@ -3654,6 +3678,10 @@
    --> tests/unit_tests/core/app/apps/test_message_based_app_generator.py:146:31
 ERROR Object of class `NoneType` has no attribute `opening_statement` [missing-attribute]
    --> tests/unit_tests/core/app/apps/test_message_based_app_generator.py:170:9
+ERROR Class member `_PreparedSubscriber.prepare_subscription` overrides parent class `SupportsPreparedSubscription` in an inconsistent manner [bad-override]
+  --> tests/unit_tests/core/app/apps/test_message_generator.py:13:9
+ERROR Class member `_PreparedSubscriber.subscribe` overrides parent class `SupportsPreparedSubscription` in an inconsistent manner [bad-override]
+  --> tests/unit_tests/core/app/apps/test_message_generator.py:17:9
 ERROR Class member `FakePreparedSubscriber.prepare_subscription` overrides parent class `SupportsPreparedSubscription` in an inconsistent manner [bad-override]
   --> tests/unit_tests/core/app/apps/test_streaming_utils.py:71:9
 ERROR Class member `FakePreparedSubscriber.subscribe` overrides parent class `SupportsPreparedSubscription` in an inconsistent manner [bad-override]
@@ -4163,11 +4191,11 @@
 WARN Identity comparison `True is False` is always False [unnecessary-comparison]
    --> tests/unit_tests/core/mcp/test_mcp_client.py:508:39
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
-  --> tests/unit_tests/core/memory/test_token_buffer_memory.py:68:16
+  --> tests/unit_tests/core/memory/test_token_buffer_memory.py:59:16
 ERROR `in` is not supported between `int` and `object` [not-iterable]
-   --> tests/unit_tests/core/memory/test_token_buffer_memory.py:338:16
+   --> tests/unit_tests/core/memory/test_token_buffer_memory.py:325:16
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/memory/test_token_buffer_memory.py:442:9
+   --> tests/unit_tests/core/memory/test_token_buffer_memory.py:429:9
 ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
    --> tests/unit_tests/core/plugin/backwards_invocation/test_app.py:439:16
 ERROR Object of class `Account` has no attribute `app_id` [missing-attribute]
@@ -4354,6 +4382,12 @@
   --> tests/unit_tests/core/rag/datasource/keyword/jieba/test_jieba_keyword_table_handler.py:92:5
 ERROR Argument `str` is not assignable to parameter `doc_form` with type `IndexStructureType | SQLCoreOperations[IndexStructureType]` in function `models.dataset.Document.__init__` [bad-argument-type]
    --> tests/unit_tests/core/rag/datasource/test_retrieval_service.py:148:18
+ERROR Argument `str` is not assignable to parameter `comparison_operator` with type `Literal['<', '=', '>', 'after', 'before', 'contains', 'empty', 'end with', 'in', 'is', 'is not', 'not contains', 'not empty', 'not in', 'start with', '≠', '≤', '≥']` in function `core.rag.entities.metadata_entities.Condition.__init__` [bad-argument-type]
+  --> tests/unit_tests/core/rag/entities/test_metadata_entities.py:47:65
+ERROR Argument `Literal['like']` is not assignable to parameter `comparison_operator` with type `Literal['<', '=', '>', 'after', 'before', 'contains', 'empty', 'end with', 'in', 'is', 'is not', 'not contains', 'not empty', 'not in', 'start with', '≠', '≤', '≥']` in function `core.rag.entities.metadata_entities.Condition.__init__` [bad-argument-type]
+  --> tests/unit_tests/core/rag/entities/test_metadata_entities.py:52:57
+ERROR Argument `Literal['xor']` is not assignable to parameter `logical_operator` with type `Literal['and', 'or'] | None` in function `core.rag.entities.metadata_entities.MetadataFilteringCondition.__init__` [bad-argument-type]
+  --> tests/unit_tests/core/rag/entities/test_metadata_entities.py:79:57
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
   --> tests/unit_tests/core/rag/extractor/test_excel_extractor.py:17:56
 ERROR Argument `object | None` is not assignable to parameter `session` with type `Session | None` in function `core.rag.extractor.extract_processor.ExtractProcessor.extract` [bad-argument-type]
@@ -4459,7 +4493,7 @@
 ERROR Argument `str` is not assignable to parameter `metadata_filtering_mode` with type `Literal['automatic', 'disabled', 'manual']` in function `core.workflow.nodes.knowledge_retrieval.retrieval.KnowledgeRetrievalRequest.__init__` [bad-argument-type]
     --> tests/unit_tests/core/rag/retrieval/test_dataset_retrieval.py:6251:33
 ERROR Argument `None` is not assignable to parameter `text` with type `str` in function `core.rag.splitter.text_splitter.RecursiveCharacterTextSplitter.split_text` [bad-argument-type]
-    --> tests/unit_tests/core/rag/splitter/test_text_splitter.py:1874:42
+    --> tests/unit_tests/core/rag/splitter/test_text_splitter.py:1873:42
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
     --> tests/unit_tests/core/repositories/test_human_input_repository.py:1270:56
 ERROR Argument `Literal['invalid']` 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]
@@ -5260,6 +5294,12 @@
     --> tests/unit_tests/core/workflow/nodes/agent_v2/test_runtime_request_builder.py:1811:68
 ERROR Cannot index into `object` [bad-index]
     --> tests/unit_tests/core/workflow/nodes/agent_v2/test_runtime_request_builder.py:1812:14
+ERROR `not in` is not supported between `Literal['agent_workspace_binding_id']` and `None` [not-iterable]
+   --> tests/unit_tests/core/workflow/nodes/agent_v2/test_session_store.py:475:12
+ERROR Argument `dict[str, str]` is not assignable to parameter `process_data` with type `dict[str, object] | None` in function `_execution_row` [bad-argument-type]
+   --> tests/unit_tests/core/workflow/nodes/agent_v2/test_session_store.py:558:69
+ERROR `not in` is not supported between `Literal['agent_workspace_binding_id']` and `None` [not-iterable]
+   --> tests/unit_tests/core/workflow/nodes/agent_v2/test_session_store.py:567:12
 ERROR Argument `_GraphParams` is not assignable to parameter `init_params` with type `InitParams` in function `core.workflow.nodes.datasource.datasource_node.DatasourceNode.__init__` [bad-argument-type]
    --> tests/unit_tests/core/workflow/nodes/datasource/test_datasource_node.py:105:21
 ERROR Argument `_GraphState` is not assignable to parameter `runtime_state` with type `RuntimeState` in function `core.workflow.nodes.datasource.datasource_node.DatasourceNode.__init__` [bad-argument-type]
@@ -5702,6 +5742,24 @@
    --> tests/unit_tests/libs/test_external_api.py:436:12
 ERROR Cannot index into `str` [bad-index]
    --> tests/unit_tests/libs/test_external_api.py:436:12
+ERROR Class member `User.get_id` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
+  --> tests/unit_tests/libs/test_flask_utils.py:18:9
+ERROR `str` is not assignable to dict key `error` with type `None` [bad-assignment]
+  --> tests/unit_tests/libs/test_flask_utils.py:71:35
+ERROR `str` is not assignable to dict key `error` with type `None` [bad-assignment]
+   --> tests/unit_tests/libs/test_flask_utils.py:114:35
+ERROR Object of class `Flask` has no attribute `_get_current_object` [missing-attribute]
+   --> tests/unit_tests/libs/test_flask_utils.py:131:18
+ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/libs/test_helper.py:159:30
+ERROR Argument `Literal['not_a_user_object']` is not assignable to parameter `user` with type `Account | EndUser` in function `libs.helper.extract_tenant_id` [bad-argument-type]
+   --> tests/unit_tests/libs/test_helper.py:169:31
+ERROR Argument `None` is not assignable to parameter `user` with type `Account | EndUser` in function `libs.helper.extract_tenant_id` [bad-argument-type]
+   --> tests/unit_tests/libs/test_helper.py:174:31
+ERROR Argument `dict[str, str]` is not assignable to parameter `user` with type `Account | EndUser` in function `libs.helper.extract_tenant_id` [bad-argument-type]
+   --> tests/unit_tests/libs/test_helper.py:181:31
+ERROR Argument `None` is not assignable to parameter `pattern` with type `str` in function `libs.helper.escape_like_pattern` [bad-argument-type]
+   --> tests/unit_tests/libs/test_helper.py:228:38
 ERROR Class member `TestCronCompatibility.setUp` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/unit_tests/libs/test_schedule_utils.py:22:9
 ERROR Class member `TestTimezoneCompatibility.setUp` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -5838,6 +5896,10 @@
     --> tests/unit_tests/services/agent/test_roster_service.py:5544:35
 ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
     --> tests/unit_tests/services/agent/test_roster_service.py:5614:16
+ERROR Object of class `NoneType` has no attribute `node_job_config_dict` [missing-attribute]
+   --> tests/unit_tests/services/agent/test_workflow_publish_service.py:601:49
+ERROR Object of class `NoneType` has no attribute `node_job_config_dict` [missing-attribute]
+   --> tests/unit_tests/services/agent/test_workflow_publish_service.py:611:49
 ERROR Class member `StubResolver.resolve` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
    --> tests/unit_tests/services/data_migration/test_import_service.py:256:13
 ERROR Class member `CapturingImportService._import_workflows` overrides parent class `MigrationImportService` in an inconsistent manner [bad-override]
@@ -5884,42 +5946,48 @@
     --> tests/unit_tests/services/knowledge/external/test_service.py:1551:16
 ERROR `None` is not subscriptable [unsupported-operation]
     --> tests/unit_tests/services/knowledge/external/test_service.py:1552:16
+ERROR Argument `Literal['completed']` is not assignable to parameter `value` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> tests/unit_tests/services/knowledge/metadata/test_application.py:319:44
+ERROR Returned type `MetadataService` is not assignable to declared return type `Iterator[MetadataService]` [bad-return]
+   --> tests/unit_tests/services/knowledge/metadata/test_application.py:321:16
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/unit_tests/services/knowledge/metadata/test_application.py:434:20
 ERROR Object of class `NoneType` has no attribute `keyword_number` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1520:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1438:20
 ERROR Argument `str` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1835:26
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1753:26
 ERROR Argument `str` is not assignable to parameter `indexing_status` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1841:25
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1759:25
 ERROR Argument `Literal['opendal']` is not assignable to parameter `storage_type` with type `StorageType` in function `tests.helpers.unit.model_factories.make_upload_file` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1858:22
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1776:22
 ERROR Argument `str` is not assignable to parameter `mode` with type `ProcessRuleMode | SQLCoreOperations[ProcessRuleMode]` in function `models.dataset.DatasetProcessRule.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1879:37
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1797:37
 ERROR Argument `Literal['opendal']` is not assignable to parameter `storage_type` with type `StorageType` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2189:30
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2037:30
 ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2195:33
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2043:33
 ERROR `None` is not subscriptable [unsupported-operation]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2220:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2068:20
 ERROR Object of class `NoneType` has no attribute `name` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2221:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2069:20
 ERROR Argument `Literal['opendal']` is not assignable to parameter `storage_type` with type `StorageType` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2663:30
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2511:30
 ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2669:33
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2517:33
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2748:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2596:20
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2847:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2695:20
 ERROR Argument `list[PreProcessingRule] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2951:24
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2799:24
 ERROR `None` is not subscriptable [unsupported-operation]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2952:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2800:20
 ERROR Object of class `NoneType` has no attribute `rules` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:3952:42
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:3800:42
 ERROR Argument `Literal['completed']` is not assignable to parameter `indexing_status` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4387:25
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4235:25
 ERROR Argument `str` is not assignable to parameter `doc_form` with type `IndexStructureType | SQLCoreOperations[IndexStructureType]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4388:18
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4236:18
 ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
   --> tests/unit_tests/services/plugin/test_plugin_parameter_service.py:47:9
 ERROR Object of class `NoneType` has no attribute `marked_name` [missing-attribute]
@@ -5948,6 +6016,18 @@
    --> tests/unit_tests/services/retention/workflow_run/test_archive_download_preparation.py:163:16
 ERROR Cannot index into `dict[str, bytes]` [bad-index]
    --> tests/unit_tests/services/retention/workflow_run/test_archive_download_preparation.py:343:52
+ERROR Argument `FakeRedis` is not assignable to parameter `redis` with type `RedisClientWrapper` in function `services.retention.workflow_run.archive_download_task_cache.WorkflowRunArchiveDownloadTaskCache.__init__` [bad-argument-type]
+   --> tests/unit_tests/services/retention/workflow_run/test_archive_download_task_cache.py:124:55
+ERROR Argument `FakeRedis` is not assignable to parameter `redis` with type `RedisClientWrapper` in function `services.retention.workflow_run.archive_download_task_cache.WorkflowRunArchiveDownloadTaskCache.__init__` [bad-argument-type]
+   --> tests/unit_tests/services/retention/workflow_run/test_archive_download_task_cache.py:147:55
+ERROR Argument `FakeRedis` is not assignable to parameter `redis` with type `RedisClientWrapper` in function `services.retention.workflow_run.archive_download_task_cache.WorkflowRunArchiveDownloadTaskCache.__init__` [bad-argument-type]
+   --> tests/unit_tests/services/retention/workflow_run/test_archive_download_task_cache.py:163:55
+ERROR Argument `FakeRedis` is not assignable to parameter `redis` with type `RedisClientWrapper` in function `services.retention.workflow_run.archive_download_task_cache.WorkflowRunArchiveDownloadTaskCache.__init__` [bad-argument-type]
+   --> tests/unit_tests/services/retention/workflow_run/test_archive_download_task_cache.py:188:55
+ERROR Argument `(_task: WorkflowRunArchiveDownloadTask) -> None` is not assignable to parameter `dispatcher` with type `WorkflowRunArchiveDownloadTaskDispatcher | None` in function `_service` [bad-argument-type]
+   --> tests/unit_tests/services/retention/workflow_run/test_archive_log_service.py:340:69
+ERROR Argument `(_storage_key: str, *, expires_in: int, filename: str) -> str` is not assignable to parameter `sign_download_url` with type `WorkflowRunArchiveDownloadUrlSigner` in function `services.retention.workflow_run.archive_log_service.WorkflowRunArchiveService.__init__` [bad-argument-type]
+   --> tests/unit_tests/services/retention/workflow_run/test_archive_log_service.py:405:27
 ERROR Argument `FakeRepo` is not assignable to parameter `workflow_run_repo` with type `APIWorkflowRunRepository | None` in function `services.retention.workflow_run.clear_free_plan_expired_workflow_run_logs.WorkflowRunCleanup.__init__` [bad-argument-type]
    --> tests/unit_tests/services/retention/workflow_run/test_clear_free_plan_expired_workflow_run_logs.py:565:49
 ERROR Class member `FailingRepo.delete_runs_with_related_by_ids` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -6177,71 +6257,71 @@
 ERROR Argument `dict[str, list[dict[str, object]]]` is not assignable to parameter `full_process_data` with type `dict[str, object] | None` in function `_repository` [bad-argument-type]
    --> tests/unit_tests/services/test_workflow_node_execution_trace_service.py:162:49
 ERROR Argument `_RepoRecorder | Unknown` is not assignable to parameter `workflow_execution_repository` with type `WorkflowExecutionRepository` in function `services.workflow_persistence.WorkflowPersistenceLayer.__init__` [bad-argument-type]
-   --> tests/unit_tests/services/test_workflow_persistence.py:356:39
+   --> tests/unit_tests/services/test_workflow_persistence.py:355:39
 ERROR Argument `_RepoRecorder | Unknown` is not assignable to parameter `workflow_node_execution_repository` with type `WorkflowNodeExecutionRepository` in function `services.workflow_persistence.WorkflowPersistenceLayer.__init__` [bad-argument-type]
-   --> tests/unit_tests/services/test_workflow_persistence.py:357:44
+   --> tests/unit_tests/services/test_workflow_persistence.py:356:44
 ERROR Argument `None` is not assignable to parameter `command_channel` with type `CommandChannel` in function `graphon.engine.layer.base.Layer.initialize` [bad-argument-type]
-   --> tests/unit_tests/services/test_workflow_persistence.py:360:55
+   --> tests/unit_tests/services/test_workflow_persistence.py:359:55
 ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-   --> tests/unit_tests/services/test_workflow_persistence.py:427:20
+   --> tests/unit_tests/services/test_workflow_persistence.py:426:20
 ERROR Object of class `object` has no attribute `metadata` [missing-attribute]
-   --> tests/unit_tests/services/test_workflow_persistence.py:428:20
+   --> tests/unit_tests/services/test_workflow_persistence.py:427:20
 ERROR `Literal['loop_id']` is not assignable to dict key type `WorkflowNodeExecutionMetadataKey` [bad-assignment]
-   --> tests/unit_tests/services/test_workflow_persistence.py:459:94
+   --> tests/unit_tests/services/test_workflow_persistence.py:458:94
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/services/test_workflow_persistence.py:890:21
+   --> tests/unit_tests/services/test_workflow_persistence.py:889:21
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1042:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1041:20
 ERROR Object of class `object` has no attribute `total_tokens` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1043:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1042:20
 ERROR Object of class `object` has no attribute `total_steps` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1044:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1043:20
 ERROR `SimpleNamespace` is not assignable to attribute `_graph_execution` with type `GraphExecution` [bad-assignment]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1054:46
+    --> tests/unit_tests/services/test_workflow_persistence.py:1053:46
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1059:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1058:20
 ERROR Object of class `object` has no attribute `exceptions_count` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1060:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1059:20
 ERROR Object of class `object` has no attribute `total_tokens` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1061:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1060:20
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1086:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1085:20
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1151:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1150:20
 ERROR Object of class `object` has no attribute `error_message` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1152:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1151:20
 ERROR Object of class `object` has no attribute `created_at` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1170:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1169:20
 ERROR Object of class `object` has no attribute `id` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1199:21
+    --> tests/unit_tests/services/test_workflow_persistence.py:1198:21
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1251:20
-ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1252:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1250:20
 ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1253:29
+    --> tests/unit_tests/services/test_workflow_persistence.py:1251:20
 ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1304:27
+    --> tests/unit_tests/services/test_workflow_persistence.py:1252:29
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1363:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1312:20
 ERROR Object of class `object` has no attribute `error` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1364:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1313:20
 ERROR Object of class `object` has no attribute `finished_at` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1365:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1314:20
 ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1367:24
+    --> tests/unit_tests/services/test_workflow_persistence.py:1316:24
 ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1368:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1317:20
 ERROR Object of class `object` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1395:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1344:20
 ERROR Object of class `object` has no attribute `finished_at` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1396:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1345:20
 ERROR Object of class `object` has no attribute `process_data` [missing-attribute]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1397:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1346:20
 ERROR `None` is not subscriptable [unsupported-operation]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1472:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1421:20
 ERROR `None` is not subscriptable [unsupported-operation]
-    --> tests/unit_tests/services/test_workflow_persistence.py:1473:20
+    --> tests/unit_tests/services/test_workflow_persistence.py:1422:20
+ERROR Argument `dict[str, list[Unknown] | str | dict[str, bool] | dict[str, bool | str] | dict[str, dict[str, bool | int | list[str]]]]` is not assignable to parameter `features` with type `dict[str, object]` in function `_create_workflow` [bad-argument-type]
+  --> tests/unit_tests/services/test_workflow_restore.py:63:18
 ERROR `dict[str, str]` is not assignable to dict value type `list[Unknown] | str` [bad-assignment]
    --> tests/unit_tests/services/test_workflow_service.py:239:30
 ERROR Argument `Literal['invalid']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 83.97% 83.98% +0.00%
Strict coverage 83.63% 83.64% +0.00%
Typed symbols 87,714 87,729 +15
Untyped symbols 16,807 16,807 0
Modules 4423 4425 +2

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.91%. Comparing base (262158c) to head (916546e).
⚠️ Report is 233 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #45262      +/-   ##
==========================================
+ Coverage   89.86%   89.91%   +0.05%     
==========================================
  Files        6251     6260       +9     
  Lines      398243   392794    -5449     
  Branches    80273    79686     -587     
==========================================
- Hits       357868   353198    -4670     
+ Misses      34064    33506     -558     
+ Partials     6311     6090     -221     
Flag Coverage Δ
api 89.81% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Review follow-up (wylswz: 'please fix type check'): the tests/unit_tests
pyrefly config is preset=strict, which requires return annotations on every
function and flags iterating/subscripting Optional fields. Validation tests
now build invalid payloads through Model.model_validate({...}) (the pattern
used by the repo's own controller tests), and Optional fields are narrowed
with asserts before use. Test count and assertions are unchanged; all 37
cases pass.
@asukaminato0721 asukaminato0721 self-assigned this Nov 4, 2026
@asukaminato0721

Copy link
Copy Markdown
Contributor

ci

@asukaminato0721 asukaminato0721 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

^

@TINGyu123644

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look at this one. Your comment reads just "ci" and the review body is "^", so I want to make sure I fix the right thing - could you spell out what you would like changed?

For reference, everything on the current head (17ea83d4) is green: API unit tests (both shards), API controller tests, API integration tests, Dify Agent tests, VDB tests, DB migration test, Web tests and Web full-stack E2E all pass, and codecov/patch reports all modified lines covered by tests.

If a job is failing on your side, or "ci" refers to something specific, point me at it and I will turn it around quickly.

@asukaminato0721

Copy link
Copy Markdown
Contributor

…gnatures

Style Check / Python Style reported three call sites whose arguments do not
match the declared Literal types. Remove the two cases that only assert what
the type checker reports statically, and annotate the parametrized operator
with SupportedComparisonOperator. Coverage of all 19 operators is unchanged.

Follow-up to review feedback on langgenius#45262.
auto-merge was automatically disabled November 7, 2026 05:10

Head branch was pushed to by a user without write access

@TINGyu123644

Copy link
Copy Markdown
Contributor Author

Thanks for the link - that pinned it down. The failing job is Style Check / Python Style -> Run Type Checks, with three pyrefly errors on the previous head (17ea83d):

  1. Argument stris not assignable to parametercomparison_operator`` - the parametrized operator argument was annotated str, while `Condition.comparison_operator` is a `Literal` alias.
  2. Argument Literal['like'] is not assignable ... - test_unknown_operator_is_rejected deliberately passed an invalid literal.
  3. Argument Literal['xor']is not assignable tological_operator`` - same pattern for test_unknown_logical_operator_is_rejected.

Fixed in 09ad3df:

  • the parametrized argument now uses the repo's own SupportedComparisonOperator alias, so all 19 supported operators are still exercised;
  • the two invalid-literal cases are removed. They only re-assert what the type checker already reports statically - the same reasoning you gave on test(api): add unit tests for rag document models #45261 - and keeping them would have needed # type: ignore on a test file.

Verification: 35 tests pass locally (Python 3.13 / pydantic 2.14.1); ruff check and ruff format --check clean with api/tests/unit_tests/.ruff.toml. The PR is still one new test module plus an empty __init__.py, no existing test file touched, diff purely additive (+104/-0). The PR description has been updated to match the current diff.

Could you re-run the style workflow when convenient? Happy to switch those two cases to model_validate instead if you would rather keep the runtime-validation coverage.

@asukaminato0721
asukaminato0721 added this pull request to the merge queue Nov 8, 2026
Merged via the queue into langgenius:main with commit ee98137 Nov 8, 2026
47 checks passed
fatelei pushed a commit to fatelei/dify that referenced this pull request Nov 9, 2026
…#45262)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants