v0.2.12-pre.003

This commit is contained in:
2026-08-27 09:33:29 +02:00
parent 0d01017c31
commit 5a165296d9
30 changed files with 806 additions and 111 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-solprices-desk/src/app_state.rs
// version: 1
// version: 2
//! Shared backend state owned by the SOL Prices Desk Tauri application.
@@ -7,12 +7,13 @@
pub(crate) struct AppState {
config_management: ksp_config_lib::ConfigManagement,
logging_runtime: std::sync::Mutex<LoggingRuntimeState>,
offchain_transport_startup: crate::OffchainTransportStartup,
splash_settings: crate::SplashSettings,
splash_sequence_started: std::sync::atomic::AtomicBool,
}
impl AppState {
/// Initializes Config ownership, Logging and the common desktop splash state without creating the Off-chain runtime reserved for `pre.003`.
impl crate::AppState {
/// Initializes Config ownership, composite-managed Logging and the Config-selected Off-chain Transport runtime.
pub(crate) fn initialize(arguments: &[std::ffi::OsString]) -> ksp_core_lib::Result<Self> {
let config_management = crate::config_management(arguments);
let config_management = match config_management {
@@ -29,6 +30,11 @@ impl AppState {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let offchain_transport_startup = crate::initialize_offchain_transport(&config_management);
let offchain_transport_startup = match offchain_transport_startup {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let splash_settings = crate::SplashSettings::load();
let splash_settings = match splash_settings {
std::result::Result::Ok(value) => value,
@@ -46,12 +52,13 @@ impl AppState {
fallback_active: logging_startup.fallback_active,
startup_diagnostic: logging_startup.startup_diagnostic,
}),
offchain_transport_startup,
splash_settings,
splash_sequence_started: std::sync::atomic::AtomicBool::new(false),
});
}
/// Builds the safe scaffold runtime status exposed before market-price composition is introduced.
/// Builds the safe runtime status exposed before provider rows and refresh commands are introduced.
pub(crate) fn runtime_status(&self) -> ksp_core_lib::Result<crate::RuntimeStatusDto> {
let document_count = self.config_management.engine().registry().descriptors().count();
let document_count = u32::try_from(document_count);
@@ -61,7 +68,7 @@ impl AppState {
return std::result::Result::Err(
ksp_core_lib::Error::new(
crate::ERROR_CODE_APP_STATE_INVALID,
"Config registry contains too many descriptors for the SOL Prices Desk scaffold DTO",
"Config registry contains too many descriptors for the SOL Prices Desk runtime DTO",
)
.with_source(error),
);
@@ -78,12 +85,15 @@ impl AppState {
},
};
let _keep_guard_alive = &runtime.guard;
let offchain = self.offchain_transport_startup.resolved();
return std::result::Result::Ok(crate::RuntimeStatusDto {
application_version: env!("CARGO_PKG_VERSION").to_owned(),
active_composite_profile: self.offchain_transport_startup.composite_profile_id().to_owned(),
active_logging_profile: runtime.active_profile_id.clone(),
active_offchain_profile: offchain.profile_id().to_owned(),
application_version: env!("CARGO_PKG_VERSION").to_owned(),
config_document_count: document_count,
fallback_logging_active: runtime.fallback_active,
shell_phase: "pre.002-scaffold".to_owned(),
shell_phase: "pre.003-offchain-bootstrap".to_owned(),
startup_diagnostic: runtime.startup_diagnostic.clone(),
});
}