Skip to content

Adds the event injection pane - #30

Merged
johnnyt merged 3 commits into
mainfrom
sui-t36.6-event-injection
Aug 22, 2026
Merged

Adds the event injection pane#30
johnnyt merged 3 commits into
mainfrom
sui-t36.6-event-injection

Conversation

@johnnyt

@johnnyt johnnyt commented Aug 22, 2026

Copy link
Copy Markdown
Member

Why

The Livebook inspector epic (sui-t36) needs a way to fire events at the
session under inspection: a palette of ready-made events from the loaded
fixtures (statifier ADR-0029 keeps recorded sessions replayable only when
input goes through the ordinary event API), with the payload editable
before send, plus a free-form name+payload escape hatch. Without fixtures
the pane degrades to the free-form field alone.

What

Four pure modules, no Kino reference (the sui-t36.8 assembly bead owns the
widget wrapper, matching StatifierUI.EventLog and StatifierUI.Diagram):

  • StatifierUI.EventInjection.Draft - form input to %Statifier.Event{}:
    trims and syntactically validates the event name (never against the
    chart - firing an unmatched event is a legitimate debugging act), and
    round-trips payload text through stdlib JSON + StatifierUI.Value
    (ADR-0005). Blank text means data: :undefined, "null" means nil,
    "{}" means the empty map - preserving the three-way distinction
    Statifier.Event itself insists on.
  • StatifierUI.EventInjection.Palette / Entry - fixtures'
    example_events to entries carrying canonical prefill text via
    Value.encode/1; an unencodable sample becomes a diagnostic and is
    skipped rather than taking the palette down.
  • StatifierUI.EventInjection - the pane model: build/1 sets
    free_form_only? when there are no entries (the degrade rule as a model
    property rather than a rule sui-t36.8 must remember), and send/2 /
    send_draft/3 are the single call site in the repository that puts an
    event into a session, via Statifier.Session.send_event/2 and nothing
    else - never interpret/2, never send_invoked_event/3.

Notes

  • Base choice: main, independent of the open PRs. The slice needs only
    StatifierUI.Fixtures (merged, sui-t36.2) and the statifier dep. Not
    stacked.
  • send/2 shadows Kernel.send/2, so the module carries
    import Kernel, except: [send: 2] - narrow, standard, no behavioral
    effect.
  • Open questions recorded in the plan, both non-blocking: (1)
    Session.send_event/2 is a cast with no correlation id, so tying an
    injection to its trace.event_dequeued is heuristic - a caller-supplied
    correlation id would be an engine change and therefore an st- bead; (2)
    ADR-0003 fixes one sample payload per event name - a multi-sample palette
    would need an ADR amendment plus a new sui- bead.
  • Gate: full mix quality and mix gate.verify green after every phase
    and after rebase - 272/272 tests, 95.5% coverage; Gettext/Sobelow are the
    two permanent not-applicable skips. The known sui-hmm flake did not fire.
  • Deferred manual verification (iex/notebook checks: prefill readability,
    live-session firing, moduledoc clarity for sui-t36.8) is recorded in
    docs/plans/260822-sui-t36.6-event-injection-pane.md.

Closes sui-t36.6

Builds a Statifier.Event from a form's name and payload text: trims
and validates the event name, decodes payload text through JSON and
StatifierUI.Value, and spells the blank/null/{} three-way distinction
explicitly. Returns errors as values instead of raising.

Refs: sui-t36.6
Turns a fixture bundle's events map into a sorted list of entries, one
per event name, with the payload plus its ADR-0005 JSON prefill text.
An unencodable payload becomes a diagnostic instead of failing the
whole build, matching the fixtures lint's severity logic. Blank input
degrades to an empty palette.

Refs: sui-t36.6
Composes the draft and palette modules into StatifierUI.EventInjection:
build/1 sets free_form_only? whenever the palette has no entries, and
send/2 and send_draft/3 are the pane's only door into a session, always
through Statifier.Session.send_event/2 with an external/2 event so a
recorded session stays replayable (statifier ADR-0029). Adds a
live-session test proving the round trip from a fixture payload through
the palette and draft to an observed trace transition.

Refs: sui-t36.6
@johnnyt
johnnyt merged commit c3594c5 into main Aug 22, 2026
1 check passed
@johnnyt
johnnyt deleted the sui-t36.6-event-injection branch August 22, 2026 14:56
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