Skip to content

feat(workflow): 'Show data flow' overlay#2613

Open
simlarsen wants to merge 1 commit into
feat/workflow-rename-cascadefrom
feat/workflow-data-flow-overlay
Open

feat(workflow): 'Show data flow' overlay#2613
simlarsen wants to merge 1 commit into
feat/workflow-rename-cascadefrom
feat/workflow-data-flow-overlay

Conversation

@simlarsen

Copy link
Copy Markdown
Contributor

Makes the invisible data flow visible on the canvas. Stacked on #2612.

What

Edges show execution order, but the data flow — which step's output feeds which step's input via {{ tokens }} — was invisible. This adds a "Data flow" toggle that draws faint dashed edges from each referenced step to the step that consumes it.

  • Pure deriveDataEdges(nodes) scans argument strings for {{local.components.<id>.returnValues.…}} references and produces ghost edges (source → consumer), deduped, ignoring unknown sources and self-references.

Safe by construction (the design's flagged footgun)

The synthesis warned that ghost edges must never leak into the saved graph. Here they can't: the ghost edges are concatenated onto the edges passed to React Flow but are never added to the edges state — so onWorkflowUpdated / autosave only ever persist real edges. The overlay is also off by default, non-deletable, with deterministic ids so React Flow doesn't churn. Worst case if the visual is imperfect is cosmetic; state and saving are untouched.

Added alongside the Outline toggle in a small top-left canvas toolbar.

Verification

  • deriveDataEdges (4 tests): draws a source→consumer ghost edge; dedupes multiple refs between a pair; ignores unknown-source and self references; empty when there are no references.
  • 91 workflow tests pass; tsc ✓, eslint ✓.
  • Note: the ReactFlow rendering of the overlay isn't exercised in jsdom, but the derivation is unit-tested and the integration is render-only/off-by-default, so a visual imperfection can't affect data or saving.

🤖 Generated with Claude Code

… from

Edges show execution order, but the data flow (which step's output feeds which
step's input, via {{ tokens }}) was invisible. This adds a "Data flow" toggle
that draws faint dashed edges from each referenced step to the step that
consumes it.

- Pure deriveDataEdges(nodes) scans argument strings for
  {{local.components.<id>.returnValues.…}} references and produces ghost edges
  (source → consumer), deduped, ignoring unknown sources and self-references.
- Render-only and OFF by default: the ghost edges are concatenated onto the
  edges passed to React Flow but are NEVER added to the edges state — so
  onWorkflowUpdated / autosave only ever persists real edges. This sidesteps
  the "ghost edges leak into the saved graph" footgun by construction. Ghost
  edges are non-deletable with deterministic ids so React Flow doesn't churn.
- Added alongside the Outline toggle in a small top-left canvas toolbar.

Tests: deriveDataEdges (draws source→consumer, dedupes a pair, ignores
unknown/self refs, empty when no refs). 91 workflow tests pass; tsc + eslint
clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simlarsen

Copy link
Copy Markdown
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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