StatifierUI.Inspector (StatifierUI v0.1.0)

Copy Markdown View Source

Pure pane assembly for the Livebook inspector: folds a compiled Statifier.Machine and a StatifierUI.Trace.Subscriber message list into the render source each pane displays - Mermaid source for the configuration diagram, Markdown for the event log and the datamodel explorer, and a status line from the subscriber's stats/1 snapshot.

No Kino, no process, no session: everything here is testable from a message list, exactly like the pane modules it composes. The Kino shell (StatifierUI.Kino) maps these strings into widgets and owns nothing else.

The active configuration is read from the newest trace.macrostep_stable message - the quiescent configuration of the last completed macrostep (docs/wire-format.md). Before any macrostep has completed in view, the caller-supplied initial configuration (typically Statifier.Session.snapshot/1's) is used instead.

Summary

Types

Options shared by the fold functions.

Functions

The active configuration messages implies: the newest trace.macrostep_stable's configuration payload, or opts[:initial_configuration] (default []) when no macrostep has stabilized in view.

Markdown for the datamodel explorer pane: StatifierUI.DatamodelExplorer.build_live/1 over messages, rendered with the default markers. A build failure renders as a visible error line, same policy as event_log/1.

Mermaid stateDiagram-v2 source for the configuration pane: StatifierUI.Diagram.render/2 over active_configuration/2.

Markdown for the event log pane: StatifierUI.EventLog.build/1 rendered collapsible with the last macrostep open. A build failure renders as a visible error line rather than raising - the inspector keeps showing the other panes.

The one-line (plus warnings) status header: session id, subscriber status, message and drop counts, and one blockquote line per diagnostic. A :not_recorded or :catch_up_failed diagnostic is what labels the whole inspector live-only - a partial stream is never presented as whole (statifier ADR-0049; this bead's precondition note).

Types

opt()

@type opt() :: {:initial_configuration, Enumerable.t()}

Options shared by the fold functions.

Functions

active_configuration(messages, opts \\ [])

@spec active_configuration([StatifierUI.Trace.Message.t()], [opt()]) :: [
  non_neg_integer()
]

The active configuration messages implies: the newest trace.macrostep_stable's configuration payload, or opts[:initial_configuration] (default []) when no macrostep has stabilized in view.

datamodel(messages)

@spec datamodel([StatifierUI.Trace.Message.t()]) :: String.t()

Markdown for the datamodel explorer pane: StatifierUI.DatamodelExplorer.build_live/1 over messages, rendered with the default markers. A build failure renders as a visible error line, same policy as event_log/1.

diagram(machine, messages, opts \\ [])

Mermaid stateDiagram-v2 source for the configuration pane: StatifierUI.Diagram.render/2 over active_configuration/2.

event_log(messages)

@spec event_log([StatifierUI.Trace.Message.t()]) :: String.t()

Markdown for the event log pane: StatifierUI.EventLog.build/1 rendered collapsible with the last macrostep open. A build failure renders as a visible error line rather than raising - the inspector keeps showing the other panes.

status(stats)

The one-line (plus warnings) status header: session id, subscriber status, message and drop counts, and one blockquote line per diagnostic. A :not_recorded or :catch_up_failed diagnostic is what labels the whole inspector live-only - a partial stream is never presented as whole (statifier ADR-0049; this bead's precondition note).