Skip to content

Commit 7996c0a

Browse files
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 tests
1 parent 8864783 commit 7996c0a

18 files changed

Lines changed: 1988 additions & 283 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Prevent double slash in URLs for root path prefix. Thanks [Jan Kott](https://github.com/boostvolt)! [PR #487](https://github.com/riverqueue/riverui/pull/487).
1313
- Serve UI HTML for wildcard or missing Accept headers and return 406 for explicit non-HTML requests. Fixes #485. [PR #493](https://github.com/riverqueue/riverui/pull/493).
1414
- Prevent jobs detail navigation from bouncing back to `/jobs/` on slow networks due to stale filter-sync URL updates. Fixes #495. [PR #504](https://github.com/riverqueue/riverui/pull/504).
15+
- Workflow detail: improve dependency edge routing to avoid turns under task cards, avoid line segments crossing node bodies, and keep fan-in edges visually converged into shared merge lanes when possible. [PR #507](https://github.com/riverqueue/riverui/pull/507).
1516

1617
## [v0.14.0] - 2026-01-02
1718

src/components/WorkflowDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import RelativeTimeFormatter from "@components/RelativeTimeFormatter";
55
import RetryWorkflowDialog from "@components/RetryWorkflowDialog";
66
import { TaskStateIcon } from "@components/TaskStateIcon";
77
import TopNavTitleOnly from "@components/TopNavTitleOnly";
8-
import WorkflowDiagram from "@components/WorkflowDiagram";
8+
import WorkflowDiagram from "@components/workflow-diagram/WorkflowDiagram";
99
import { useFeatures } from "@contexts/Features.hook";
1010
// (Dialog is now encapsulated in RetryWorkflowDialog)
1111
import { ArrowPathIcon, XCircleIcon } from "@heroicons/react/24/outline";

src/components/WorkflowDiagram.tsx

Lines changed: 0 additions & 282 deletions
This file was deleted.

0 commit comments

Comments
 (0)