Skip to content

Adds the Mermaid configuration renderer - #28

Merged
johnnyt merged 1 commit into
mainfrom
sui-t36.4-config-renderer
Aug 22, 2026
Merged

Adds the Mermaid configuration renderer#28
johnnyt merged 1 commit into
mainfrom
sui-t36.4-config-renderer

Conversation

@johnnyt

@johnnyt johnnyt commented Aug 22, 2026

Copy link
Copy Markdown
Member

Why

The Livebook inspector (sui-t36) needs its first configuration rendering:
a way to show a chart's structure with the active states highlighted,
consuming only the compiled machine and a configuration. The bead settles
the research-doc open question by starting with Mermaid and accepting its
documented limit, keeping the interface stable for the later elkjs swap
(ADR-0008 fixes the destination stack; this is the epic's permitted first
cut).

What

StatifierUI.Diagram.render/2 - a pure function from Statifier.Machine
plus an active configuration (any enumerable of state indexes; the full
configuration per ADR-0005) to Mermaid stateDiagram-v2 source suitable
for Kino.Mermaid. Compound states render as composite blocks, parallel
states as composites with -- region dividers, resolved initial states as
[*] markers, final and history states with label suffixes, and active
states via a classDef/class pair. Nodes are aliased s<index> from the
engine's document-order state indexes, so consumers address nodes by the
identity vocabulary of statifier ADR-0012.

Mermaid cannot draw a transition between internal states of two different
composite states, so such edges are lifted to the composite siblings under
the least common ancestor with a [lifted: source -> target] marker; deep
initial targets get a [deep: ...] marker the same way. The compromise is
documented in the moduledoc.

Notes

  • Pure module: no Kino (or LiveView) dependency; the widget assembly bead
    (sui-t36.8) is where Kino.Mermaid consumes this.
  • Does not touch the trace wire format or fixtures contract; if a later
    slice wants live re-rendering from effect.datamodel_change, that rides
    on Serializes datamodel_change as a wire type #27 rather than anything here.
  • Full mix quality green locally (255 tests, 95.3% coverage); mix gate.verify attests the run was not narrowed; mix gate.check reports
    no unjustified gate changes. Gettext/Sobelow are the two permanently
    inapplicable skips.

Closes: sui-t36.4

StatifierUI.Diagram.render/2 is a pure function from a compiled
machine and an active configuration to Mermaid stateDiagram-v2
source for Kino.Mermaid: composite blocks for compound states,
"--" region dividers for parallel states, [*] markers for
resolved initial states, and an active highlight class over the
full configuration.

Mermaid cannot draw a transition between internal states of two
different composite states, so those edges are lifted to the
composite siblings under the least common ancestor and marked
[lifted: source -> target]; deep initial targets get the same
treatment. The compromise is documented in the moduledoc, and
the render/2 interface stays stable for the later elkjs swap.

Refs: sui-t36.4
@johnnyt
johnnyt merged commit 5c2aa4a into main Aug 22, 2026
1 check passed
@johnnyt
johnnyt deleted the sui-t36.4-config-renderer branch August 22, 2026 14:55
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