refactor(api): add null safety to extract_processor and firecrawl retry method#34809
Open
tmimmanuel wants to merge 5 commits intolanggenius:mainfrom
Open
refactor(api): add null safety to extract_processor and firecrawl retry method#34809tmimmanuel wants to merge 5 commits intolanggenius:mainfrom
tmimmanuel wants to merge 5 commits intolanggenius:mainfrom
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-09 04:52:52.931814192 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-09 04:52:43.049788766 +0000
@@ -247,18 +247,6 @@
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:47
ERROR Argument `list[float] | list[list[float]] | None` is not assignable to parameter `vector` with type `Iterable[LaxFloat] | None` in function `core.rag.models.document.Document.__init__` [bad-argument-type]
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:60
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:116:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:126:62
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:152:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:158:62
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:183:16
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:192:16
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.post` [bad-argument-type]
--> core/rag/extractor/notion_extractor.py:106:25
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.request` [bad-argument-type]
|
Contributor
Author
|
@asukaminato0721. Please review. |
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-10 17:49:21.726426926 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-10 17:49:13.049322650 +0000
@@ -259,18 +259,6 @@
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:47
ERROR Argument `list[float] | list[list[float]] | None` is not assignable to parameter `vector` with type `Iterable[LaxFloat] | None` in function `core.rag.models.document.Document.__init__` [bad-argument-type]
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:60
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:116:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:126:62
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:152:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:158:62
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:183:16
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:192:16
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.post` [bad-argument-type]
--> core/rag/extractor/notion_extractor.py:106:25
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.request` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-10 17:53:51.263669690 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-10 17:53:42.871714294 +0000
@@ -259,18 +259,6 @@
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:47
ERROR Argument `list[float] | list[list[float]] | None` is not assignable to parameter `vector` with type `Iterable[LaxFloat] | None` in function `core.rag.models.document.Document.__init__` [bad-argument-type]
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:60
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:116:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:126:62
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:152:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:158:62
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:183:16
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:192:16
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.post` [bad-argument-type]
--> core/rag/extractor/notion_extractor.py:106:25
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.request` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-13 03:06:48.115322433 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-13 03:06:39.979375721 +0000
@@ -259,18 +259,6 @@
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:47
ERROR Argument `list[float] | list[list[float]] | None` is not assignable to parameter `vector` with type `Iterable[LaxFloat] | None` in function `core.rag.models.document.Document.__init__` [bad-argument-type]
--> core/rag/datasource/vdb/weaviate/weaviate_vector.py:467:60
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:116:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:126:62
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:152:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:158:62
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:183:16
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:192:16
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.post` [bad-argument-type]
--> core/rag/extractor/notion_extractor.py:106:25
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.request` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 05:19:55.064381593 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 05:19:44.457377414 +0000
@@ -78,18 +78,6 @@
--> core/rag/datasource/keyword/jieba/jieba.py:157:29
ERROR Argument `object` is not assignable to parameter `iterable` with type `Iterable[@_]` in function `list.__init__` [bad-argument-type]
--> core/rag/datasource/keyword/jieba/jieba_keyword_table_handler.py:88:35
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:116:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:126:62
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:152:61
-ERROR `upload_file` may be uninitialized [unbound-name]
- --> core/rag/extractor/extract_processor.py:158:62
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:183:16
-ERROR `response` may be uninitialized [unbound-name]
- --> core/rag/extractor/firecrawl/firecrawl_app.py:192:16
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.post` [bad-argument-type]
--> core/rag/extractor/notion_extractor.py:106:25
ERROR Argument `dict[str, bytes | str]` is not assignable to parameter `headers` with type `Headers | Mapping[bytes, bytes] | Mapping[str, str] | Sequence[tuple[bytes, bytes]] | Sequence[tuple[str, str]] | None` in function `httpx._api.request` [bad-argument-type]
|
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
upload_filepossibly-unbound variable inextract_processor.pybybinding it before the
file_pathcheck and adding assert guards at PDF/DOCXextractor call sites
responsepossibly-unbound variable infirecrawl_app.pyby initializingbefore retry loops with assert after loop completion
Test plan
make type-check-corepasses with 0 errorsPart of #26412