8000 feat(workflows): if/else, loops, dynamic ports and custom nodes on the canvas by adeelahmad · Pull Request #68 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(workflows): if/else, loops, dynamic ports and custom nodes on the canvas - #68

Merged
adeelahmad merged 4 commits into
mainfrom
claude/project-thread-plefg5
Oct 3, 2026
Merged

adeelahmad merged 4 commits into
mainfrom
claude/project-thread-plefg5

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: a workflow was a straight graph of fixed nodes. The only branch was a yes/no condition, nothing could repeat, every node had one input and one output, and there was no way to package nodes for reuse.

After: the canvas works the way n8n and Langflow do. You get:

  • Ports: nodes have named input and output ports.
  • Switch: branches to any number of cases plus a default.
  • Loops: For each runs a body over a list. Repeat runs a body until a test passes or a round limit is reached.
  • Data nodes: Set fields and Template shape data.
  • Groups: you can select nodes and group them. You can also save them as a custom node with its own parameters, icon and colour.
  • Sharing: a custom node can be private, shared with chosen namespaces, or shared with everyone signed in.
  • Versions: custom nodes are versioned. A workflow pins the version it was saved with, so a later edit or delete never breaks it.
  • Try: dry-runs a workflow on a recording and shows what each node produced, without saving anything.

Existing workflows run unchanged, because old condition edges are read as ports.

Motivation and Context

Adeel asked that workflows and pipelines be fully customizable without friction, including the nodes themselves: primitive nodes users can extend or combine into private or shared custom nodes. We stayed on React Flow (MIT, already in use). Langflow and VisualFlow are both built on it. Flow-Like is a BSL Rust/Tauri app and can't be embedded. Formity is a forms library.

How: a single engine (app/domain/flow.py) now runs both recording and organize workflows. It covers port-aware DAG ordering, skipping of untaken branches, loop and group bodies as nested graphs, and step, depth and node budgets. app/domain/custom_nodes.py with /api/v1/custom-nodes stores versioned custom nodes, along with their visibility and parameters ({"$param": name} references). POST /api/v1/workflows/test is the dry run. On the frontend, GraphEditor adds breadcrumbs into bodies, multi-select, fold into a group or custom node, and parameter settings. Custom nodes also get a tab and an editor under Workflows. The OpenAPI client was regenerated with make openapi.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Validation, run locally:

  • Backend: 354 passed. The one failure, test_office_and_text_files_become_documents, is because LibreOffice in the container can't load the docx, which is unrelated.
  • Frontend: 550 jest tests pass, and tsc, eslint, ruff and mypy are clean.
  • Browser: checked grouping, opening bodies, saving a custom node and publishing.

🤖 Generated with Claude Code

https://claude.ai/code/session_012EHxSymUdfN5QfB1y384zm


Generated by Claude Code

claude added 3 commits October 3, 2026 00:31
…and custom nodes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EHxSymUdfN5QfB1y384zm
The editor draws named input and output ports, opens loop and group bodies with a breadcrumb, folds selected nodes into a group or a saved custom node, sets custom node parameters, and dry-runs a workflow on a recording with a per-node trace. Custom nodes get their own tab and editor with versions and sharing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EHxSymUdfN5QfB1y384zm
OpenAPI client regenerated with make openapi.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EHxSymUdfN5QfB1y384zm
@adeelahmad adeelahmad self-assigned this Oct 3, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EHxSymUdfN5QfB1y384zm
@adeelahmad
adeelahmad merged commit 56fe1d2 into main Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0