Files
khadhroony-solana-project/crates/ksp-app-raw-transaction-ingest-desk/tests/release_completeness.rs
2026-09-13 11:30:56 +02:00

91 lines
3.0 KiB
Rust

// file: crates/ksp-app-raw-transaction-ingest-desk/tests/release_completeness.rs
// version: 3
//! Release-completeness canaries for Raw Transaction Ingest Desk Config-only route inventory.
#![forbid(unsafe_code)]
#![deny(unreachable_pub)]
#![warn(missing_docs)]
fn app_root() -> std::path::PathBuf {
return std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
}
fn read_text(path: &std::path::Path) -> String {
let source = std::fs::read_to_string(path);
assert!(source.is_ok(), "unable to read {}", path.display());
return match source {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => String::new(),
};
}
#[test]
fn pre_006_production_module_inventory_adds_only_route_inventory_to_the_scaffold() {
let lib = read_text(app_root().join("src/lib.rs").as_path());
let expected = [
"mod app_state;",
"mod bootstrap;",
"mod constants;",
"mod dto_common;",
"mod dto_route;",
"mod errors;",
"mod frontend_logging;",
"mod logging_runtime;",
"mod route_inventory;",
"mod splash;",
"mod tauri;",
"mod tw_main;",
"mod tw_splash;",
];
assert_eq!(lib.matches("mod ").count(), expected.len());
for module in expected {
assert!(lib.contains(module));
}
}
#[test]
fn pre_006_public_surface_still_exposes_only_application_run_entry_point() {
let lib = read_text(app_root().join("src/lib.rs").as_path());
let public_reexports = lib.lines().filter(|line| return line.starts_with("pub use ")).collect::<std::vec::Vec<_>>();
assert_eq!(public_reexports, vec!["pub use self::tauri::run;"]);
}
#[test]
fn pre_006_config_inventory_keeps_start_stop_and_runtime_resources_for_later_tranches() {
let app = read_text(app_root().join("src/app_state.rs").as_path());
let tauri = read_text(app_root().join("src/tauri.rs").as_path());
for forbidden in [
"RawTransactionIngestWorker",
"RawTransactionIngestRuntimeResources",
"request_stop",
"start_with_runtime_resources",
"Store::open",
"HttpTransportPool",
"WsProtocolSession",
"YellowstoneGrpcChannel",
] {
assert!(!app.contains(forbidden));
assert!(!tauri.contains(forbidden));
}
}
#[test]
fn pre_006_inventory_source_is_config_only_and_contains_all_five_capability_requirements() {
let inventory = read_text(app_root().join("src/route_inventory.rs").as_path());
for required in [
"WsSubscriptionKind::Logs",
"WsSubscriptionKind::Block",
"WsSubscriptionKind::HeliusTransaction",
"getTransaction",
"getBlocksWithLimit",
"MissingYellowstoneGrpc",
"MissingRequiredSecret",
] {
assert!(inventory.contains(required), "missing pre.006 inventory requirement {required}");
}
for forbidden in ["connect(", "Store::open", "start_with_runtime_resources", "request_stop"] {
assert!(!inventory.contains(forbidden), "pre.006 inventory performs premature runtime operation {forbidden}");
}
}