Skip to content

docs: document Canonical vs Visual geometry contract for MMDS#384

Merged
kevinswiber merged 1 commit into
mainfrom
chore/mmds-canonical-vs-visual-contract-doc
May 19, 2026
Merged

docs: document Canonical vs Visual geometry contract for MMDS#384
kevinswiber merged 1 commit into
mainfrom
chore/mmds-canonical-vs-visual-contract-doc

Conversation

@kevinswiber

Copy link
Copy Markdown
Owner

Summary

Add a "Geometry Contract: Canonical (MMDS) vs Visual (SVG)" subsection to docs/mmds.md under "Geometry Levels". Pins the design decision that MMDS persists Canonical geometry (wider, replay-faithful, preserves labeled-edge bend waypoints) while direct SVG output uses Visual (tight, pixel-faithful, simplifies bend topology).

Background: a CLI MMDS→SVG replay surprised a consumer with a wider subgraph rect than a direct Mermaid→SVG render. Both code paths use the same engine on the same diagram, but pass different GraphGeometryContract values into the solver (see src/runtime/graph_family.rs::geometry_contract_for_format). We experimented with switching MMDS to Visual; it broke the Tier A bent-path preservation tests (a labeled reciprocal edge collapsed from a 4-point polyline bending around its label to a 3-point straight L), confirming that Canonical isn't just padded for cosmetics — it carries informational geometry adapters depend on for replay.

No code change, just a doc note that names the trade-off, explains why MMDS uses Canonical, and points adapter authors at examples/mmds/ for replay patterns.

Test plan

  • just spell-check docs/mmds.md
  • Markdown renders cleanly in the existing section structure (Geometry Levels → Layout / Routed / Geometry Contract).

MMDS persists Canonical geometry by design — wider, replay-faithful
bounds and full bend waypoints — while direct SVG output uses Visual,
the tight pixel-faithful projection. The split is intentional: the
labeled-edge bend topology (e.g. a reciprocal labeled edge produces a
4+ point polyline) would simplify to a straight L under Visual, so
adapters that replay edge routing need Canonical to reproduce the
shape faithfully.

Without this note, a Mermaid -> MMDS -> SVG round-trip via the CLI
surprises consumers: the cluster rect is taller and the node positions
shift relative to a direct Mermaid -> SVG render. Adding a "Geometry
Contract" subsection under "Geometry Levels" pins the contract
distinction, names the trade-off, and points adapter authors at the
right output format for their use case.

No behavior change.
@kevinswiber kevinswiber force-pushed the chore/mmds-canonical-vs-visual-contract-doc branch from 6717ecd to ff52c16 Compare May 19, 2026 17:40
@kevinswiber kevinswiber changed the title docs(mmds): document Canonical vs Visual geometry contract docs: document Canonical vs Visual geometry contract for MMDS May 19, 2026
@kevinswiber kevinswiber merged commit ff52c16 into main May 19, 2026
2 checks passed
@kevinswiber kevinswiber deleted the chore/mmds-canonical-vs-visual-contract-doc branch May 19, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant