d2dagre: upgrade to Dagre 3.1.1 - #2844
Draft
alixander wants to merge 3 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.
Depends on d2lang/dagro#3.
Summary
The dependency is pinned to the signed head of the draft Dagro PR until that PR is merged and tagged. It must be replaced with the resulting release tag before this PR merges.
Compatibility and visual review
This is a layout-behavior update, not an output-compatible engine swap.
The primary E2E corpus changes 59 of 313 Dagre cases; 254 remain byte-identical. Across those 59 cases:
us_map,grid_edge_across_cell, andinvestigateimprove under the crossing proxynesting_poweris materially more compact but has busier cross-container routes and is the main visual tradeoff to reviewThe accepted testdata contains 59 board JSON files, their 59 paired SVGs, and 15 additional Dagre-backed sketch/dark-theme/CLI SVGs.
Modern Dagre self-loops can contain repeated points that create zero-length tangents downstream. The adapter removes consecutive duplicates and uses center sentinels only for chopping loops to their node borders. The regression test requires finite, border-connected routes; the change affects only the ten self-loop routes that needed normalization.
During acceptance review, the natural D2 source
a.b -> c -> a.b <- cexposed an upgrade-only panic in a compound graph with one forward and two reverse edges. Dagro now preserves every reversed partner, matches JavaScript's missing-map and root insertion semantics, and returns three finite routes connected to their source and destination borders. The D2 test pins that exact source and topology.Differential evidence
Dagro's pinned corpus covers all 313 D2 Dagre E2E cases, 349 ordered adapter calls, and 311 unique raw layouts:
Validation
CI=1 go test -mod=readonly -count=1 ./...against the pushed Dagro revisionPerformance is effectively unchanged within noisy measurements. Full D2 stripped native size grows by 0.051%, optimized WASM by 0.065%, and optimized-WASM gzip size by 0.041%.