Files
khadhroony-solana-project/crates/ksp-job-backfill-lib/tests/release_completeness.rs
2026-09-01 14:47:23 +02:00

73 lines
2.7 KiB
Rust

// file: crates/ksp-job-backfill-lib/tests/release_completeness.rs
// version: 3
//! Completeness canaries through the `pre.007` Backfill Store persistence tranche.
#[test]
fn pre_007_production_module_inventory_is_exact() -> std::io::Result<()> {
let source_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
let entries = match std::fs::read_dir(source_root) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let mut names = std::vec::Vec::new();
for entry in entries {
let entry = match entry {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let file_type = match entry.file_type() {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if !file_type.is_file() {
continue;
}
let name = match entry.file_name().into_string() {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => continue,
};
if name.ends_with(".rs") {
names.push(name);
}
}
names.sort_unstable();
assert_eq!(names, std::vec!["constants.rs", "conversion.rs", "discovery.rs", "error.rs", "lib.rs", "persistence.rs", "request.rs"]);
return std::result::Result::Ok(());
}
#[test]
fn pre_007_surface_adds_store_persistence_without_checkpoint_runtime() {
let root = include_str!("../src/lib.rs");
for required in [
"BackfillCandidate",
"BackfillCandidateIdentity",
"BackfillCommitment",
"BackfillDiscovery",
"BackfillDiscoveryBoundary",
"BackfillRequest",
"BackfillScope",
"BackfillScopeFingerprint",
"BackfillSignature",
"discover_backfill_candidates",
"BackfillRawAcquisition",
"BackfillHydrationOutcome",
"hydrate_backfill_candidate",
"RAW_TRANSACTION_FORMAT_ID",
"RAW_TRANSACTION_FORMAT_VERSION",
"ERROR_CODE_BACKFILL_RAW_CONVERSION_INVALID",
"BackfillPersistenceOutcome",
"BackfillEntityPersistence",
"BackfillObservationPersistence",
"persist_backfill_hydration",
"ERROR_CODE_BACKFILL_PERSISTENCE_INVALID",
] {
assert!(root.contains(required), "required pre.006 public contract missing: {required}");
}
for forbidden in ["BackfillCheckpoint", "BackfillJobHandle", "JobSnapshotSource"] {
assert!(!root.contains(forbidden), "later Backfill tranche leaked into pre.007: {forbidden}");
}
assert!(!root.contains("pub mod "));
return;
}