Skip to content

Comments

feat: KEEP-1491 redesign condition node with visual query builder and dual output paths#411

Open
joelorzet wants to merge 20 commits intostagingfrom
KEEP-1491-Redesign-Condition-Node-with-Visual-Query-Builder-Interface-and-Dual-Output-Paths
Open

feat: KEEP-1491 redesign condition node with visual query builder and dual output paths#411
joelorzet wants to merge 20 commits intostagingfrom
KEEP-1491-Redesign-Condition-Node-with-Visual-Query-Builder-Interface-and-Dual-Output-Paths

Conversation

@joelorzet
Copy link

@joelorzet joelorzet commented Feb 23, 2026

Summary

  • Add a visual condition query builder UI with mode toggle (query builder / expression), replacing the raw expression-only input for Condition nodes
  • Implement dual output handles (true/false) on condition nodes, enabling explicit branching on the workflow canvas
  • Add handle-aware condition routing in both the workflow executor and code generator, so each branch follows the correct true/false path
  • Update MCP schema to document condition node dual output handles and edge sourceHandle usage
  • Add condition builder types, expression conversion utilities, and comprehensive unit tests (85 tests)

Changes

Core (keeperhub/)

  • keeperhub/lib/condition-builder-types.ts -- condition builder type definitions (groups, rules, operators)
  • keeperhub/lib/condition-builder-utils.ts -- expression-to-builder and builder-to-expression conversion utilities
  • keeperhub/lib/edge-handle-utils.ts -- shared utility for building handle-aware edge maps (used by executor and codegen)
  • keeperhub/components/workflow/condition-query-builder.tsx -- visual query builder UI component
  • keeperhub/api/mcp/schemas/route.ts -- updated MCP schema for condition dual handles

Workflow engine

  • lib/workflow-executor.workflow.ts -- handle-aware condition routing in executor
  • lib/workflow-codegen.ts -- handle-aware condition routing in codegen with resolveConditionTargets helper, multi-target parallel support
  • lib/condition-validator.ts -- fix false positive on template node IDs
  • lib/workflow-store.ts -- pre-fetch execution logs on workflow load for autocomplete

UI

  • components/workflow/workflow-canvas.tsx -- dual output handle rendering and edge management
  • components/workflow/nodes/action-node.tsx -- true/false handle ports on condition nodes
  • components/workflow/config/action-config.tsx -- query builder integration in config panel, single-parse mode derivation
  • components/workflow/node-config-panel.tsx -- mode toggle support
  • components/overlays/configuration-overlay.tsx -- overlay adjustments for builder
  • components/ui/template-badge-input.tsx -- improved badge deletion behavior

Tests

  • tests/unit/condition-builder-utils.test.ts -- 67 tests for expression conversion utilities
  • tests/unit/condition-codegen-handles.test.ts -- 9 tests for handle-aware codegen
  • tests/unit/condition-executor-handles.test.ts -- 9 tests for buildEdgesBySourceHandle and identifyLoopBody handle filtering

@joelorzet joelorzet requested review from a team, OleksandrUA, eskp, suisuss and taitsengstock and removed request for a team February 23, 2026 22:04
@github-actions
Copy link

🚀 PR Environment Deployed

Your PR environment has been successfully deployed!

Environment Details:

Components:

  • ✅ Keeperhub Application
  • ✅ PostgreSQL Database (isolated instance)
  • ✅ LocalStack (SQS emulation)

The environment will be automatically cleaned up when this PR is closed or merged.

@github-actions
Copy link

🚀 PR Environment Deployed

Your PR environment has been successfully deployed!

Environment Details:

Components:

  • ✅ Keeperhub Application
  • ✅ PostgreSQL Database (isolated instance)
  • ✅ LocalStack (SQS emulation)

The environment will be automatically cleaned up when this PR is closed or merged.

Copy link

@suisuss suisuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

suisuss
suisuss previously approved these changes Feb 24, 2026
@suisuss suisuss dismissed their stale review February 24, 2026 02:51

I broke PR deploy apparently

…ests

Introduce the visual condition builder data model:
- ConditionRule, ConditionGroup, ConditionOperator types
- visualConditionToExpression: converts visual tree to JS expression
- expressionToConditionGroup: parses expression back to visual form
- Operator metadata with labels, unary flags, and categories
- Empty rule skipping to prevent false positives from unfilled rules
Condition nodes now render two source handles like For Each nodes.
Canvas auto-assigns sourceHandle on condition edges and onConnect.
New ConditionQueryBuilder component for visual rule editing with
AND/OR groups, operator dropdowns, and nested group support.
ConditionFields provides Visual/Expression mode toggle.
Widen config value type to support structured conditionConfig objects.
Build edgesBySourceHandle map from edge sourceHandle metadata.
Condition nodes route to true/false targets based on evaluation result.
Falls back to legacy gate behavior for edges without sourceHandle.
Propagates handle map through loop body execution for nested conditions.
Use edgesBySourceHandle to resolve true/false targets in generated code.
Falls back to positional edge order for legacy workflows.
Document sourceHandles, conditionConfig field, and branch behavior.
Update tips to reflect handle-based edge routing.
Strip {{@...}} template variables before checking for dangerous keywords
so node IDs like 'process' don't trigger the security check.
Rewrite Backspace/Delete handler to walk up ancestors for badge detection,
check adjacent children at container level, and handle empty text nodes.
Eagerly fetch last execution logs when a workflow loads so template
autocomplete has runtime output data immediately. Guards against stale
data from navigation race conditions by checking current workflow ID.
- Codegen: support multiple targets per handle (use generateParallelNodeCode
  instead of single-node codegen). Fixes silent target drop.
- Executor: filter handle targets to body-only nodes in identifyLoopBody
  to prevent condition handles routing outside loop body.
- MCP schema: fix edgeStructure.note contradiction (was "Do NOT use
  sourceHandle" while tips said to use it for Condition nodes).
- UI: fix hasPersisted ref not resetting across node switches, clear
  conditionConfig when switching to expression mode, memoize empty group.
- Widen ConfigValue to include undefined, replacing the `"" as unknown as
  ConfigValue` cast when clearing conditionConfig on mode switch
- Extract buildEdgesBySourceHandle() into keeperhub/lib/edge-handle-utils.ts,
  replacing duplicated map-building logic in workflow-codegen.ts and
  workflow-executor.workflow.ts
- Use EdgesBySourceHandle type alias in LoopBodyInfo, identifyLoopBody,
  and executeBodyNode parameters
- Eliminate double expressionToConditionGroup parse on initial load by
  combining parsedGroup and initialMode into a single useMemo
- Extract resolveConditionTargets() helper in codegen, replacing
  duplicated handle/fallback logic in generateConditionNodeCode and
  generateConditionBranchCode
- Add condition-executor-handles.test.ts with 9 tests covering
  buildEdgesBySourceHandle and identifyLoopBody handle-aware filtering
The edgeStructure note only mentioned Condition nodes using sourceHandle
but For Each nodes also use it (loop/done). Updated to document both.
The empty catch swallowed all errors silently, making failures
impossible to diagnose. Added console.debug for visibility.
When both true and false handles already have edges, reject the new
connection by returning current edges unchanged. Previously a third
edge would silently be assigned to the false handle.
In executeBodyNode, when a condition node had handle-aware edges but
the chosen handle (true/false) had no targets, execution would skip
downstream continuation entirely. Now falls through to bodyEdgesBySource
when the chosen handle has zero targets.
Long operator labels like "greater than or equal" could cause layout
shifts on narrow panels. Fixed width ensures consistent alignment.
@suisuss suisuss force-pushed the KEEP-1491-Redesign-Condition-Node-with-Visual-Query-Builder-Interface-and-Dual-Output-Paths branch from 0cf7459 to 50c5c23 Compare February 24, 2026 02:59
@github-actions
Copy link

🚀 PR Environment Deployed

Your PR environment has been successfully deployed!

Environment Details:

Components:

  • Keeperhub Application
  • PostgreSQL Database (isolated instance)
  • LocalStack (SQS emulation)
  • Redis (isolated instance)
  • Scheduler Dispatcher (staging image)
  • Scheduler Executor (staging image)
  • SC Event Tracker (staging image)
  • SC Event Worker (staging image)

The environment will be automatically cleaned up when this PR is closed or merged.

@suisuss suisuss self-requested a review February 24, 2026 03:59
suisuss
suisuss previously approved these changes Feb 24, 2026
Copy link

@suisuss suisuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had to rebase with staging to fix the redis deploy issue.

LGTM

@techops-services techops-services deleted a comment from github-actions bot Feb 24, 2026
@techops-services techops-services deleted a comment from github-actions bot Feb 24, 2026
…ayout

Add == and != as separate operators alongside === and !==. Move the
delete button inline to the right of each condition row and align the
AND/OR logic toggle with the operator column. Re-parse stored visual
config when it drifts from the actual expression so legacy conditions
render correctly.
@github-actions
Copy link

🚀 PR Environment Deployed

Your PR environment has been successfully deployed!

Environment Details:

Components:

  • Keeperhub Application
  • PostgreSQL Database (isolated instance)
  • LocalStack (SQS emulation)
  • Redis (isolated instance)
  • Scheduler Dispatcher (staging image)
  • Scheduler Executor (staging image)
  • SC Event Tracker (staging image)
  • SC Event Worker (staging image)

The environment will be automatically cleaned up when this PR is closed or merged.

@github-actions
Copy link

🚀 PR Environment Deployed

Your PR environment has been successfully deployed!

Environment Details:

Components:

  • Keeperhub Application
  • PostgreSQL Database (isolated instance)
  • LocalStack (SQS emulation)
  • Redis (isolated instance)
  • Scheduler Dispatcher (staging image)
  • Scheduler Executor (staging image)
  • SC Event Tracker (staging image)
  • SC Event Worker (staging image)

The environment will be automatically cleaned up when this PR is closed or merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants