feat(aura-core, aura-engine): Node::initialize — the start-of-stream mirror of finalize
Adds the second lifecycle hook the #283 design revision pairs with finalize: Node::initialize (default no-op) runs once per node, in topological order, before the first source value — inside the deterministic sequence, no within-sim concurrency (C1). Consumers acquire run resources there (the record consumer opens its streaming writer); the hook is infallible by signature, so an acquiring node stores its error, degrades to inert, and surfaces the failure once, terminally, at finalize. Every existing node keeps the default. Pinned by the mirror test run_initializes_every_node_once_before_the_stream (init0,init1 strictly before any eval, exactly once), the shape of the existing finalize test. RED was observed by temporarily reverting the flush (test fails with evals-before-inits), then re-applied. Ledger note for cycle close: C8's lifecycle section gains initialize as finalize's mirror. refs #283
This commit is contained in:
@@ -379,6 +379,15 @@ pub trait Node {
|
||||
"node".to_string()
|
||||
}
|
||||
|
||||
/// Start-of-stream hook: `Harness::run` calls it once per node, in
|
||||
/// topological order, before the first source value — the mirror of
|
||||
/// [`Node::finalize`]. A consumer overrides it to acquire run resources
|
||||
/// (e.g. the file a recording sink streams into). Infallible by
|
||||
/// signature: an implementation that can fail stores its error, degrades
|
||||
/// to inert, and surfaces the failure once, terminally, at `finalize`.
|
||||
/// The default is a no-op, so existing nodes are unaffected.
|
||||
fn initialize(&mut self) {}
|
||||
|
||||
/// End-of-stream hook: `Harness::run` calls it once per node, in topological
|
||||
/// order, after the source loop drains. A folding sink overrides it to flush
|
||||
/// its accumulated summary; the default is a no-op, so existing nodes are
|
||||
|
||||
Reference in New Issue
Block a user