v0.2.6-pre.003-fix.001
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// file: crates/ksp-app-config-desk/unit_tests/profiles.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
#[test]
|
||||
fn profile_inventory_exposes_registered_standard_profile_documents() {
|
||||
fn profile_inventory_exposes_registered_profile_documents() {
|
||||
let management = fixture_management();
|
||||
assert!(management.is_ok(), "fixture management should construct: {management:?}");
|
||||
if let std::result::Result::Ok(management) = management {
|
||||
@@ -15,6 +15,12 @@ fn profile_inventory_exposes_registered_standard_profile_documents() {
|
||||
assert!(inventory.iter().any(|document| -> bool {
|
||||
return document.file_id == ksp_config_lib::FILE_ID_STD_TRANSPORT;
|
||||
}));
|
||||
assert!(inventory.iter().any(|document| -> bool {
|
||||
return document.file_id == ksp_config_lib::FILE_ID_STD_WALLET;
|
||||
}));
|
||||
assert!(inventory.iter().any(|document| -> bool {
|
||||
return document.file_id == ksp_config_lib::FILE_ID_COMPOSITE_KSP_APP_WALLET_DESK;
|
||||
}));
|
||||
for document in inventory {
|
||||
assert!(!document.default_profile.is_empty());
|
||||
assert!(document.profile_ids.iter().any(|profile_id| -> bool {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/frontend/ts/main.ts
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
import "bootstrap";
|
||||
import DataTable from "datatables.net-bs5";
|
||||
@@ -55,6 +55,33 @@ function activateView(viewId: ViewId, source: "startup" | "user"): void {
|
||||
frontendTrace("main", "Wallet Desk view DOM updated", { viewId, source });
|
||||
}
|
||||
|
||||
function bindFrontendInteractions(): void {
|
||||
document.addEventListener(
|
||||
"click",
|
||||
event => {
|
||||
const source = event.target;
|
||||
if (!(source instanceof Element)) {
|
||||
return;
|
||||
}
|
||||
const control = source.closest<HTMLElement>('button, a, input, select, textarea, [role="button"], [role="tab"], [data-view], [data-shell-action]');
|
||||
if (!control) {
|
||||
return;
|
||||
}
|
||||
frontendTrace("main", "Frontend control clicked", {
|
||||
controlId: control.id || null,
|
||||
controlType: control instanceof HTMLButtonElement ? control.type : null,
|
||||
disabled: control instanceof HTMLButtonElement ? control.disabled : control.getAttribute("aria-disabled") === "true",
|
||||
role: control.getAttribute("role"),
|
||||
shellAction: control.dataset.shellAction ?? null,
|
||||
tagName: control.tagName.toLowerCase(),
|
||||
viewId: control.dataset.view ?? null,
|
||||
});
|
||||
},
|
||||
true,
|
||||
);
|
||||
frontendTrace("main", "Frontend control interaction logger installed");
|
||||
}
|
||||
|
||||
function bindNavigation(): void {
|
||||
document.querySelectorAll<HTMLButtonElement>("[data-view]").forEach(button => {
|
||||
button.addEventListener("click", () => {
|
||||
@@ -159,6 +186,7 @@ function bindShellActions(): void {
|
||||
async function initializeMain(): Promise<void> {
|
||||
const windowLabel = getCurrentWindow().label;
|
||||
frontendInfo("main", "Wallet Desk main frontend loaded", { windowLabel });
|
||||
bindFrontendInteractions();
|
||||
bindNavigation();
|
||||
bindShellActions();
|
||||
initializeWalletTable();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ksp-app-wallet-desk",
|
||||
"private": true,
|
||||
"version": "0.2.6-pre.3",
|
||||
"version": "0.2.6-pre.3.fix.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "KSP Wallet Desk",
|
||||
"version": "0.2.6-pre.3",
|
||||
"version": "0.2.6-pre.3.fix.1",
|
||||
"identifier": "com.sasedev.ksp-app-wallet-desk",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/config_composition.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Config composition contracts introduced for Wallet Desk pre.003.
|
||||
|
||||
@@ -29,7 +29,8 @@ fn wallet_desk_composite_selects_logging_transport_and_wallet_by_file_id() {
|
||||
assert!(composite.is_ok(), "committed Wallet Desk composite should resolve: {composite:?}");
|
||||
if let std::result::Result::Ok(composite) = composite {
|
||||
assert_eq!(composite.profile_id(), "devnet");
|
||||
assert_component(&composite, "logging", ksp_config_lib::FILE_ID_STD_LOGGING, "local_dev");
|
||||
assert_component(&composite, "logging", ksp_config_lib::FILE_ID_STD_LOGGING, "wallet_desk_dev");
|
||||
assert_wallet_desk_logging_trace_profile(&composite);
|
||||
assert_component(&composite, "transport", ksp_config_lib::FILE_ID_STD_TRANSPORT, "devnet_public");
|
||||
assert_component(&composite, "wallet", ksp_config_lib::FILE_ID_STD_WALLET, "default");
|
||||
}
|
||||
@@ -37,6 +38,46 @@ fn wallet_desk_composite_selects_logging_transport_and_wallet_by_file_id() {
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_wallet_desk_logging_trace_profile(composite: &ksp_config_lib::ResolvedConfigComposite) {
|
||||
let component = composite.component("logging");
|
||||
assert!(component.is_some(), "missing logging component");
|
||||
if let std::option::Option::Some(component) = component {
|
||||
let profile = component.resolved().profile();
|
||||
assert_eq!(profile.get("default_filter").and_then(serde_json::Value::as_str), std::option::Option::Some("info"));
|
||||
let console = profile.get("console").and_then(serde_json::Value::as_object);
|
||||
let console_filter = console
|
||||
.and_then(|value| {
|
||||
return value.get("filter");
|
||||
})
|
||||
.and_then(serde_json::Value::as_object);
|
||||
let console_level = console_filter
|
||||
.and_then(|value| {
|
||||
return value.get("level");
|
||||
})
|
||||
.and_then(serde_json::Value::as_str);
|
||||
assert_eq!(console_level, std::option::Option::Some("trace"));
|
||||
let targets = console_filter
|
||||
.and_then(|value| {
|
||||
return value.get("targets");
|
||||
})
|
||||
.and_then(serde_json::Value::as_array);
|
||||
assert!(targets.is_some(), "Wallet Desk console targets should exist");
|
||||
if let std::option::Option::Some(targets) = targets {
|
||||
assert!(targets.iter().any(|target| -> bool {
|
||||
return target.as_str() == std::option::Option::Some("ksp-app-wallet-desk");
|
||||
}));
|
||||
}
|
||||
let target_filters = profile.get("target_filters").and_then(serde_json::Value::as_array);
|
||||
assert!(target_filters.is_some(), "Wallet Desk target filters should exist");
|
||||
if let std::option::Option::Some(target_filters) = target_filters {
|
||||
assert!(target_filters.iter().any(|filter| -> bool {
|
||||
return filter.get("target_prefix").and_then(serde_json::Value::as_str) == std::option::Option::Some("ksp-app-wallet-desk")
|
||||
&& filter.get("level").and_then(serde_json::Value::as_str) == std::option::Option::Some("trace");
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_component(composite: &ksp_config_lib::ResolvedConfigComposite, component_id: &str, file_id: &str, profile_id: &str) {
|
||||
let component = composite.component(component_id);
|
||||
assert!(component.is_some(), "missing component {component_id}");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/desktop_contract.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Desktop build, shell and Config-status contract audits for Wallet Desk.
|
||||
|
||||
@@ -85,3 +85,15 @@ fn shell_contains_wallet_navigation_datatable_and_lock_state_icons() {
|
||||
assert!(main.contains("ResizeObserver"));
|
||||
assert!(main.contains("simplebar"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frontend_control_interactions_are_trace_logged_without_control_values() {
|
||||
let root = app_root();
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(main.contains("bindFrontendInteractions"));
|
||||
assert!(main.contains("Frontend control clicked"));
|
||||
assert!(main.contains("[role=\"tab\"]"));
|
||||
assert!(main.contains("shellAction: control.dataset.shellAction"));
|
||||
assert!(main.contains("viewId: control.dataset.view"));
|
||||
assert!(!main.contains("control.value"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-config-lib/src/wallet.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
/// Effective standard Wallet configuration resolved from Config.
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
@@ -146,7 +146,7 @@ pub(crate) fn validate_wallet_document_contract(document: &crate::ConfigJsonDocu
|
||||
let subdirectory = profile.get("wallets_subdirectory").and_then(serde_json::Value::as_str);
|
||||
if let std::option::Option::Some(value) = subdirectory {
|
||||
let validation = validate_relative_subdirectory(value);
|
||||
if let std::result::Result::Err(_) = validation {
|
||||
if validation.is_err() {
|
||||
return std::result::Result::Err(
|
||||
wallet_document_error(document, "wallets_subdirectory must contain only relative normal path components")
|
||||
.with_context("profile_index", profile_index.to_string()),
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"default_profile": "devnet",
|
||||
"profiles": [
|
||||
{
|
||||
"profile_id": "devnet",
|
||||
"documents": [
|
||||
{
|
||||
"component_id": "logging",
|
||||
"file_id": "cfg.std.logging",
|
||||
"profile_id": "local_dev"
|
||||
},
|
||||
{
|
||||
"component_id": "transport",
|
||||
"file_id": "cfg.std.transport",
|
||||
"profile_id": "secret_test"
|
||||
},
|
||||
{
|
||||
"component_id": "wallet",
|
||||
"file_id": "cfg.std.wallet",
|
||||
"profile_id": "default"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"profile_id": "temporary",
|
||||
"documents": [
|
||||
{
|
||||
"component_id": "logging",
|
||||
"file_id": "cfg.std.logging",
|
||||
"profile_id": "local_dev"
|
||||
},
|
||||
{
|
||||
"component_id": "transport",
|
||||
"file_id": "cfg.std.transport",
|
||||
"profile_id": "secret_test"
|
||||
},
|
||||
{
|
||||
"component_id": "wallet",
|
||||
"file_id": "cfg.std.wallet",
|
||||
"profile_id": "temporary"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"profile_id": "tests",
|
||||
"documents": [
|
||||
{
|
||||
"component_id": "logging",
|
||||
"file_id": "cfg.std.logging",
|
||||
"profile_id": "local_dev"
|
||||
},
|
||||
{
|
||||
"component_id": "transport",
|
||||
"file_id": "cfg.std.transport",
|
||||
"profile_id": "secret_test"
|
||||
},
|
||||
{
|
||||
"component_id": "wallet",
|
||||
"file_id": "cfg.std.wallet",
|
||||
"profile_id": "tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
18
crates/ksp-config-lib/unit_tests/fixtures/std.wallet.json
Normal file
18
crates/ksp-config-lib/unit_tests/fixtures/std.wallet.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"wallets_directory": "${KSP_WALLETS_DIRECTORY:-wallets}",
|
||||
"default_profile": "default",
|
||||
"profiles": [
|
||||
{
|
||||
"profile_id": "default"
|
||||
},
|
||||
{
|
||||
"profile_id": "temporary",
|
||||
"wallets_subdirectory": "temporary"
|
||||
},
|
||||
{
|
||||
"profile_id": "tests",
|
||||
"wallets_subdirectory": "tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-config-lib/unit_tests/registry.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
#[test]
|
||||
fn descriptors_expose_complete_registry_in_deterministic_file_id_order() {
|
||||
@@ -310,24 +310,24 @@ fn absolute_fixture_path() -> std::path::PathBuf {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn defaults_register_generic_composite_schema_without_runtime_composite() {
|
||||
fn defaults_register_generic_composite_schema_and_wallet_desk_runtime_composite() {
|
||||
let registry = crate::ConfigFileRegistry::defaults();
|
||||
let schema_id = crate::ConfigFileId::new(crate::FILE_ID_SCHEMA_COMPOSITE);
|
||||
let runtime_id = crate::ConfigFileId::new("cfg.composite.ksp-app-wallet-desk");
|
||||
let runtime_id = crate::ConfigFileId::new(crate::FILE_ID_COMPOSITE_KSP_APP_WALLET_DESK);
|
||||
assert!(registry.is_ok(), "default registry should be valid: {registry:?}");
|
||||
assert!(schema_id.is_ok(), "composite schema file_id should be valid: {schema_id:?}");
|
||||
assert!(runtime_id.is_ok(), "future composite runtime file_id syntax should be valid: {runtime_id:?}");
|
||||
assert!(runtime_id.is_ok(), "Wallet Desk composite runtime file_id should be valid: {runtime_id:?}");
|
||||
if let (std::result::Result::Ok(registry), std::result::Result::Ok(schema_id), std::result::Result::Ok(runtime_id)) = (registry, schema_id, runtime_id) {
|
||||
let schema = registry.descriptor(&schema_id);
|
||||
let runtime = registry.descriptor(&runtime_id);
|
||||
assert!(schema.is_ok(), "generic composite schema should be registered: {schema:?}");
|
||||
assert!(runtime.is_err(), "no fictitious runtime composite should be registered");
|
||||
if let std::result::Result::Ok(schema) = schema {
|
||||
assert!(runtime.is_ok(), "Wallet Desk runtime composite should be registered: {runtime:?}");
|
||||
if let (std::result::Result::Ok(schema), std::result::Result::Ok(runtime)) = (schema, runtime) {
|
||||
assert_eq!(schema.kind(), crate::ConfigFileKind::Schema);
|
||||
assert_eq!(schema.filename(), std::path::Path::new(crate::DEFAULT_COMPOSITE_SCHEMA_FILENAME));
|
||||
}
|
||||
if let std::result::Result::Err(error) = runtime {
|
||||
assert_eq!(error.code(), crate::ERROR_CODE_FILE_ID_UNKNOWN);
|
||||
assert_eq!(runtime.kind(), crate::ConfigFileKind::Config);
|
||||
assert_eq!(runtime.filename(), std::path::Path::new(crate::DEFAULT_COMPOSITE_KSP_APP_WALLET_DESK_FILENAME));
|
||||
assert_eq!(runtime.schema_file_id(), std::option::Option::Some(&schema_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user