fix: skip edges that cross ELK root graph boundaries
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 59s
CI / docker (push) Successful in 38s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 38s

Edges connecting main flow nodes to handler section nodes (ON_EXCEPTION,
ON_COMPLETION) now span different ELK root graphs. ELK throws
UnsupportedGraphException when an edge connects nodes in different
layout hierarchies. Skip these cross-root edges — the frontend doesn't
render them anyway (handler sections are separated visually).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-27 20:11:25 +01:00
parent 7ec683aca0
commit fee9b4bd83

View File

@@ -250,7 +250,8 @@ public class ElkDiagramRenderer implements DiagramRenderer {
handlerRoots.add(handlerRoot);
}
// Create ELK edges
// Create ELK edges — skip edges that cross between different ELK root graphs
// (e.g., main flow → handler section). These cannot be laid out by ELK.
if (graph.getEdges() != null) {
for (RouteEdge re : graph.getEdges()) {
ElkNode sourceElk = elkNodeMap.get(re.getSource());
@@ -259,6 +260,13 @@ public class ElkDiagramRenderer implements DiagramRenderer {
continue;
}
// Skip edges that cross ELK root boundaries
ElkNode sourceRoot = getElkRoot(sourceElk);
ElkNode targetRoot = getElkRoot(targetElk);
if (sourceRoot != targetRoot) {
continue;
}
// Determine the containing node for the edge
ElkNode containingNode = findCommonParent(sourceElk, targetElk);
@@ -542,6 +550,15 @@ public class ElkDiagramRenderer implements DiagramRenderer {
// ELK graph helpers
// ----------------------------------------------------------------
/** Walk up to the top-level root of an ELK node's hierarchy. */
private ElkNode getElkRoot(ElkNode node) {
ElkNode current = node;
while (current.getParent() != null) {
current = current.getParent();
}
return current;
}
private ElkNode findCommonParent(ElkNode a, ElkNode b) {
if (a.getParent() == b.getParent()) {
return a.getParent();