Repository navigation
Conversation
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #42774 +/- ##
===========================================
+ Coverage 68.81% 89.79% +20.97%
===========================================
Files 6103 6239 +136
Lines 368966 390931 +21965
Branches 77839 79283 +1444
===========================================
+ Hits 253920 351045 +97125
+ Misses 112237 33787 -78450
- Partials 2809 6099 +3290
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:
|
|
Pushed |
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-20 03:20:08.455272740 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-20 03:19:59.049235588 +0000
@@ -3012,6 +3012,10 @@
--> tests/unit_tests/core/entities/test_entities_provider_configuration.py:974:23
ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
--> tests/unit_tests/core/entities/test_entities_provider_configuration.py:1174:23
+ERROR Could not find name `sqlite_session` [unknown-name]
+ --> tests/unit_tests/core/external_data_tool/api/test_api.py:130:28
+ERROR Could not find name `sqlite_session` [unknown-name]
+ --> tests/unit_tests/core/external_data_tool/api/test_api.py:147:28
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/file/test_remote_fetcher.py:41:58
ERROR Class member `_ModelInstance.invoke_llm` overrides parent class `ModelInstance` in an inconsistent manner [bad-override]
|
|
Pushed The pyrefly errors came from my helper version of the change — the test updates mocked With the session inlined at the call sites, main's own test file (real SQLite via the |
|
Reworked after the review: the helper is gone, each method reads the session locally, and |
|
Reworked per the review: the session is a parameter now, not a local.
Six files, +65/-60, pushed as Not run on my side: Could you take another look when you have a moment? |
|
Heads-up: the branch conflicted with I merged Still not run: |
|
Fixed the one red check. Naming the argument is constrained, not free:
One thing I did not touch: |
Head branch was pushed to by a user without write access
55e1ae3 to
a1533d6
Compare
|
Rebased onto current
|
|
Removed in
This also matches the PR's own thesis - the whole point is that callers pass the session in explicitly, so the tests shouldn't reach for the global either. Sorry for the churn on the earlier force-push. |
|
Follow-up in
Net effect: the session passed in every test is a real SQLAlchemy session from the shared SQLite fixture, and nothing in the tests references |
…us#37403) Rebuilt on latest main (80265fc): keeps main's Ruff B904 `raise ... from e` in api.py and the `-> None` annotations from langgenius#44815 in test_factory.py, while carrying the explicit session passing through base/factory/api and the corresponding unit-test updates.
9f939d4 to
12e8bc3
Compare
|
Rebased on latest main (
The branch is now rebuilt as a single commit on top of current main. CI will re-run; happy to address anything the new strict-typing rules surface. |
Summary
ApiExternalDataTool.validate_configandqueryeach repeated theAPIBasedExtensionlookup by reaching for the globaldb.sessioninside the query block. Each method now reads the session into a local (session: Session | scoped_session = db.session) and runs the lookup through it, so the session a call uses is visible at the call site.Refs #37403
Review follow-up
_get_api_based_extensionhelper is removed and the lookup is inlined in both methods.api/tests/unit_tests/core/external_data_tool/api/test_api.pyis back to itsmainstate. The helper-mocking tests patched the removed method, which is what failed the API unit shards; main's tests drive the real SQLite session through the module-leveldbbinding and cover the inlined calls directly.Checklist
No new tests: the inlined calls are covered by the existing
test_api.pysuite.Screenshots or Videos
N/A
From Claude Code