Expand description
Run observer: callback trait for phase lifecycle events.
The executor notifies observers when phases start, complete, or fail. The TUI implements this to update its display state. The default stderr observer prints phase progress lines.
Re-exports§
pub use crate::scene_tree::NodeKind as PreMapKind;
Structs§
- Event
Tag - Provenance tag carried alongside a log message so display sinks can route by kind, not by sniffing message text.
- Phase
Progress Update - Live metrics snapshot for progress updates.
- Phase
Render Handle - SRD-100 P2 — the per-phase live render handle, attached to the
display fold’s
ActivePhaseexactly once (after theActivityand its metrics exist — executor.rs creates the activity well afterphase_starting, so this cannot ride that callback). It carries everything a display surface needs to re-derive this phase’s status line at the consumer by folding the snapshot, replacing the retired per-phase inline-status producer threads (SRD-100 §6). - Stderr
Observer - Default observer: prints to stderr.
Enums§
- Completed
Phase Display - SRD-92 R5 — how much of a completed node’s block is retained in
scrollback. Completion is never a full collapse: the header line
always lands; this selects whether the detail rows and op leaves
land with it. Selected once per run via the
completed_phases=param; session.log keeps every line unconditionally. - Event
Category - The semantic domain of a structured event — orthogonal to the lifecycle moment it attaches to. Extend as producers appear; a category earns a variant when some consumer (sink filter, counter, panel) needs to dispatch on it without string-matching rendered prefixes.
- LogLevel
- Log level for diagnostic messages.
- Skipped
Phase Display - SRD-? — how a FULLY-SKIPPED phase (every cycle
if:-gated off, or pre-entry pruned) is represented across the plan, traversal, and readout surfaces. Selected once per run via theskipped_phasesparam; read by the runtime’s completion fire, the executor’s pre-entry gate, and the TUI’s tree fold.
Traits§
- RunObserver
- Lifecycle events from the executor.
Functions§
- colorize_
log_ line - ANSI-colorize a log line by severity for console
output. Always applied at the producer side — every
console emission of a log entry runs through this so
DBG/INF/WRN/ERRare visually distinct without the operator having to squint at message bodies. Falls through to the bare message when stderr isn’t a TTY orNO_COLORis set (peruse_color); pipeline captures stay readable. - completed_
phase_ display - The run’s completed-phase display mode. Default
CompletedPhaseDisplay::Full. - display_
level - Effective console display threshold. Defaults to
Info— same default the live observers use. - global_
observer - The observer the current code should route through. Used by code that
needs the observer without threading it through every call site (e.g. the
activity’s inline-status refresh thread publishing into
[
RunObserver::set_status_line]). - is_
explain_ held - True iff the explainer overlay is currently on (toggled on
within the last
EXPLAIN_AUTO_REVERT_MSand not yet toggled off). Read by the readout binder on eachfire()to decide whether to dispatch withContentMode::Explanationinstead ofValue. - log
- log_
tagged logwith an explicitEventTag. The session-log write (unconditional, all tags) and the fallback stderr path are identical tolog; the tag only changes how a tag-aware display sink files the message — e.g. the readout engine attaches phase-start renders toPhaseStartso the terminal sink keeps them out of its scrollback (they show in its managed phase-history region instead).- op_
output - Emit a line of adapter op output (SRD-41 / “console belongs to the
adapter”). Delegates to the installed
crate::output_channel::OutputChannel(SRD-87): the op-output bucket’s impl decides where the bytes land — raw to the owned stdout (a console-owning adapter or a pipe, via [op_output_raw]) or routed through the live display (an interactive dashboard, avoiding the raw-mode staircase). Before any channel is installed (bootstrap / unit tests with no run), falls back to the raw path so early output is never lost. - readouts_
paused - True while the readout pause is on (see
toggle_readout_pause). - retain_
level - Effective retention threshold. Defaults to
Debugso pre-runner-init log calls (very early startup) still reach the file sink. - set_
completed_ phase_ display - Set the run’s completed-phase display mode (runner, at param parse).
- set_
display_ level - Install the console display threshold. Called by the
runner alongside
set_retain_levelat startup. - set_
global_ observer - Set the global observer. Called once by the runner at startup.
- set_
log_ file - Direct the log sink to a file. Opens for append-writes,
installs the
crate::log_sinkasync writer thread. Producers thereaftertry_sendand never block — see SRD-02 §“Display and Diagnostic Decoupling”. Silently no-ops on a second call — the first session wins (one run per process). - set_
retain_ level - Install the file-sink retention threshold. Called once by the runner; subsequent calls are silent no-ops (matching the “first wins” pattern of the rest of the global observer surface).
- set_
skipped_ phase_ display - Set the run’s skipped-phase display mode (runner, at param parse).
- skipped_
phase_ display - The run’s skipped-phase display mode. Default
SkippedPhaseDisplay::Mark. - toggle_
explain - Toggle the explainer overlay. First press → on (with a 10 s auto-revert deadline). Second press while on → off immediately. Auto-repeat-safe via a 250 ms debounce.
- toggle_
readout_ pause - Toggle the readout pause; returns the NEW state (
true= now paused). - trace
- Emit a
LogLevel::Traceevent carrying the component’s labels through the [crate::trace_router]. Returns immediately when no--trace=<spec>was configured (the router is empty), so the hot-path cost of an unused trace site is one atomic load + branch. - trace_
enabled - True iff the trace router has at least one configured sink. Hot-path guard so callers can skip expensive message formatting when tracing is off.
- use_
color - Log a diagnostic message through the global observer and append to the async log sink (if initialized). Safe to call from anywhere — falls back to stderr if no observer is set.