-
Notifications
You must be signed in to change notification settings - Fork 19.5k
refactor: port api/controllers/console/app/workflow.py #30680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @asukaminato0721, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the workflow controller's API response handling by adopting Pydantic models for data serialization. This modernization effort aims to improve the robustness, maintainability, and clarity of API responses, ensuring better data consistency and validation across the application. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the api/controllers/console/app/workflow.py file to use Pydantic models for request and response validation and serialization, replacing the previous flask_restx field definitions. This is a great improvement for type safety and maintainability. The changes are well-implemented, and the addition of unit tests for the new response models is much appreciated.
I have a couple of suggestions to further improve the code by reducing duplication and ensuring consistency. Please see my comments below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors api/controllers/console/app/workflow.py by migrating from flask-restx field definitions to Pydantic models for response serialization. This is part of a broader effort (#28015) to align API models with request parsers across the codebase.
Key Changes:
- Replaced flask-restx
fieldsandmarshal_withdecorators with PydanticResponseModelclasses - Introduced custom serialization logic for environment variables (with secret masking) and conversation variables
- Added comprehensive unit tests for the new Pydantic response models
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| api/controllers/console/app/workflow.py | Replaced flask-restx field definitions with Pydantic models (WorkflowResponse, WorkflowPaginationResponse, WorkflowRunNodeExecutionResponse), added helper classes (SimpleAccount, SimpleEndUser, EnvironmentVariable, ConversationVariable, PipelineVariable), and implemented custom serialization with _dump_response() function |
| api/tests/unit_tests/controllers/console/app/test_workflow_response_models.py | Added unit tests for the new Pydantic response models, testing secret variable masking, nested entity serialization, and pagination response handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not workflow: | ||
| return None |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API documentation at line 827 indicates this endpoint returns a WORKFLOW_RESPONSE_SCHEMA on 200, but the implementation can return None (line 844). This creates an inconsistency between the documented API schema and actual behavior. The endpoint should either always return a WorkflowResponse schema (and raise a 404 when not found, similar to DraftWorkflowApi.get), or the response documentation should be updated to indicate it can return null/None.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not workflow: | ||
| return None | ||
| return _dump_response(WorkflowResponse, workflow) |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The endpoint returns None when the published workflow is not found, but the API response schema at line 817 documents that a 404 response should be returned for "Published workflow not found". The behavior should be consistent with other similar endpoints like DraftWorkflowApi.get (line 426-427) which raises DraftWorkflowNotExist instead of returning None. Consider raising an appropriate NotFound exception instead of returning None.
Important
Fixes #<issue number>.Summary
part of #28015
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods