pub fn invert(
reduced: &[ChatMessage],
log: &ReductionLog,
sidecar_session: &Session,
) -> Result<Vec<ChatMessage>>Expand description
Reconstruct the full view: every placeholder in reduced replaced by the
original content resolved from sidecar_session (the ONE canonical
model — a Session reconstructed via Session::from_native_str),
hash-verified against SidecarPtr::content_hash before ever
substituting it in.
Fails loudly (Err) rather than silently partial: on any reduced message
whose sc.reduction id has no matching entry in log (an unresolvable
pointer — e.g. the log entry was deleted), on any pointer that no longer
resolves in the sidecar, or on any hash mismatch (a stale/foreign/tampered
sidecar).
Strips the sc.reduction bookkeeping key from every message’s metadata —
it never survives inversion.