Fix ancestor-to-descendant edge routing - #2
Merged
Merged
Conversation
Signed-off-by: Alexander Wang <alex@terrastruct.com>
alixander
force-pushed
the
agent/fix-ancestor-grandchild-edge
branch
from
August 10, 2026 01:03
7bbaecc to
a9599c4
Compare
alixander
marked this pull request as ready for review
August 10, 2026 01:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
CompoundGraphPreprocessor.calculateNetFlowin pinned ELK 0.8.1DOWNandRIGHTWhy
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 ./...internal/layeredlayouttests withELK_GO_ORACLE_LAYERED_STRATEGIES=1against pinned ELK.js 0.8.2git diff --checkThe commit is SSH-signed and includes a DCO sign-off.