Skip to main content

terminal_flush_seam

Function terminal_flush_seam 

Source
pub fn terminal_flush_seam(
    allow_chain: bool,
    auto_turn_pending: &mut bool,
    pending_events: &mut Vec<String>,
    api_messages: &mut Vec<Arc<Value>>,
    events_auto_turn: bool,
    consecutive_auto_turns: &mut u32,
) -> Option<String>
Expand description

Pure decision logic mirroring terminal_flush from cmd/rpc.rs for use in integration tests.

This seam allows tests to verify the allow_chain contract on the mutable state fields that terminal_flush operates on, without requiring a live Runtime, Session, or Mutex<RpcState>.

Rules (identical to terminal_flush):

  • Always: clear auto_turn_pending; take pending_events → inject into api_messages.
  • allow_chain = false: never reserve; return None; leave counter unchanged.
  • allow_chain = true: if all conditions met, increment counter, set auto_turn_pending = true, return Some("auto:seam").