Skip to main content

Module observer

Module observer 

Source
Expand description

TUI-driving RunObserver implementation.

TuiObserver is the glue layer between nmbrs_runtime::observer::RunObserver (lifecycle callbacks emitted by the runner) and the rest of this crate (crate::run_state_actor, crate::reporter::TuiReporter, crate::app::App). The runner only knows about the trait; this module owns the translation of trait callbacks into crate::run_state_actor::RunStateCmd messages sent to the display-side actor.

Lifecycle:

  1. Persona spawns the RunState actor (via crate::run_state_actor::spawn_run_state_actor), constructs a TuiObserver holding the resulting crate::run_state_actor::RunStateHandle, and hands it to nmbrs_runtime::runner::run_with_observer.
  2. The runner calls phase_starting / phase_progress / phase_completed / log / etc. as the workload runs; each call sends one or more RunStateCmds into the actor’s inbox — no write lock anywhere.
  3. The first phase_starting triggers TuiObserver::ensure_tui_started which spawns the crate::app::App thread (also a snapshot reader and command sender); pre-phase work runs with plain stderr output so a startup failure leaves the terminal clean.
  4. After the run completes, the persona calls TuiObserver::shutdown to wait on the TUI thread, then print_post_run_summary for the post-teardown summary line + tree, then exits with an appropriate status from unreached_phase_exit_code.

Structs§

TuiObserver
RunObserver impl that drives crate::app::App from runner lifecycle events.

Functions§

print_post_run_summary
Print a summary of the run after the TUI has torn down.
unreached_phase_exit_code
Returns Some(2) if any phases were pre-mapped (reachable via scenario traversal) but never reached Running status — the caller should print a warning and exit with this code. Returns None if every reachable phase was visited.