v0.2.6-pre.003-fix.001

This commit is contained in:
2026-08-20 21:23:09 +02:00
parent f9f9ac79b6
commit 0e72914237
18 changed files with 409 additions and 35 deletions

View File

@@ -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()),

View File

@@ -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"
}
]
}
]
}

View 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"
}
]
}

View File

@@ -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));
}
}
}