Determinism
SVGs are committed and reviewed as diffs, so the same input must give the same bytes on every machine.
Components
Pinned inputs
- Inter is bundled, so label widths never depend on installed fonts.
stdtranscendentals can differ in the last bit across platforms, so every transcendental goes throughlibm;clippy.tomlbans thestdversions and the kurbo calls that use them.- dagre-dgl-rs broke ties in
HashMaporder and numbered nodes from a global counter;svugy-dagre, cut down from it, breaks ties in a fixed order, keeps the counter per graph, and lets noHashMaporder reach a coordinate (crates/svugy-dagre/README.md). ModelandLevelPlanskeep their entries inBTreeMaps, iterated in key order.
One output spelling: at most 3 decimals per number, attributes sorted.
Tests
- Snapshots pin both SVGs of
examples/svugy/svugy.mdand its static raster (crates/svugy/tests/golden_svugy.rs). - 300 random graphs are each rendered twice and compared (
crates/svugy/tests/determinism.rs). - CI renders
examples/svugy/svugy.d2on Linux, macOS and wasm32-wasip1 and diffs each result against the committeddocs/svugy.svg.