//! `RunLogError` — the only error surface for this crate.

use klieo_core::ids::RunId;
use thiserror::Error;

/// Errors raised by `klieo-runlog` operations.
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum RunLogError {
    /// Backend store failure (I/O, serialisation, SQL).
    #[error("runlog store error: {0}")]
    Store(String),

    /// `get`/`delete` requested a `run_id` that does not exist.
    #[error("runlog not found for run_id {0}")]
    NotFound(RunId),

    /// Projection from `Episode` stream into a `RunLog` aggregate failed.
    #[error("runlog projection error: {0}")]
    Projection(String),

    /// Replay-time mismatch — recorded output does not match the live double.
    #[error("runlog replay error: {0}")]
    Replay(String),

    /// Compaction policy failed (e.g. LLM summariser returned non-text).
    #[error("runlog compaction error: {0}")]
    Compaction(String),
}
