refactor(api): migrate service api workflow responses from marshal_with to BaseModel#35195
Merged
asukaminato0721 merged 3 commits intolanggenius:mainfrom Apr 14, 2026
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 17:08:12.417560738 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 17:08:01.027673639 +0000
@@ -14,6 +14,8 @@
--> controllers/console/setup.py:65:2
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/version.py:30:2
+ERROR `Mapping[str, Any] | dict[Unknown, Unknown]` is not assignable to variable `outputs` with type `dict[Unknown, Unknown]` [bad-assignment]
+ --> controllers/service_api/app/workflow.py:166:19
ERROR Class member `EasyUIBasedGenerateTaskPipeline._application_generate_entity` overrides parent class `BasedGenerateTaskPipeline` in an inconsistent manner [bad-override]
--> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:75:5
ERROR `+=` is not supported between `list[PromptMessageContentUnionTypes]` and `str` [unsupported-operation]
@@ -2133,27 +2135,25 @@
ERROR Argument value `Literal[102]` violates Pydantic `le` constraint `Literal[101]` for field `limit` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_message.py:188:31
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:92:20
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:109:20
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:154:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:171:30
ERROR Argument value `Literal[100000]` violates Pydantic `le` constraint `Literal[99999]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:159:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:176:30
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:164:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:181:30
ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:169:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:186:30
ERROR Object of class `dict` has no attribute `page` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:220:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:237:16
ERROR Object of class `dict` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:221:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:238:16
ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:348:16
-ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunStatusField.output` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:12:35
-ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:19:36
-ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:26:36
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:365:16
+ERROR Could not import `WorkflowRunOutputsField` from `controllers.service_api.app.workflow` [missing-module-attribute]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:5:50
+ERROR Could not import `WorkflowRunStatusField` from `controllers.service_api.app.workflow` [missing-module-attribute]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:5:75
ERROR Missing argument `datasource_info_list` in function `services.rag_pipeline.entity.pipeline_service_api_entities.PipelineRunApiEntity.__init__` [missing-argument]
--> tests/unit_tests/controllers/service_api/dataset/rag_pipeline/test_rag_pipeline_workflow.py:327:33
ERROR Missing argument `start_node_id` in function `services.rag_pipeline.entity.pipeline_service_api_entities.PipelineRunApiEntity.__init__` [missing-argument]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 18:25:57.516359950 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 18:25:46.578298007 +0000
@@ -14,6 +14,8 @@
--> controllers/console/setup.py:65:2
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
--> controllers/console/version.py:30:2
+ERROR `Mapping[str, Any] | dict[Unknown, Unknown]` is not assignable to variable `outputs` with type `dict[Unknown, Unknown]` [bad-assignment]
+ --> controllers/service_api/app/workflow.py:181:19
ERROR Class member `EasyUIBasedGenerateTaskPipeline._application_generate_entity` overrides parent class `BasedGenerateTaskPipeline` in an inconsistent manner [bad-override]
--> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:75:5
ERROR `+=` is not supported between `list[PromptMessageContentUnionTypes]` and `str` [unsupported-operation]
@@ -2135,21 +2137,21 @@
ERROR Argument value `Literal[102]` violates Pydantic `le` constraint `Literal[101]` for field `limit` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_message.py:188:31
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:92:20
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:109:20
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:154:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:171:30
ERROR Argument value `Literal[100000]` violates Pydantic `le` constraint `Literal[99999]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:159:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:176:30
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:164:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:181:30
ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:169:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:186:30
ERROR Object of class `dict` has no attribute `page` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:220:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:237:16
ERROR Object of class `dict` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:221:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:238:16
ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:348:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:365:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunStatusField.output` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:12:35
ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 18:45:14.114361134 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 18:45:03.486525034 +0000
@@ -2123,21 +2123,21 @@
ERROR Argument value `Literal[102]` violates Pydantic `le` constraint `Literal[101]` for field `limit` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_message.py:188:31
ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:92:20
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:109:20
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:154:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:171:30
ERROR Argument value `Literal[100000]` violates Pydantic `le` constraint `Literal[99999]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:159:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:176:30
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:164:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:181:30
ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:169:30
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:186:30
ERROR Object of class `dict` has no attribute `page` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:220:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:237:16
ERROR Object of class `dict` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:221:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:238:16
ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/app/test_workflow.py:348:16
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:365:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunStatusField.output` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:12:35
ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
|
asukaminato0721
approved these changes
Apr 14, 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 #28015
Summary
Extract Flask-RESTX response serialization in
api/controllers/service_api/app/workflow.pyinto PydanticResponseModelclasses and register them withregister_schema_models(). Remove@marshal_withand inlinefields-based workflow run/log response models from this controller.Checklist
make lintandmake type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods