Expand description
Scene tree — the runtime hierarchy as it’s surfaced to renderers.
Distinct from crate::scope_tree::ScopeTree: the scope tree
mirrors the static scenario AST 1:1 (one node per ScenarioNode),
while the scene tree is what’s actually shown to the user —
for_each iterations are unrolled into per-iteration phase
children under a single for_each scope header, and any phases
that aren’t reachable until runtime resolution still appear under
a fallback parent.
Renderers (TUI, web API, post-run summary) walk this tree by parent / children pointers rather than by depth tags, so:
- Per-scope status aggregation (
for_eachis “running” if any child phase is running) becomes a tree walk. - Web
GET /api/scope-treecan serialize the structure directly. - TUI features that want collapse / expand / scope-level summary have the structural information they need.
Status carried here is the small lifecycle enum (PhaseStatus).
Renderers that want richer per-phase metrics (the TUI’s
PhaseSummary with sparkline buffer, percentiles, etc.) keep a
parallel side-map keyed by SceneNodeId — the scene tree
stays cheap to clone and serialize.
Structs§
- DfsIter
- Depth-first iterator over a
SceneTree. - Phase
Filter Stats - Counters returned by
SceneTree::apply_phase_filterso the runner can log how many phases the filter selected vs the total available. - Scene
Node - One node in the scene tree.
- Scene
Tree - The scene tree itself.
nodes[0]is always the synthetic root.
Enums§
- Node
Kind - What kind of node this scene entry represents.
- Phase
Status - Phase lifecycle state. Only carries meaning on
Phasenodes;Scopenodes always start (and stay)Pending, with their effective status derived from descendants.
Functions§
- current
- Snapshot the active scene tree, if installed. Returns
Noneoutside an active session — e.g. standalonenmbrs web. - install_
global - Install the session’s scene tree. Replaces any previously- installed tree (e.g. from a prior in-process runner invocation by the integration-test harness). The runner itself only installs once per session, so production behaviour is unchanged.
- running_
phase_ indent - Indent prefix (single-space repeats) for log lines whose visual nesting should match the executing phase’s scope depth. Empty string when no scene tree is installed.
- with_
global - Read-only access to the active scene tree, if installed.
Returns
Nonewhen no session has published one. Mirrorswith_global_mutfor callers that just need to inspect (e.g. SRD-77 execution-end disposition computation). - with_
global_ mut - Apply a mutation to the active tree, if installed. No-op when no session has published one. Used by the runner’s lifecycle emit sites so the tree mirrors the observer’s view.
Type Aliases§
- Scene
Node Id - Stable index into
SceneTree::nodes. Indices never change for a given tree instance; renderers can hold onto them across status updates.