-
Notifications
You must be signed in to change notification settings - Fork 75
fix: refactor the execution output logic using object-oriented approach #412
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
Conversation
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 the execution output logic by introducing an object-oriented approach that replaces the large switch statements with a factory pattern and individual handler classes for each node type. This improves code maintainability and eliminates duplication in output processing logic.
Key changes:
- Introduces a
NodeOutputHandlerinterface and factory pattern for managing different node types - Replaces extensive switch statements with handler-based delegation in
extractExecutionResultandRunNodeImmediatelyRPC - Creates individual handler classes for each node type (RestAPI, CustomCode, Balance, etc.) in the new file
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| core/taskengine/run_node_immediately.go | Refactored to use handler-based approach, removed large switch statements, added node type detection fallback |
| core/taskengine/node_output_handlers.go | New file containing handler interface, factory, and individual handlers for each node type |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ch (#412) * fix: refactor the execution output logic using object-oriented approach * added helper functin for type conversion: assignOutputData * fix: metadata field not available after refactor * Remove the deprecated old code * fix: added two-phase balance retrival for BalanceNode * Added integration tests for the BalanceNode * fix: test of TestBalanceNode_MissingAPIKey --------- Co-authored-by: Chris Li <[email protected]>
…ch (#412) * fix: refactor the execution output logic using object-oriented approach * added helper functin for type conversion: assignOutputData * fix: metadata field not available after refactor * Remove the deprecated old code * fix: added two-phase balance retrival for BalanceNode * Added integration tests for the BalanceNode * fix: test of TestBalanceNode_MissingAPIKey --------- Co-authored-by: Chris Li <[email protected]>
This pull request refactors the node output processing logic in
core/taskengine/run_node_immediately.goto use a handler-based, object-oriented approach. The main goal is to eliminate code duplication, centralize output handling for different node types, and improve maintainability. Instead of using large switch statements, the code now delegates output extraction and protobuf conversion to specialized handlers.Refactoring for handler-based node output processing:
extractExecutionResultwith a handler-based approach using aNodeOutputHandlerFactoryand node-specific handlers, which centralizes and simplifies output extraction for all node types.detectNodeTypeFromStepto determine the node type from the execution step as a fallback when the type is not explicitly set.Improvements to RPC response construction:
RunNodeImmediatelyRPCto use handlers for creating empty output structures on failure, replacing the previous switch-based logic.Codebase cleanup:
Dependency management: