pub fn prepare_cleared_turns_summary(
msgs: &[ChatMessage],
policy: &ReductionPolicy,
prior: &ReductionLog,
summarizer: &dyn SpanSummarizer,
) -> Option<PreparedClearSummary>Expand description
TR-7’s one side-call site (SPEC.md: “an explicit, budgeted, injectable
side-call… never blocking the main loop”). Call this against the exact
same msgs slice about to be projected (mirrors
probe_read_freshness’s own calling convention), thread the result
through ReductionPolicy::cleared_turns_summary before calling
project_messages. Only ever does anything when
policy.summarize_cleared_turns is set; callers that never enable TR-7
can skip calling this entirely (dev/01: project_messages behaves
identically either way when the policy gate is off).
Returns None — meaning project_messages will render the deterministic
stub — whenever: TR-7 is off; a TurnsCleared range is already
established (A10 fires at most once per session, singleton, so no
side-call is ever needed for an already-decided span); no clear range
currently triggers; the candidate span is below the cost-guard floor
(dev/05, no side-call attempted at all); or the summarizer itself errors
or returns an empty/blank result (dev/03’s fault-injection contract —
this NEVER propagates an error to the caller, by design).