Port D2's Dagre compatibility surface to Dagre 3.1.1 - #3
Draft
alixander wants to merge 5 commits into
Draft
Conversation
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.
Summary
This ports Dagro's D2-used default layout profile from Dagre 0.8.5 / Graphlib 2.1.8 behavior to Dagre 3.1.1 / Graphlib 4.0.5.
Compatibility boundary
The verified surface is deliberately limited to D2's directed, compound, named-multiedge profile:
rankdir,nodesep,edgesep,ranksep; node IDs, parents, width, and height; and named edges with width, height, andlabelpos.This is not a claim to implement every Dagre 3.1.1 or Graphlib 4.0.5 feature. Dynamic remembered state, per-cluster direction, custom/manual ordering and ranking, constraints, and
rankalignremain outside the contract.Differential evidence
The checked corpus covers 313 D2 Dagre E2E cases, 349 ordered adapter calls, and 311 unique raw layouts.
The compatibility patch pairs only opposite reversal states, preserves all partners for a shared forward dummy, and keeps degenerate rectangle intersections finite. The builder fetches the exact upstream commit, verifies its lockfile and patch, and pins the resulting CommonJS oracle by SHA-256.
A deterministic 300-case generator restricted to D2's profile matches that compatibility oracle exactly. It includes the minimized regression behind the natural D2 source
a.b -> c -> a.b <- c, which passed in Dagro v0.1.1, panicked during this upgrade, and is finite and connected after the fix.Validation
go test ./...go test -race ./...go vet ./...The linked D2 integration PR, d2lang/d2#2844, carries the intentional E2E layout-output update, downstream self-loop normalization, and natural-source crash regression.