OpenFn / OpenFn/lightning

WorkflowLive.Edit: Reduce Complexity and Improve Maintainability

Open
#3,428 0 comments 0 reactions 2 assignees View on GitHub

@theroinaochieng is already working on this.

Since Jul 16, 2025.

Dominant language
Elixir
Stars
296
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
50

Description

Description

The LightningWeb.WorkflowLive.Edit module has grown to over 3000 lines and handles numerous responsibilities, making it difficult to maintain, test, and understand. This technical debt needs to be addressed through a comprehensive refactoring effort.

Current Issues
  1. Size and Complexity: The module is extremely large with 3000+ lines of code

  2. Multiple Responsibilities: It handles:

    • Workflow editing UI
    • Job management
    • Trigger management
    • Edge/path management
    • Manual run execution
    • AI assistant integration
    • GitHub sync functionality
    • Version control/snapshots
    • Presence tracking
    • Real-time updates
    • Template publishing
  3. Complex State Management: The socket assigns contain 40+ fields

  4. Event Handler Overload: 30+ different event handlers in a single module

  5. Nested Conditionals: Deep nesting in render functions and event handlers

  6. Mixed Concerns: UI rendering, business logic, and data persistence are intertwined

Proposed Refactoring Strategy
  1. Extract Components: Break down the large render function into smaller, focused components

  2. Separate Concerns: Create dedicated modules for:

    • Workflow state management
    • Job operations
    • Trigger operations
    • Version control operations
    • AI assistant integration
    • Manual run handling
  3. Simplify Event Handling: Group related events and delegate to specialized handlers

  4. Improve State Management: Consider using a more structured approach to state management

  5. Extract Business Logic: Move complex business logic out of the LiveView into service modules

Expected Benefits
  • Improved maintainability and readability
  • Easier testing of individual components
  • Better separation of concerns
  • Reduced cognitive load for developers
  • Faster development of new features

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.