vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use super::schema_version::SCHEMA_VERSION;

/// Errors that can occur during TOML rule loading.
#[derive(Debug, thiserror::Error)]
pub enum LoaderError {
    /// Underlying filesystem I/O error.
    #[error("IO error at {path}: {source}")]
    Io {
        /// Path associated with the I/O error.
        path: std::path::PathBuf,
        /// Underlying I/O error.
        #[source]
        source: std::io::Error,
    },
    /// Failed to parse the TOML document.
    #[error("TOML parse error: {0}")]
    Parse(#[from] toml::de::Error),
    /// A file was found outside the permitted directory boundary.
    #[error("Path traversal detected: {0}")]
    PathTraversal(std::path::PathBuf),
    /// The document uses an unknown or missing schema version.
    #[error("Unsupported schema version: {0} (expected {SCHEMA_VERSION})")]
    UnsupportedVersion(String),
    /// A TOML file exceeds the maximum permitted size.
    #[error("TOML file too large: {bytes} bytes (max 1 MiB) at {path}")]
    TomlTooLarge {
        /// Path to the oversized file.
        path: std::path::PathBuf,
        /// Byte length of the file.
        bytes: u64,
    },
    /// A witness count exceeds the maximum reasonable value.
    #[error("Unreasonable witness count: {count} (max 1_000_000)")]
    UnreasonableCount {
        /// The unreasonable count.
        count: usize,
    },
    /// A string field contains unsafe characters.
    #[error("Unsafe string in field '{field}' at byte offset {byte_offset} in {path}")]
    UnsafeString {
        /// Field path where the unsafe string was found.
        field: String,
        /// Path to the file containing the unsafe string.
        path: std::path::PathBuf,
        /// Byte offset of the first unsafe byte.
        byte_offset: usize,
    },
}