use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct CertificationClass {
pub name: &'static str,
pub category: CertificationCategory,
pub evidence: &'static [&'static str],
pub smoke_ready: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum CertificationCategory {
UnitProperty,
Fuzz,
CrashHooks,
ConsensusSim,
TxnChecker,
Chaos,
Perf,
}
pub fn certification_inventory() -> Vec<CertificationClass> {
vec![
CertificationClass {
name: "encoding_round_trips",
category: CertificationCategory::UnitProperty,
evidence: &[
"crates/mongreldb-log/tests/envelope.rs",
"crates/mongreldb-types",
],
smoke_ready: true,
},
CertificationClass {
name: "mvcc_visibility",
category: CertificationCategory::UnitProperty,
evidence: &["crates/mongreldb-core/tests/isolation.rs"],
smoke_ready: true,
},
CertificationClass {
name: "timestamp_ordering",
category: CertificationCategory::UnitProperty,
evidence: &[
"crates/mongreldb-types/src/hlc.rs",
"crates/mongreldb-consensus/tests/hlc_monotonicity.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "routing",
category: CertificationCategory::UnitProperty,
evidence: &[
"crates/mongreldb-cluster/src/tablet.rs",
"crates/mongreldb-cluster/src/routing.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "transaction_state_machine",
category: CertificationCategory::UnitProperty,
evidence: &[
"crates/mongreldb-core/tests/txn_*.rs",
"crates/mongreldb-cluster/src/dist_txn.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "catalog_mutations",
category: CertificationCategory::UnitProperty,
evidence: &["crates/mongreldb-core/tests/catalog_commands.rs"],
smoke_ready: true,
},
CertificationClass {
name: "protocol_decode_fuzz",
category: CertificationCategory::Fuzz,
evidence: &["crates/mongreldb-protocol/src/envelope.rs"],
smoke_ready: true,
},
CertificationClass {
name: "wal_log_decode",
category: CertificationCategory::Fuzz,
evidence: &["crates/mongreldb-core/tests/fault_injection.rs"],
smoke_ready: true,
},
CertificationClass {
name: "snapshot_decode",
category: CertificationCategory::Fuzz,
evidence: &["crates/mongreldb-consensus/src/state_machine.rs"],
smoke_ready: true,
},
CertificationClass {
name: "crash_at_hooks",
category: CertificationCategory::CrashHooks,
evidence: &[
"crates/mongreldb-fault",
"crates/mongreldb-cluster/src/split.rs",
"crates/mongreldb-cluster/src/merge.rs",
"crates/mongreldb-cluster/src/cluster_backup.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "consensus_sim",
category: CertificationCategory::ConsensusSim,
evidence: &[
"crates/mongreldb-sim",
"crates/mongreldb-consensus/tests/chaos.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "reference_model_txn_checker",
category: CertificationCategory::TxnChecker,
evidence: &[
"crates/mongreldb-core/tests/isolation.rs",
"crates/mongreldb-cluster/src/dist_txn.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "chaos_cluster",
category: CertificationCategory::Chaos,
evidence: &[
"crates/mongreldb-consensus/tests/chaos.rs",
"crates/mongreldb-cluster/tests/runtime.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "perf_oltp_mixed",
category: CertificationCategory::Perf,
evidence: &[
"BENCHMARKS.md",
"crates/mongreldb-core/tests/qualification.rs",
],
smoke_ready: true,
},
CertificationClass {
name: "perf_ai_rag",
category: CertificationCategory::Perf,
evidence: &[
"crates/mongreldb-core/examples/ai_retrieval_bench.rs",
"BENCHMARKS.md",
],
smoke_ready: true,
},
]
}
pub fn inventory_smoke() -> Result<(), String> {
let inv = certification_inventory();
if inv.is_empty() {
return Err("empty certification inventory".into());
}
for c in &inv {
if c.name.is_empty() {
return Err("unnamed certification class".into());
}
if c.evidence.is_empty() {
return Err(format!("{} has no evidence paths", c.name));
}
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn inventory_covers_required_categories() {
inventory_smoke().unwrap();
let inv = certification_inventory();
for cat in [
CertificationCategory::UnitProperty,
CertificationCategory::Fuzz,
CertificationCategory::CrashHooks,
CertificationCategory::ConsensusSim,
CertificationCategory::TxnChecker,
CertificationCategory::Chaos,
CertificationCategory::Perf,
] {
assert!(
inv.iter().any(|c| c.category == cat),
"missing category {cat:?}"
);
}
assert!(inv.iter().all(|c| c.smoke_ready));
}
}