Skip to content

Fix ancestor-to-descendant edge routing - #2

Merged
alixander merged 1 commit into
mainfrom
agent/fix-ancestor-grandchild-edge
Aug 10, 2026
Merged

alixander merged 1 commit into
mainfrom
agent/fix-ancestor-grandchild-edge

Conversation

@alixander

@alixander alixander commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • derive reused compound-parent endpoint sides from the port's connection net flow, matching CompoundGraphPreprocessor.calculateNetFlow in pinned ELK 0.8.1
  • preserve upstream's outside-self-loop balance: one output vote in the outgoing pass and one input vote in the incoming pass
  • translate descendant-edge bend points, labels, and junctions from the source node's nested graph while leaving endpoint coordinates unchanged
  • add frozen ancestor-to-grandchild regressions and opt-in full differentials against the pinned ELK.js 0.8.2 oracle, including shared-port outside-self-loop cases in DOWN and RIGHT

Why

For a downward edge from a compound ancestor to a grandchild, the hierarchy splitter classified each replacement segment as an input segment. Elk-go also used that segment type as the reused ancestor port's net flow, which moved the source port to the north side. The edge then entered through the intermediate compound instead of exiting the ancestor's south side and routing around the intermediate node.

Pinned ELK 0.8.1 treats the two concepts separately: the segment still points into deeper hierarchy, but an existing parent endpoint gets its side from all connections on the original port. Its layout transferrer also applies descendant edge routing while processing the source node's nested graph, so nested padding and offset belong on route points.

The net-flow port also matches upstream's two-pass counting exactly. An outside self-loop is seen once as outgoing and once as incoming, so its votes cancel. The directional regressions combine the descendant edge, an outside self-loop, and two incoming edges on one shared port; they catch a stray extra output vote through both the selected port side and the resulting route.

The regressions match the frozen ELK.js output for the complete graph, including compound sizes, port sides, and every edge coordinate.

Validation

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • all internal/layeredlayout tests with ELK_GO_ORACLE_LAYERED_STRATEGIES=1 against pinned ELK.js 0.8.2
  • git diff --check

The commit is SSH-signed and includes a DCO sign-off.

Signed-off-by: Alexander Wang <alex@terrastruct.com>
@alixander
alixander force-pushed the agent/fix-ancestor-grandchild-edge branch from 7bbaecc to a9599c4 Compare August 10, 2026 01:03
@alixander
alixander marked this pull request as ready for review August 10, 2026 01:14
@alixander
alixander merged commit 50aafa9 into main Aug 10, 2026
3 checks passed
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.

1 participant