Decouple WorkflowNodeExecution from SQLAlchemy Model #13368

Closed
opened 2026-02-21 19:11:50 -05:00 by yindo · 1 comment
Owner

Originally created by @laipz8200 on GitHub (Apr 25, 2025).

Originally assigned to: @laipz8200 on GitHub.

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

## Objective

Decouple WorkflowNodeExecution from the SQLAlchemy model to enhance modularity and maintainability.


## Description

  • Create an Independent Structure:

    • Develop a standalone WorkflowNodeExecution structure that will be used exclusively within the Workflow component.
  • Handle SQLAlchemy Model Conversion:

    • Implement the necessary conversions between the new WorkflowNodeExecution structure and its corresponding SQLAlchemy model within the Repository layer.
  • Benefits:

    • Reduces tight coupling between business logic and database models.
    • Facilitates easier testing and potential future changes to the data layer without impacting the Workflow logic.

## Tasks

  1. Design the WorkflowNodeExecution Structure:

    • Define the fields and methods required for the Workflow component.
  2. Implement the Structure:

    • Develop the new WorkflowNodeExecution class or data structure in the appropriate module.
  3. Update the Repository:

    • Modify the Repository implementation to handle the conversion between the SQLAlchemy model and the new WorkflowNodeExecution structure.
  4. Refactor Workflow Components:

    • Update all Workflow-related components to use the new WorkflowNodeExecution structure instead of the SQLAlchemy model.
  5. Testing:

    • Write unit tests to ensure that the conversions and decoupling work as expected.
    • Perform integration testing to verify that the Workflow operates correctly with the new structure.

## Acceptance Criteria

  • The WorkflowNodeExecution structure is fully independent of the SQLAlchemy model.
  • All necessary conversions between the structure and the SQLAlchemy model are handled within the Repository layer.
  • Existing Workflow functionalities operate seamlessly without any regressions.
  • Comprehensive tests are in place to validate the decoupling and conversions.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @laipz8200 on GitHub (Apr 25, 2025). Originally assigned to: @laipz8200 on GitHub. ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. **## Objective** Decouple `WorkflowNodeExecution` from the SQLAlchemy model to enhance modularity and maintainability. --- **## Description** - **Create an Independent Structure:** - Develop a standalone `WorkflowNodeExecution` structure that will be used exclusively within the Workflow component. - **Handle SQLAlchemy Model Conversion:** - Implement the necessary conversions between the new `WorkflowNodeExecution` structure and its corresponding SQLAlchemy model within the Repository layer. - **Benefits:** - Reduces tight coupling between business logic and database models. - Facilitates easier testing and potential future changes to the data layer without impacting the Workflow logic. --- **## Tasks** 1. **Design the `WorkflowNodeExecution` Structure:** - Define the fields and methods required for the Workflow component. 2. **Implement the Structure:** - Develop the new `WorkflowNodeExecution` class or data structure in the appropriate module. 3. **Update the Repository:** - Modify the Repository implementation to handle the conversion between the SQLAlchemy model and the new `WorkflowNodeExecution` structure. 4. **Refactor Workflow Components:** - Update all Workflow-related components to use the new `WorkflowNodeExecution` structure instead of the SQLAlchemy model. 5. **Testing:** - Write unit tests to ensure that the conversions and decoupling work as expected. - Perform integration testing to verify that the Workflow operates correctly with the new structure. --- **## Acceptance Criteria** - The `WorkflowNodeExecution` structure is fully independent of the SQLAlchemy model. - All necessary conversions between the structure and the SQLAlchemy model are handled within the Repository layer. - Existing Workflow functionalities operate seamlessly without any regressions. - Comprehensive tests are in place to validate the decoupling and conversions. ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 19:11:50 -05:00
yindo closed this issue 2026-02-21 19:11:50 -05:00
Author
Owner

@laipz8200 commented on GitHub (May 21, 2025):

finished in #19430

@laipz8200 commented on GitHub (May 21, 2025): finished in #19430
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13368