109 lines
4.2 KiB
Rust
109 lines
4.2 KiB
Rust
// file: crates/ksp-app-raw-transaction-ingest-desk/tests/release_completeness.rs
|
|
// version: 6
|
|
|
|
//! Release-completeness canaries for Raw Transaction Ingest Desk Start-resource reconstruction.
|
|
|
|
#![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_008_production_module_inventory_adds_only_route_runtime_to_pre_007_surface() {
|
|
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 route_runtime;",
|
|
"mod route_start;",
|
|
"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_008_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_008_keeps_five_exact_source_reconstructions_separate_from_store_worker_lifecycle() {
|
|
let route_start = read_text(app_root().join("src/route_start.rs").as_path());
|
|
for required in [
|
|
"RawTransactionIngestYellowstoneSource::new",
|
|
"RawTransactionIngestStandardLogsSource::new",
|
|
"RawTransactionIngestStandardBlockSource::new",
|
|
"RawTransactionIngestHeliusTransactionSource::new",
|
|
"RawTransactionIngestHttpBlockPollingSource::new",
|
|
"RawTransactionIngestRuntimeResources",
|
|
] {
|
|
assert!(route_start.contains(required), "missing pre.008 exact Worker resource marker {required}");
|
|
}
|
|
for forbidden in ["Store::open", "start_with_runtime_resources", "request_stop", "wait_terminal"] {
|
|
assert!(!route_start.contains(forbidden), "route preparation owns runtime lifecycle marker {forbidden}");
|
|
}
|
|
let runtime = read_text(app_root().join("src/route_runtime.rs").as_path());
|
|
for required in ["Store::open", "start_with_runtime_resources", "request_stop", "wait_terminal", "StoreHealthState::Ready", "close_store_arc"] {
|
|
assert!(runtime.contains(required), "missing pre.008 lifecycle marker {required}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn pre_007_start_revalidation_reuses_inventory_and_requires_profile_network_identity() {
|
|
let route_start = read_text(app_root().join("src/route_start.rs").as_path());
|
|
for required in [
|
|
"current_generation == 0",
|
|
"request.inventory_generation != current_generation",
|
|
"build_route_inventory_with_environment",
|
|
"request.profile_id",
|
|
"resolve_store_config_profile",
|
|
"store.settings().network().as_str() != network",
|
|
"transport_matches_network",
|
|
] {
|
|
assert!(route_start.contains(required), "missing pre.007 revalidation marker {required}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn pre_008_mono_route_slot_blocks_second_start_until_terminal_store_cleanup() {
|
|
let runtime = read_text(app_root().join("src/route_runtime.rs").as_path());
|
|
for required in [
|
|
"RouteRuntimeSlot::Starting",
|
|
"RouteRuntimeSlot::Active",
|
|
"ERROR_CODE_ROUTE_RUNTIME_ACTIVE",
|
|
"inner.last_terminal = std::option::Option::None",
|
|
"std::option::Option::Some(terminal) => return std::result::Result::Ok(terminal.clone())",
|
|
"self.runtime_state.finish(self.token, terminal)",
|
|
"Arc::try_unwrap",
|
|
] {
|
|
assert!(runtime.contains(required), "missing mono-route ownership marker {required}");
|
|
}
|
|
}
|