v0.3.2-pre.004-fix.001

This commit is contained in:
2026-08-29 19:04:47 +02:00
parent 6d2b1401aa
commit 0a4cddafc4
17 changed files with 509 additions and 99 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-config-lib/src/store.rs
// version: 1
// version: 2
/// Effective standard Store configuration mapped to `ksp_store_lib::StoreSettings`.
pub struct ResolvedStoreConfig {
@@ -25,11 +25,19 @@ impl ResolvedStoreConfig {
}
/// Returns the selected standard Store profile identifier.
///
/// For `std.store`, the profile identifier is also the stable named Store target identifier.
#[must_use]
pub fn profile_id(&self) -> &str {
return self.profile_id.as_str();
}
/// Returns the selected named Store target identifier.
#[must_use]
pub fn target_id(&self) -> &str {
return self.profile_id.as_str();
}
/// Returns the source that selected the standard Store profile.
#[must_use]
pub const fn selection_source(&self) -> crate::ConfigProfileSelectionSource {
@@ -111,6 +119,7 @@ impl crate::ConfigDocumentEngine {
struct EffectiveStoreSource {
backend: String,
format_version: u32,
network: String,
postgres: EffectivePostgresSource,
profile_id: String,
}
@@ -164,9 +173,7 @@ fn resolve_store_profile(profile: &crate::ResolvedConfigProfile, environment: &c
let source = match source {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
return std::result::Result::Err(
effective_error(profile, "effective Store Config cannot be decoded into the runtime adapter contract").with_source(error),
);
return std::result::Result::Err(effective_error(profile, "effective Store Config cannot be decoded into the runtime adapter contract").with_source(error));
},
};
if source.format_version != 1 {
@@ -195,8 +202,14 @@ fn resolve_store_profile(profile: &crate::ResolvedConfigProfile, environment: &c
std::time::Duration::from_millis(source.postgres.bootstrap.migration_timeout_ms),
std::time::Duration::from_millis(source.postgres.bootstrap.migration_lock_timeout_ms),
);
let network = ksp_store_lib::RawNetworkId::new(source.network);
let network = match network {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return std::result::Result::Err(effective_error(profile, "effective Store network identifier is invalid")),
};
let postgres = ksp_store_lib::PostgresStoreSettings::new(source.postgres.connection_uri, pool, tls_mode, bootstrap);
let settings = ksp_store_lib::StoreSettings::new(
network,
ksp_store_lib::StoreBackendSettings::Postgres(postgres),
std::time::Duration::from_millis(source.postgres.shutdown_timeout_ms),
);
@@ -206,6 +219,7 @@ fn resolve_store_profile(profile: &crate::ResolvedConfigProfile, environment: &c
ksp_logging_lib::debug!(
target: crate::TRACING_TARGET,
profile_id = profile.profile_id(),
network = settings.network().as_str(),
backend = settings.backend_kind().code(),
"mapped standard Store Config to Store settings"
);
@@ -219,7 +233,10 @@ fn resolve_store_profile(profile: &crate::ResolvedConfigProfile, environment: &c
});
}
fn validate_connection_uri_provenance(effective: &crate::ResolvedConfigJson, profile: &crate::ResolvedConfigProfile) -> ksp_core_lib::Result<()> {
fn validate_connection_uri_provenance(
effective: &crate::ResolvedConfigJson,
profile: &crate::ResolvedConfigProfile,
) -> ksp_core_lib::Result<()> {
let provenance = match effective.provenance_at("/postgres/connection_uri") {
std::option::Option::Some(value) => value,
std::option::Option::None => return std::result::Result::Err(effective_error(profile, "Store PostgreSQL connection URI provenance is unavailable")),