Repository navigation
test(api): bring the advanced prompt transform tests under strict pyrefly - #45968
Conversation
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #45968 +/- ##
==========================================
- Coverage 90.41% 90.35% -0.06%
==========================================
Files 6334 6370 +36
Lines 396673 402877 +6204
Branches 79711 80658 +947
==========================================
+ Hits 358637 364014 +5377
- Misses 31928 32451 +523
- Partials 6108 6412 +304
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:
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-11-16 13:05:47.962405141 +0000
+++ /tmp/pyrefly_pr.txt 2026-11-16 13:05:32.806259049 +0000
@@ -3940,8 +3940,6 @@
--> tests/unit_tests/core/plugin/impl/test_plugin.py:1900:24
ERROR `in` is not supported between `Literal['Service temporarily unavailable']` and `None` [not-iterable]
--> tests/unit_tests/core/plugin/impl/test_plugin.py:1917:24
-ERROR Argument `Literal['x']` is not assignable to parameter `edition_type` with type `Literal['basic', 'jinja2'] | None` in function `graphon.prompt_entities.ChatModelMessage.model_construct` [bad-argument-type]
- --> tests/unit_tests/core/prompt/test_advanced_prompt_transform.py:333:115
ERROR Argument `dict[str, str]` is not assignable to parameter `reranking_model` with type `RerankingModelDict | None` in function `core.rag.data_post_processor.data_post_processor.DataPostProcessor.__init__` [bad-argument-type]
--> tests/unit_tests/core/rag/data_post_processor/test_data_post_processor.py:28:37
ERROR Argument `dict[str, str]` is not assignable to parameter `weights` with type `WeightsDict | None` in function `core.rag.data_post_processor.data_post_processor.DataPostProcessor.__init__` [bad-argument-type]
|
# Conflicts: # api/tests/unit_tests/pyrefly.toml
|
CI is fixed: merged current main (resolving the |
asukaminato0721
left a comment
There was a problem hiding this comment.
4 inline suggestions at e8dde5c205, each from a rule learned from earlier reviews in this repository. Reply on a comment if it is wrong.
dify-codereview
asukaminato0721
left a comment
There was a problem hiding this comment.
1 inline suggestion at 52eca9f826, from a rule learned from earlier reviews in this repository. Reply on the comment if it is wrong. 4 review threads are still unresolved.
dify-codereview
asukaminato0721
left a comment
There was a problem hiding this comment.
Checked 6683d76b2a. 4 review threads are still unresolved.
dify-codereview
|
All four threads are addressed and resolved: the invalid-input cases were removed, the no-memory test uses the real token-budget calculation, and the remaining stubs are explained in-line. CI is green on |
asukaminato0721
left a comment
There was a problem hiding this comment.
Nothing to flag at 6683d76b2a.
dify-codereview
Nothing left to flag at 6683d76.
Upstream graduated test_advanced_prompt_transform.py under langgenius#45968 at the same time as this branch, so take the upstream rewrite of that test file (it already carries strict types) and keep this branch's other graduates; pyrefly.toml is rebuilt by set arithmetic from the merge base, this branch and upstream.
Summary
core/prompt/test_advanced_prompt_transform.pywas excluded from strict pyrefly. Annotating it lets the module leave the exclusion list.-> Noneto the test functionsget_chat_model_argsfixture with a sharedChatModelArgsalias carrying the real entity typescast(list, ...)tolist[ChatModelMessage]Tests
pyrefly check(strict preset): 0 diagnostics.ruff check/ruff format --check: clean.pytest: 14 passed.