Commit 7996c0a
authored
Refine workflow edge routing (#507)
* Refine workflow edge routing
Workflow dependency graphs with fan-in/fan-out could still be misleading in
several cases: bends could occur under sibling cards, long horizontal
segments could run through node bodies, and direct upstream dependencies
could appear to terminate at separate nearby merge points. Those patterns
made true dependency relationships harder to read at a glance.
The routing logic now keeps the original Manhattan style by default,
but validates each candidate lane against stricter constraints. Edge
selection rejects lanes whose turns fall inside node no-turn zones and
also rejects lanes whose orthogonal segments intersect non-endpoint
nodes. For mixed fan-in targets, layout now adds a shared
`preferredBendX` hint so off-row incoming edges converge on a common
merge lane when safe.
Coverage was expanded with focused routing tests for node-body crossing
avoidance, near-target lane fallback in same-row sibling scenarios,
shared preferred merge-lane convergence, and merge-hint assignment at
the layout layer.
* Refactor workflow diagram and harden deps
Workflow diagram logic had grown monolithic in
`src/components/WorkflowDiagram.tsx`, mixing React wiring with graph
construction, Dagre layout, and edge styling. It also crashed on some
historical payloads where `metadata.deps` was missing, because the graph
model read `job.metadata.deps` directly.
This refactor moves workflow diagram code into
`src/components/workflow-diagram/` and separates responsibilities across
`workflowDiagramGraphModel.ts`, `workflowDiagramLayout.ts`,
`workflowDiagramGeometry.ts`, and `workflowDiagramConstants.ts`, while
keeping edge-path routing and merge hints in dedicated modules. The
model builder now normalizes dependency reads with
`job.metadata.deps ?? []` so missing deps are treated as empty lists.
The change preserves rendering behavior and routing parity while
improving maintainability and preventing runtime failures for malformed
or historical rows. Coverage adds regressions for missing
`metadata.deps` in `WorkflowDiagram.test.tsx` and
`workflowDiagramGraphModel.test.ts`, alongside relocated routing and
merge-hint tests in the new module folder.
* Share workflow job fixture across tests1 parent 8864783 commit 7996c0a
18 files changed
Lines changed: 1988 additions & 283 deletions
File tree
- src
- components
- workflow-diagram
- test/factories
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
This file was deleted.
0 commit comments