refactor(api): type pipeline template retrieval dicts with TypedDict#34874
Merged
asukaminato0721 merged 4 commits intolanggenius:mainfrom Apr 17, 2026
Merged
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-10 00:25:20.914123291 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-10 00:25:11.049071822 +0000
@@ -333,6 +333,18 @@
--> services/hit_testing_service.py:94:21
ERROR `handled_tenant_count` was assigned in the current scope before the nonlocal declaration [unknown-name]
--> services/plugin/plugin_migration.py:91:34
+ERROR Class member `CustomizedPipelineTemplateRetrieval.get_pipeline_templates` overrides parent class `PipelineTemplateRetrievalBase` in an inconsistent manner [bad-override]
+ --> services/rag_pipeline/pipeline_template/customized/customized_retrieval.py:42:9
+ERROR Class member `CustomizedPipelineTemplateRetrieval.get_pipeline_template_detail` overrides parent class `PipelineTemplateRetrievalBase` in an inconsistent manner [bad-override]
+ --> services/rag_pipeline/pipeline_template/customized/customized_retrieval.py:46:9
+ERROR Class member `DatabasePipelineTemplateRetrieval.get_pipeline_templates` overrides parent class `PipelineTemplateRetrievalBase` in an inconsistent manner [bad-override]
+ --> services/rag_pipeline/pipeline_template/database/database_retrieval.py:42:9
+ERROR Class member `DatabasePipelineTemplateRetrieval.get_pipeline_template_detail` overrides parent class `PipelineTemplateRetrievalBase` in an inconsistent manner [bad-override]
+ --> services/rag_pipeline/pipeline_template/database/database_retrieval.py:45:9
+ERROR Returned type `PipelineTemplateDetailDict | None` is not assignable to declared return type `dict[str, Any] | None` [bad-return]
+ --> services/rag_pipeline/pipeline_template/remote/remote_retrieval.py:24:20
+ERROR Returned type `PipelineTemplatesResultDict` is not assignable to declared return type `dict[str, Any]` [bad-return]
+ --> services/rag_pipeline/pipeline_template/remote/remote_retrieval.py:31:20
ERROR `dict[str, Any]` is not assignable to attribute `credentials` with type `Never` [bad-assignment]
--> services/trigger/trigger_provider_service.py:446:40
ERROR `int` is not assignable to attribute `credential_expires_at` with type `Never` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-10 00:46:12.559064720 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-10 00:46:03.599081023 +0000
@@ -329,6 +329,18 @@
--> services/hit_testing_service.py:94:21
ERROR `handled_tenant_count` was assigned in the current scope before the nonlocal declaration [unknown-name]
--> services/plugin/plugin_migration.py:91:34
+ERROR Returned type `CustomizedTemplatesResultDict` is not assignable to declared return type `dict[str, Any]` [bad-return]
+ --> services/rag_pipeline/pipeline_template/customized/customized_retrieval.py:44:16
+ERROR Returned type `CustomizedTemplateDetailDict | None` is not assignable to declared return type `dict[str, Any] | None` [bad-return]
+ --> services/rag_pipeline/pipeline_template/customized/customized_retrieval.py:47:16
+ERROR Returned type `PipelineTemplatesResultDict` is not assignable to declared return type `dict[str, Any]` [bad-return]
+ --> services/rag_pipeline/pipeline_template/database/database_retrieval.py:43:16
+ERROR Returned type `PipelineTemplateDetailDict | None` is not assignable to declared return type `dict[str, Any] | None` [bad-return]
+ --> services/rag_pipeline/pipeline_template/database/database_retrieval.py:46:16
+ERROR Returned type `PipelineTemplateDetailDict | None` is not assignable to declared return type `dict[str, Any] | None` [bad-return]
+ --> services/rag_pipeline/pipeline_template/remote/remote_retrieval.py:24:20
+ERROR Returned type `PipelineTemplatesResultDict` is not assignable to declared return type `dict[str, Any]` [bad-return]
+ --> services/rag_pipeline/pipeline_template/remote/remote_retrieval.py:31:20
ERROR `dict[str, Any]` is not assignable to attribute `credentials` with type `Never` [bad-assignment]
--> services/trigger/trigger_provider_service.py:446:40
ERROR `int` is not assignable to attribute `credential_expires_at` with type `Never` [bad-assignment]
|
Contributor
Pyrefly DiffNo changes detected. |
19ee223 to
06da87f
Compare
Contributor
Pyrefly DiffNo changes detected. |
asukaminato0721
approved these changes
Apr 17, 2026
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.
Part of #32863 (
api/services/rag_pipeline/pipeline_template/)Summary
CustomizedTemplateItemDict,CustomizedTemplatesResultDict,CustomizedTemplateDetailDictTypedDicts tocustomized_retrieval.pyPipelineTemplateItemDict,PipelineTemplatesResultDict,PipelineTemplateDetailDictTypedDicts todatabase_retrieval.pydicttodict[str, Any]inpipeline_template_base.py,built_in_retrieval.py, andremote_retrieval.pyWhy this change
fetch_pipeline_templates_from_db,fetch_pipeline_template_detail_from_db, and their customized counterparts return dicts with well-known fixed keys but were typed as baredict. The TypedDicts make the shape explicit and enable static type checking.Changes
customized_retrieval.py: Define 3 TypedDicts, update 4 method signatures and local annotationsdatabase_retrieval.py: Define 3 TypedDicts, update 4 method signatures and local annotationspipeline_template_base.py: Tighten abstract signatures fromdicttodict[str, Any]built_in_retrieval.py: Tightendicttodict[str, Any](JSON-loaded data, not a TypedDict candidate)remote_retrieval.py: Tightendicttodict[str, Any](external API data), simplify control flow