-
Notifications
You must be signed in to change notification settings - Fork 8.2k
fix: Improve update_flow data consistency, refine error handling, and add folder-moving tests
#5516
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
Merged
Conversation
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
…d in the database during flow update 📝 (flows.py): Improve error handling and rollback database session in case of exceptions during flow update 📝 (flows.py): Refactor code to handle unique constraint errors and provide more informative error messages 📝 (utils.py): Refactor get_webhook_component_in_flow function to handle cases where flow_data may not have 'nodes' attribute
CodSpeed Performance ReportMerging #5516 will degrade performances by 42.59%Comparing Summary
Benchmarks breakdown
|
…r folder buttons for improved accessibility and testing ✨ (general-bugs-move-flow-from-folder.spec.ts): add test to ensure user can move flow from one folder to another in the frontend application
…-ai/langflow into cz/fix-move-flow-folder
ogabrielluiz
requested changes
Jan 3, 2025
…l data inconsistency ♻️ (service.py): refactor with_session method to handle session commit and rollback more effectively
…-ai/langflow into cz/fix-move-flow-folder
… and adding comments for clarity 🔧 (chat.py): refactor code to create a fresh session for database operations and improve session management in build_flow function
…-ai/langflow into cz/fix-move-flow-folder
mieslep
pushed a commit
to mieslep/langflow
that referenced
this pull request
Jan 15, 2025
…nd add folder-moving tests (langflow-ai#5516) * 🐛 (flows.py): Fix issue where flow data was not being properly updated in the database during flow update 📝 (flows.py): Improve error handling and rollback database session in case of exceptions during flow update 📝 (flows.py): Refactor code to handle unique constraint errors and provide more informative error messages 📝 (utils.py): Refactor get_webhook_component_in_flow function to handle cases where flow_data may not have 'nodes' attribute * ✨ (sideBarFolderButtons/index.tsx): add unique id attribute to sidebar folder buttons for improved accessibility and testing ✨ (general-bugs-move-flow-from-folder.spec.ts): add test to ensure user can move flow from one folder to another in the frontend application * 🐛 (flows.py): remove unnecessary session rollback to prevent potential data inconsistency ♻️ (service.py): refactor with_session method to handle session commit and rollback more effectively * style: adjust line breaks for readability * style: reorder imports * fix: ruff error try300 * [autofix.ci] apply automated fixes * fix: mypy error module has no attribute "timeout" * 🐛 (flows.py): remove unnecessary error handling code and improve exception handling for better error propagation and clarity * [autofix.ci] apply automated fixes * Update src/backend/base/langflow/services/database/service.py Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]> * use model dump besides overwrite value * [autofix.ci] apply automated fixes * 📝 (chat.py): improve code readability by refactoring session handling and adding comments for clarity 🔧 (chat.py): refactor code to create a fresh session for database operations and improve session management in build_flow function * [autofix.ci] apply automated fixes * refactor: remove unused session parameter from build_flow function in chat.py --------- Co-authored-by: italojohnny <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
Closed
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.
This pull request includes several changes to improve error handling, update flow data processing, and enhance the frontend functionality. The most important changes include refining exception handling in the
update_flowfunction, ensuring session commits only when active, and adding a new test for moving flows between folders.Backend Changes:
src/backend/base/langflow/api/v1/flows.py: Improved error handling in theupdate_flowfunction by refining the exception handling blocks, ensuring more specific error responses, and excludingNonevalues when dumping flow models. [1] [2]src/backend/base/langflow/services/database/models/flow/utils.py: Added a check for the presence of "nodes" in flow data to avoid potential attribute errors.src/backend/base/langflow/services/database/service.py: Ensured that sessions are only committed when active and added error logging and rollback in case of exceptions during the session scope.Frontend Changes:
src/frontend/src/components/core/folderSidebarComponent/components/sideBarFolderButtons/index.tsx: Added anidattribute to sidebar folder buttons for better identification and interaction.src/frontend/tests/extended/regression/general-bugs-move-flow-from-folder.spec.ts: Added a new Playwright test to verify that users can move flows between folders, ensuring the functionality works as expected.