Repository navigation
test(api): use unbound session in app generate tests - #45130
Merged
asukaminato0721 merged 1 commit intoOct 30, 2026
Merged
asukaminato0721 merged 1 commit into
asukaminato0721 merged 1 commit into
Conversation
Signed-off-by: lj1166 <2832274602@qq.com>
asukaminato0721
enabled auto-merge
October 30, 2026 07:43
asukaminato0721
approved these changes
Oct 30, 2026
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-30 07:44:50.527378984 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-30 07:44:36.679397154 +0000
@@ -2773,33 +2773,17 @@
ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
--> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:195:71
ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:207:71
-ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:208:23
-ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:215:75
-ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:216:27
-ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:221:71
-ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:222:25
-ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:229:71
-ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:230:25
-ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:242:71
+ --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:205:71
ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:255:71
+ --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:218:71
ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:263:71
+ --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:226:71
ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:264:38
+ --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:227:38
ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:284:71
+ --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:247:71
ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
- --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:286:25
+ --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:249:25
ERROR `None` is not assignable to attribute `agent_callback` with type `DifyAgentCallbackHandler` [bad-assignment]
--> tests/unit_tests/core/agent/test_cot_agent_runner.py:121:29
ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
|
Contributor
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #45130 +/- ##
==========================================
- Coverage 80.57% 80.56% -0.01%
==========================================
Files 6239 6239
Lines 396374 396374
Branches 79948 79948
==========================================
- Hits 319365 319354 -11
- Misses 70712 70724 +12
+ Partials 6297 6296 -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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #44973.
Replaces the three remaining placeholder
MagicMock()sessions intest_app_generate_service.pywith the sharedunbound_sessionfixture already used byTestGenerate. These paths mock the workflow lookup and should not require database access; the unbound fixture keeps that contract explicit by failing if a test unexpectedly touches a bound database.Screenshots
Not applicable; this is a backend unit-test-only change.
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods.Verification
uv run --no-sync --project api pytest api/tests/unit_tests/services/test_app_generate_service.py-> 59 passeduv run --no-sync --project api ruff check api/tests/unit_tests/services/test_app_generate_service.pyuv run --no-sync --project api ruff format --check api/tests/unit_tests/services/test_app_generate_service.pyFrom Codex