arcature 2026.2.1

Arcature application framework: a high-level Application facade over the certified Arcature subsystems, with the low-level Axum/Tower escape hatch preserved.
Documentation
//! `CheckSeverity` (AP2.1-7).
//!
//! The priority a failing system-check result is reported at. A small,
//! fixed, low-cardinality enumeration serialized as a lowercase string so
//! a downstream filter (Inspector, CI, MCP `system_checks`) can pivot
//! without free-text matching. See `category` for the dual classification.

use std::fmt;

/// The severity of a failing system-check result.
///
/// - `Error` — the application is misconfigured in a way that will break
///   production (a missing required secret, a destructive migration
///   pending, a certified-stack violation).
/// - `Warning` — the application will run but a likely problem should be
///   fixed (an unverified toolchain version, a deprecated config key).
/// - `Info` — a non-actionable observation (the number of registered
///   routes, a recommended best practice not yet adopted).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CheckSeverity {
    Error,
    Warning,
    Info,
}

impl CheckSeverity {
    /// The stable lowercase string used in JSON output and human filters.
    #[must_use]
    pub const fn as_str(self) -> &'static str {
        match self {
            Self::Error => "error",
            Self::Warning => "warning",
            Self::Info => "info",
        }
    }
}

impl fmt::Display for CheckSeverity {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(self.as_str())
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn severities_are_stable_lowercase_strings() {
        assert_eq!(CheckSeverity::Error.as_str(), "error");
        assert_eq!(CheckSeverity::Warning.as_str(), "warning");
        assert_eq!(CheckSeverity::Info.as_str(), "info");
        assert_eq!(CheckSeverity::Error.to_string(), "error");
    }

    #[test]
    fn severities_are_distinct() {
        let all = [
            CheckSeverity::Error,
            CheckSeverity::Warning,
            CheckSeverity::Info,
        ];
        let names: Vec<&str> = all.iter().map(|s| s.as_str()).collect();
        let mut unique = names.clone();
        unique.sort();
        unique.dedup();
        assert_eq!(unique.len(), all.len());
    }
}