v0.3.7-pre.003

This commit is contained in:
2026-09-02 10:05:36 +02:00
parent bc7ccd97a5
commit 862f40ad26
27 changed files with 673 additions and 76 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-backfill-desk/tests/desktop_contract.rs
// version: 1
// version: 2
//! Structural desktop contract checks for the Backfill Desk scaffold.
@@ -24,6 +24,16 @@ fn read_text(path: &std::path::Path) -> String {
};
}
fn read_json(path: &std::path::Path) -> serde_json::Value {
let source = read_text(path);
let parsed = serde_json::from_str(source.as_str());
assert!(parsed.is_ok(), "unable to parse {}", path.display());
return match parsed {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => serde_json::Value::Null,
};
}
fn read_bytes(path: &std::path::Path) -> std::vec::Vec<u8> {
let source = std::fs::read(path);
assert!(source.is_ok(), "unable to read {}", path.display());
@@ -119,3 +129,52 @@ fn pre_002_shell_and_splash_use_shared_frontend_tooling() {
assert!(splash.contains("Splash opacity animation started"));
assert!(splash.contains("Backfill Desk splash frontend loaded"));
}
#[test]
fn pre_003_composite_packaging_follows_atomic_config_registry_contract() {
let root = app_root();
let config = read_json(root.join("tauri.conf.json").as_path());
let resources = config.get("bundle").and_then(|value| value.get("resources")).and_then(serde_json::Value::as_object);
assert!(resources.is_some());
let resources = match resources {
std::option::Option::Some(value) => value,
std::option::Option::None => return,
};
assert_eq!(resources.len(), 14);
for required in [
"../../config/composite.ksp-app-backfill-desk.json",
"../../config/composite.ksp-app-solprices-desk.json",
"../../config/composite.ksp-app-wallet-desk.json",
"../../config/std.logging.json",
"../../config/std.offchain_transport.json",
"../../config/std.store.json",
"../../config/std.transport.json",
"../../config/std.wallet.json",
"../../config/schemas/composite.schema.json",
"../../config/schemas/std.logging.schema.json",
"../../config/schemas/std.offchain_transport.schema.json",
"../../config/schemas/std.store.schema.json",
"../../config/schemas/std.transport.schema.json",
"../../config/schemas/std.wallet.schema.json",
] {
assert!(resources.contains_key(required), "missing packaged Config resource {required}");
}
let tauri = read_text(root.join("src/tauri.rs").as_path());
assert!(tauri.contains("prepare_packaged_runtime"));
assert!(tauri.contains("resource_dir"));
assert!(tauri.contains("set_current_dir"));
}
#[test]
fn pre_003_bootstrap_uses_composite_logging_without_opening_transport_or_store() {
let root = app_root();
let bootstrap = read_text(root.join("src/bootstrap.rs").as_path());
assert!(bootstrap.contains("FILE_ID_COMPOSITE_KSP_APP_BACKFILL_DESK"));
assert!(bootstrap.contains("COMPOSITE_COMPONENT_ID_LOGGING"));
assert!(bootstrap.contains("COMPOSITE_COMPONENT_ID_TRANSPORT"));
assert!(bootstrap.contains("COMPOSITE_COMPONENT_ID_STORE"));
assert!(bootstrap.contains("LogFilterLevel::Trace"));
for forbidden in ["HttpTransportPool", "Store::open", "BackfillJobRuntime", "BackfillRequest"] {
assert!(!bootstrap.contains(forbidden), "pre.003 opens later runtime surface {forbidden}");
}
}