v0.2.6-pre.018

This commit is contained in:
2026-08-22 10:56:26 +02:00
parent 362123f357
commit ba8f42f9b1
36 changed files with 1238 additions and 150 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-wallet-desk/tests/desktop_contract.rs
// version: 19
// version: 20
//! Desktop build, shell and Config-status contract audits for Wallet Desk.
@@ -417,3 +417,31 @@ fn pre_017_wallet_desk_open_paths_remain_non_migrating() {
assert!(state.contains("ksp_wallet_lib::open_wallet_owner_file"));
assert!(inventory.contains("ksp_wallet_lib::inspect_locked_wallet_file"));
}
#[test]
fn pre_018_packaged_runtime_bundles_config_resources_and_keeps_wallet_desk_version_current() {
let root = app_root();
let tauri = read_json(root.join("tauri.conf.json").as_path());
assert_eq!(tauri.pointer("/version").and_then(serde_json::Value::as_str), std::option::Option::Some("0.2.6-pre.18"));
let package = read_json(root.join("package.json").as_path());
assert_eq!(package.pointer("/version").and_then(serde_json::Value::as_str), std::option::Option::Some("0.2.6-pre.18"));
let resources = tauri.pointer("/bundle/resources").and_then(serde_json::Value::as_object);
assert!(resources.is_some(), "packaged Wallet Desk Config resources map must exist");
if let std::option::Option::Some(resources) = resources {
assert_eq!(resources.len(), 8);
assert_eq!(
resources.get("../../config/composite.ksp-app-wallet-desk.json").and_then(serde_json::Value::as_str),
std::option::Option::Some("config/composite.ksp-app-wallet-desk.json"),
);
assert_eq!(
resources.get("../../config/schemas/composite.schema.json").and_then(serde_json::Value::as_str),
std::option::Option::Some("config/schemas/composite.schema.json"),
);
}
let main = read_text(root.join("frontend/main.html").as_path());
assert!(main.contains("0.2.6-pre.18"));
let tauri_source = read_text(root.join("src/tauri.rs").as_path());
assert!(tauri_source.contains("ksp_config_lib::prepare_packaged_runtime"));
assert!(tauri_source.contains("tauri::utils::platform::resource_dir"));
assert!(tauri_source.contains("std::env::set_current_dir(layout.runtime_root())"));
}

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-wallet-desk/tests/release_compliance.rs
// version: 3
// version: 4
//! Release-wide deterministic compliance canaries for Wallet Desk.
@@ -181,3 +181,36 @@ fn wallet_desk_dependency_firewall_and_tauri_capabilities_are_minimal() {
assert!(!capability_source.contains("dialog:"));
assert!(!capability_source.contains("fs:"));
}
#[test]
fn packaged_resources_include_only_registered_config_sources_and_schemas() {
let root = app_root();
let tauri_source = read_text(root.join("tauri.conf.json").as_path());
let tauri = serde_json::from_str::<serde_json::Value>(tauri_source.as_str());
assert!(tauri.is_ok(), "Wallet Desk Tauri config should parse");
let tauri = match tauri {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
let resources = tauri.pointer("/bundle/resources").and_then(serde_json::Value::as_object);
assert!(resources.is_some(), "Wallet Desk package must declare Config resources");
let resources = match resources {
std::option::Option::Some(value) => value,
std::option::Option::None => return,
};
assert_eq!(resources.len(), 8);
for (source, destination) in resources {
let destination = destination.as_str();
assert!(destination.is_some(), "resource destination must be textual");
let destination = match destination {
std::option::Option::Some(value) => value,
std::option::Option::None => continue,
};
assert!(source.starts_with("../../config/"));
assert!(destination.starts_with("config/"));
for forbidden in [".env", "wallets", "logs", "secret", "private"] {
assert!(!source.contains(forbidden), "mutable/secret runtime resource must not be bundled: {source}");
assert!(!destination.contains(forbidden), "mutable/secret runtime destination must not be bundled: {destination}");
}
}
}