#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum DsfbError {
DimensionMismatch { expected: usize, got: usize },
BaselineNotEstablished,
InvalidEnvelopeRadius { signal_index: usize },
WindowOutOfRange { index: u64 },
EpisodeBufferFull,
SignalBufferFull,
HistoryBufferFull,
HeuristicsBankFull,
InvalidConfig(&'static str),
ParseError { record: u64, field: u16 },
InsufficientBaselineData { available: usize, required: usize },
BufferTooSmall { needed: usize, available: usize },
MissingRealData,
HashMismatch,
}
impl core::fmt::Display for DsfbError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::DimensionMismatch { expected, got } => {
write!(f, "dimension mismatch: expected {}, got {}", expected, got)
}
Self::BaselineNotEstablished => write!(f, "baseline not established"),
Self::InvalidEnvelopeRadius { signal_index } => {
write!(f, "invalid envelope radius at signal {}", signal_index)
}
Self::WindowOutOfRange { index } => {
write!(f, "window index {} out of range", index)
}
Self::EpisodeBufferFull => write!(f, "episode buffer full"),
Self::SignalBufferFull => write!(f, "signal buffer full"),
Self::HistoryBufferFull => write!(f, "history buffer full"),
Self::HeuristicsBankFull => write!(f, "heuristics bank full"),
Self::InvalidConfig(msg) => write!(f, "invalid config: {}", msg),
Self::ParseError { record, field } => {
write!(f, "parse error at record {}, field {}", record, field)
}
Self::InsufficientBaselineData { available, required } => {
write!(f, "insufficient baseline data: {} of {} required", available, required)
}
Self::BufferTooSmall { needed, available } => {
write!(f, "internal flat buffer too small: needed {}, available {}", needed, available)
}
Self::MissingRealData => write!(f, "real-data fixture missing or empty (paper-lock refuses to fall back to synthetic)"),
Self::HashMismatch => write!(f, "fixture SHA-256 does not match manifest"),
}
}
}
pub type Result<T> = core::result::Result<T, DsfbError>;