Adds the event injection pane - #30
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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"meansnil,"{}"means the empty map - preserving the three-way distinctionStatifier.Eventitself insists on.StatifierUI.EventInjection.Palette/Entry- fixtures'example_eventsto entries carrying canonical prefill text viaValue.encode/1; an unencodable sample becomes a diagnostic and isskipped rather than taking the palette down.
StatifierUI.EventInjection- the pane model:build/1setsfree_form_only?when there are no entries (the degrade rule as a modelproperty rather than a rule sui-t36.8 must remember), and
send/2/send_draft/3are the single call site in the repository that puts anevent into a session, via
Statifier.Session.send_event/2and nothingelse - never
interpret/2, neversend_invoked_event/3.Notes
StatifierUI.Fixtures(merged, sui-t36.2) and the statifier dep. Notstacked.
send/2shadowsKernel.send/2, so the module carriesimport Kernel, except: [send: 2]- narrow, standard, no behavioraleffect.
Session.send_event/2is a cast with no correlation id, so tying aninjection to its
trace.event_dequeuedis heuristic - a caller-suppliedcorrelation 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.
mix qualityandmix gate.verifygreen after every phaseand 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.
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