Skip to main content

Module causal_state_fold

Module causal_state_fold 

Source
Expand description

Fold-replay for causal node lifecycle state (ADR-067 P1-graph / WEFT-629).

set_node_state emits a causal.node.state chain event on every real transition. Folding those events (optionally plus causal.node.add / causal.node.remove) reconstructs node_id → state at any chain sequence without requiring a full graph snapshot.

This is the chain-event fold half of P1-graph. ADR-067 also describes a per-commit snapshot-diff path (more faithful for un-instrumented mutations); both can coexist — fold is the small kernel ask named by WEFT-629.

Structs§

NodeStateTransition
A single parsed causal.node.state transition.

Functions§

fold_node_states
Fold a sequence of chain events into node_id → current state.
fold_node_states_from_chain
Fold all events on a ChainManager (via ChainManager::tail).
fold_node_states_until
Fold only events with sequence <= at_seq (scrub to chain time T).
parse_node_state_event
Parse a chain event into a NodeStateTransition when kind matches.