Pure, total presenter for operator audit-log events (AUDIT-01).
Mirrors ToolProposalPresenter/ReviewTaskPresenter:
- Total functions with safe fallbacks — never crashes on unexpected input.
- Returns strings and atoms only — never markup, never raw Elixir terms.
Operates on the plain-map event shape the Cairnloop.Auditor behaviour returns
(%{inserted_at:, actor_id:, action:, reason:, metadata:}), so it works uniformly
for the governance-backed default auditor and any host-supplied auditor.
Brand: action atoms are humanized (never inspect/1 to operators); the raw map is
only ever shown behind an explicit expander in the LiveView, never inline.
Summary
Functions
Human label for an audit action/event_type (atom or string).
Human label for the actor; system/automated actions read as "System".
True when there is metadata worth showing in the raw expander.
True when event matches the free-text query (case-insensitive). A blank query
matches everything. Searches the action label, actor, reason, and metadata values.
Humanized {label, value} rows for an event's metadata map.
Optional reason text; nil/blank renders as an em dash.
Calm UTC timestamp label; nil/unknown renders as an em dash.
Functions
Human label for an audit action/event_type (atom or string).
Human label for the actor; system/automated actions read as "System".
True when there is metadata worth showing in the raw expander.
True when event matches the free-text query (case-insensitive). A blank query
matches everything. Searches the action label, actor, reason, and metadata values.
Humanized {label, value} rows for an event's metadata map.
Scalar values are stringified; nested/structured values are summarized as "(structured value)" — the full raw map is only shown behind the explicit expander in the LiveView, never inline (brand §5.6).
Optional reason text; nil/blank renders as an em dash.
Calm UTC timestamp label; nil/unknown renders as an em dash.