Skip to content

feat(flow): remove dagre — SGCR is the only layout engine - #301

Draft
ivanmkc wants to merge 2 commits into
masterfrom
feat/sgcr-only-engine
Draft

feat(flow): remove dagre — SGCR is the only layout engine#301
ivanmkc wants to merge 2 commits into
masterfrom
feat/sgcr-only-engine

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove @dagrejs/dagre dependency entirely (~14KB gzip bundle savings)
  • Replace all dagre calls with SGCR equivalents (inter-zone packing, swimlane global rank, ungrouped layout, measured re-pass)
  • Add grouped SGCR pipeline: two-level layout (per-zone → zone-packing → orthogonal edge routing) with container boxes
  • Remove bestLayout direction search (SGCR is deterministic)
  • Remove analyzeFlowGeometry heuristic lint (replaced by checkInvariants exact arithmetic)
  • Geometry lint uses sgcrReport for ALL flows (grouped and ungrouped)
  • engine:"dagre" accepted for backward compat but silently ignored

SGCR guarantees zero node overlaps (P1) and zero edge-over-node (P2) by construction — invariants dagre never provided. Verified on the 30K-graph fuzz corpus + all shipped examples.

Test plan

  • tsc clean (zero errors)
  • 703 vitest tests pass (48 files)
  • 30 SGCR tests including 8 new grouped layout tests
  • All shipped flow/panes examples produce zero SGCR invariant violations
  • Server test updated (flow-too-many-nodes replaces edge-over-node as the trigger)
  • Visual regression check on grouped boards in the viewer
  • Bundle size verification (dagre ~14KB gzip removed)

Replace all dagre calls with SGCR equivalents across the flow layout
pipeline: inter-zone packing, swimlane global rank, ungrouped flat layout,
and the measured re-pass. SGCR guarantees zero node overlaps (P1) and zero
edge-over-node (P2) by construction — invariants dagre never provided.

- Add grouped SGCR pipeline: two-level layout (per-zone → zone-packing →
  orthogonal edge routing) with container boxes for zone rendering
- Remove @dagrejs/dagre dependency (~14KB gzip bundle savings)
- Remove bestLayout direction search (SGCR is deterministic, no search needed)
- Remove analyzeFlowGeometry heuristic lint (replaced by checkInvariants)
- Geometry lint now uses sgcrReport for ALL flows (grouped and ungrouped)
- engine:"dagre" accepted for backward compat, silently ignored
- 703 tests pass, tsc clean
…floor

Grouped flows (tiers/lanes/zones) were skipped by the measured re-pass,
relying entirely on estSize estimates which under-predicted ChangeNode's
rendered width (estSize minW=120 vs CSS minWidth=140 + cell fill). This
caused node overlaps in the architecture-zones tiered layout.

Two fixes:
- Raise estSize minW from 120 to 172 (matches the ChangeNode's rendered
  floor when it fills its SGCR cell via width:100%)
- Enable the measured re-pass for grouped flows: re-run layoutFlow with
  DOM-measured node sizes, updating both member positions and container
  styles. Previously skipped because "dagre would ignore zones" — now
  layoutFlow handles groups natively via SGCR.
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.

2 participants