Repository navigation
Fix grid routing, shape sizing, declaration order and balancing - #3036
Merged
Merged
Conversation
- sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
alixander
marked this pull request as ready for review
November 25, 2026 10:24
- sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
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.
Human
AI
This fixes grid layout cases where D2 changed the meaning of a diagram. A three-cell grid could draw A → C through B even with TALA, a foreign key could attach to the wrong SQL field, and repeating an unchanged dimension could swap two cells or animate an otherwise unchanged step.
The regression tests cover the parser-to-layout path, rendered endpoints, nested shapes, serialization, step animation and partition scores against exhaustive enumeration. Updated rendering snapshots record the resulting geometry. Additional review cases cover touching cells on both axes, C4 person body bounds, border icons that grow with their cells, and rerouting beside an existing TALA loop.
Additional review fixes
Variable spread precedence
A map spread now supplies its values at the line where it is used. This four-cell example draws two rows with Dagre, ELK, and TALA. Moving the spread below the explicit setting draws one row.
The same rule applies to labels and styles. Nested maps keep their other fields, and later references to a shape leave its assigned value intact. Regression tests exercise repeated imports, inherited steps, wildcard assignments, array replacement, and deletion followed by re-creation.
Tracking source positions also uses some memory. On an Apple M4, the existing compiler benchmarks allocated about 5% more bytes per compile for 1,000 flat fields or 1,000 fields with a leading wildcard. Fifty selected imports allocated about 10% more. Those comparisons use the previous PR head (
a8da1c7) as the baseline.Partition search benchmark
Median of three runs of the existing
BenchmarkDynamicGridSearchon an Apple M4, one Go worker, 400 ms per case. These measurements time the partition search alone.00d5059)07704de)The larger case uses more memory to recover the optimal cuts. The dynamic program caps the number of states at one million.
Verification
go vet --composites=false ./...passed.Fixes #1405
Fixes #1741
Fixes #2115