Skip to content

Make MDL SVG rendering deterministic - #1130

Merged
raphael merged 2 commits into
mainfrom
fix/mdl-render-handshake
Aug 20, 2026
Merged

Make MDL SVG rendering deterministic#1130
raphael merged 2 commits into
mainfrom
fix/mdl-render-handshake

Conversation

@raphael

@raphael raphael commented Aug 20, 2026

Copy link
Copy Markdown
Member

Problem

mdl svg could start saving before the lazy graph mounted, then hide the browser error and time out while polling for a file. Automatic relationship labels could overlap nodes, and the CLI's implicit DOWN direction overrode each view's AutoLayout declaration.

Outcome

  • The graph component now signals DOM readiness before headless layout begins. Layout and save failures remain visible in the editor and are returned to the CLI through an explicit browser completion status.
  • Auto-generated relationship labels evaluate both sides and multiple positions on their owning segment, choosing the first collision-free placement while preserving manually moved label anchors.
  • A view's declared rank direction is the default. -direction DOWN|UP|LEFT|RIGHT remains an explicit override; invalid values now fail instead of silently falling back.

The browser owns graph readiness and action sequencing, the save endpoint owns durable file creation, and the CLI owns timeout and diagnostic reporting. No model membership, relationship selection, or authored manual layout contract changes.

Compatibility

Callers that unintentionally relied on the old implicit top-to-bottom override will now receive their view's declared direction. They can preserve the old output with -direction DOWN.

Validation

  • pnpm exec tsc --noEmit
  • pnpm run build
  • CHROME_BIN=\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\" go test ./... -count=1
  • Verified the regression fixture has three label/node collisions with v1.16.3 and none with this branch.
  • Regenerated the Flows service diagram and measured zero node/label and peer-label collisions.

Review guide

Start with the automation status contract in Root.tsx and main.go, then review collision scoring in graph.ts and view-direction mapping in parseModel.ts. Browser-backed regressions are in svg_e2e_test.go.

Wait for mounted graphs and browser completion, keep labels clear of diagram elements, and honor each view's layout direction unless explicitly overridden.
Give CI the same browser startup budget as the SVG regression tests so the synthetic error contract is measured after Chrome is ready.
@raphael
raphael merged commit abebcc2 into main Aug 20, 2026
4 checks passed
@raphael
raphael deleted the fix/mdl-render-handshake branch August 20, 2026 18:19
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