//! # `chanora_diagnostics` //! //! Application diagnostics. Owns: //! //! * the redaction policy and [`Redactor`] (REDACT-TC-001..010 per //! `docs/security/diagnostic-redaction-audit-report.md` §4) //! * the diagnostic-export bundle (audit report §5) //! * the `KnownSecretRegistry` cross-spike contract (SS-AUD-003 //! defence in depth) //! * the `tracing-subscriber` layer integration that enforces //! redaction at write-time (REDACT-FIND-002) //! //! Per DEC-016 diagnostics export is **user-initiated only**; there //! is no automatic upload. //! //! ## Status //! //! Scaffold only. #![forbid(unsafe_code)] #![warn(missing_docs)] use thiserror::Error; /// Errors raised by the diagnostics subsystem. #[derive(Debug, Error)] pub enum DiagnosticsError { /// Failed to build or serialise a diagnostic export. #[error("export failed: {0}")] Export(String), /// I/O error while writing logs or exports. #[error("io: {0}")] Io(String), } /// The replacement marker used for redacted segments, identical to /// the PoC value so audit grep patterns survive the promotion. pub const REDACTION_MARKER: &str = "[REDACTED]"; /// Placeholder for the redactor that will be promoted from /// `poc/diagnostics-redaction-spike`. pub struct Redactor { _seal: (), } impl Redactor { /// Construct a redactor with the default policy. pub fn with_default_policy() -> Self { Self { _seal: () } } } #[cfg(test)] mod tests { use super::*; #[test] fn marker_matches_poc() { assert_eq!(REDACTION_MARKER, "[REDACTED]"); } }