Repository navigation
test(api): stop excluding five core test modules from strict pyrefly - #45336
Conversation
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-11-03 02:40:22.576454240 +0000
+++ /tmp/pyrefly_pr.txt 2026-11-03 02:40:11.024291447 +0000
@@ -3166,8 +3166,6 @@
--> 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]
@@ -5286,12 +5284,6 @@
--> 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]
|
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #45336 +/- ##
=======================================
Coverage 89.77% 89.77%
=======================================
Files 6239 6239
Lines 390902 390924 +22
Branches 79285 79291 +6
=======================================
+ Hits 350932 350957 +25
+ Misses 33872 33868 -4
- Partials 6098 6099 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Use `ParamSpec` for the `*args`/`**kwargs` of the `json.dumps` stand-in so the forwarded call no longer needs a `pyrefly: ignore[bad-argument-type]` comment.
pyrefly only accepts `P.args`/`P.kwargs` when the ParamSpec is declared on the function itself, so use the PEP 695 inline form instead of a module-level `ParamSpec` instance.
pyrefly rejects `P.args`/`P.kwargs` from an unbound ParamSpec ("Expected a type form, got instance of ParamSpecArgs") and still complains about unpacking `dict[str, object]` into the named `json.dumps` parameters.
The module under test only ever calls `json.dumps(value)` or `json.dumps(value, ensure_ascii=False)`, so declare exactly that: an explicit `ensure_ascii` keyword. This removes the escape hatch without changing what the test exercises.
|
Since def dumps_side_effect(value: object, *, ensure_ascii: bool = True) -> str:
if value in (tool_input, observation, tool_meta) and ensure_ascii is False:
raise TypeError("fail")
return real_dumps(value, ensure_ascii=ensure_ascii)The |
Summary
Part of the strict Pyrefly rollout for
api/tests/unit_tests. Bring five more core-side test modules back under strict Pyrefly checking by removing them fromproject-excludesand fixing the diagnostics that the exclusion previously hid.No production code changes.
Modifies
api/tests/unit_tests/pyrefly.toml: drop fivecore/exclusions.api/tests/unit_tests/core/app/apps/workflow/test_command_channels.py: annotate the_CommandChannelStubhelpers withgraphon.engine.command.Command.api/tests/unit_tests/core/agent/test_base_agent_runner.py: annotate thejson.dumpsside-effect helper.api/tests/unit_tests/core/app/app_config/easy_ui_based_app/model_config/test_manager.py: add return annotations and two targeted# pyrefly: ignore[...]comments.api/tests/unit_tests/core/app/layers/test_conversation_variable_persist_layer.py: add-> Nonereturn annotations.api/tests/unit_tests/core/workflow/nodes/agent_v2/test_session_store.py: annotate the SQLAlchemy event listener and one local dict.The edits are type annotations and
# pyrefly: ignore[...]comments; test behavior is unchanged.Tests
pyrefly check --config tests/unit_tests/pyrefly.toml --use-ignore-files=false --disable-project-excludes-heuristics=trueover the five files: 0 diagnostics.pyrefly check --config tests/unit_tests/pyrefly.tomlreports the same 11 pre-existing missing-optional-dependency diagnostics as the unmodified tree; no new diagnostics.ruff checkandruff format --checkpass on all five touched files.pytestfor the five modules could not run in this environment because the local Python environment is missing optionalalibabacloudtransitive dependencies pulled in by the unit-test conftest import chain; the changes are annotations only, so no runtime behavior is affected.