#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(clippy::all)]
mod adapter;
mod audit;
mod envelope;
mod episode;
mod grammar;
mod heuristics;
mod observer;
mod regime;
mod residual;
#[cfg(feature = "std")]
mod evaluation;
#[cfg(feature = "std")]
mod inject;
#[cfg(feature = "std")]
mod report;
#[cfg(feature = "std")]
mod scan;
pub use adapter::{IdentityTelemetryAdapter, TelemetryAdapter};
pub use audit::{AuditEvent, AuditTrace};
pub use envelope::{AdmissibilityEnvelope, EnvelopePosition};
pub use episode::{Episode, EpisodeBuilder};
pub use grammar::{GrammarState, GrammarTransition};
pub use heuristics::{AppliedStaticPrior, StaticPrior, StaticPriorSet};
pub use heuristics::{HeuristicEntry, HeuristicId, HeuristicsBank, MatchResult};
pub use observer::{
DsfbObserver, MultiChannelObserver, ObservationResult, ObserverConfig, ReasonEvidence,
};
pub use regime::{RegimeClassifier, WorkloadPhase};
pub use residual::{ResidualSample, ResidualSign, ResidualSource};
#[cfg(feature = "std")]
pub use evaluation::{
build_public_evaluation, render_public_evaluation_report, reproducibility_verified,
write_public_artifacts, NegativeControlRow, PrimaryEvaluationRow, PublicArtifactPaths,
PublicEvaluationBundle, SensitivitySweepRow,
};
#[cfg(feature = "std")]
pub use inject::{
run_scenario, AsyncStarvationScenario, ChannelBackpressureScenario, ClockDriftScenario,
FaultScenario, PartialPartitionScenario, SampleRecord, ScenarioResult,
};
#[cfg(feature = "std")]
pub use report::{generate_csv, generate_report};
#[cfg(feature = "std")]
pub use scan::{
derive_static_priors_from_scan, export_scan_artifacts, migrate_legacy_scan_artifacts,
prepare_scan_output_run, render_scan_attestation_statement, render_scan_dsse_envelope,
render_scan_report, render_scan_sarif, scan_crate_source, scan_crate_source_with_profile,
CrateSourceScanReport, HeuristicSourceMatch, ScanArtifactPaths, ScanEvidence, ScanProfile,
ScanRunPaths, ScanSigningKey, DEFAULT_SCAN_OUTPUT_ROOT,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ReasonCode {
SustainedLatencyDrift,
ConsensusHeartbeatDegradation,
AsyncRuntimeStarvation,
ChannelBackpressureOnset,
PartialPartitionSignature,
ClockDriftDivergence,
MemoryPressureEscalation,
ThroughputDegradation,
SerializationDrift,
FlowControlExhaustion,
UnclassifiedStructuralAnomaly,
NoAnomaly,
}
impl ReasonCode {
pub fn description(&self) -> &'static str {
match self {
Self::SustainedLatencyDrift => {
"Sustained monotonic latency increase across observation windows"
}
Self::ConsensusHeartbeatDegradation => {
"Consensus heartbeat RTT drifting toward election timeout"
}
Self::AsyncRuntimeStarvation => {
"Async runtime task poll duration increasing monotonically"
}
Self::ChannelBackpressureOnset => {
"Bounded channel approaching capacity with drift-slew onset"
}
Self::PartialPartitionSignature => {
"Asymmetric connectivity: selective latency drift between nodes"
}
Self::ClockDriftDivergence => {
"Clock source divergence producing timestamp residual drift"
}
Self::MemoryPressureEscalation => {
"Memory growth trajectory exceeding workload-phase envelope"
}
Self::ThroughputDegradation => {
"Persistent throughput decline not attributable to workload"
}
Self::SerializationDrift => {
"Serialization latency drift with payload/schema boundary slew"
}
Self::FlowControlExhaustion => "Flow control window approaching exhaustion",
Self::UnclassifiedStructuralAnomaly => {
"Structural anomaly detected; no heuristic match"
}
Self::NoAnomaly => "No structural anomaly detected",
}
}
}
pub const CRATE_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const CONTRACT_VERSION: &str = "1.0";