v0.3.8-pre.006-fix.001

This commit is contained in:
2026-09-03 16:28:13 +02:00
parent 3a38914be7
commit 8130e01b70
11 changed files with 139 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-store-desk/src/dto_common.rs
// version: 2
// version: 3
//! Common Tauri DTOs shared by the Store Desk shell and Store runtime Overview.
@@ -46,7 +46,7 @@ pub(crate) struct ShellStatusDto {
/// Current implementation phase exposed by the shell.
pub(crate) shell_phase: String,
/// Safe startup diagnostic that caused fallback Logging, when applicable.
pub(crate) startup_diagnostic: std::option::Option<CommandErrorDto>,
pub(crate) startup_diagnostic: std::option::Option<crate::CommandErrorDto>,
}
/// Backend-neutral Store runtime and health projection used by the Overview screen.
@@ -57,7 +57,7 @@ pub(crate) struct StoreRuntimeStatusDto {
/// Stable selected Store backend kind, when configuration resolution reached that phase.
pub(crate) backend_kind: std::option::Option<String>,
/// Safe Store startup/health diagnostic, when present.
pub(crate) diagnostic: std::option::Option<CommandErrorDto>,
pub(crate) diagnostic: std::option::Option<crate::CommandErrorDto>,
/// Portable Store health code (`ready`, `not_ready`, `unavailable`, `closed`, or `unknown`).
pub(crate) health_state: String,
/// Applied migration version rendered as an exact decimal string.

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-store-desk/src/frontend_logging.rs
// version: 1
// version: 2
//! KSP-owned bridge for technical log events emitted by Store Desk frontend scripts.
@@ -35,7 +35,7 @@ enum FrontendLogTarget {
}
/// Emits one validated frontend event through the KSP Logging facade.
pub(crate) fn emit_frontend_log_event(payload: FrontendLogPayloadDto) -> ksp_core_lib::Result<()> {
pub(crate) fn emit_frontend_log_event(payload: crate::FrontendLogPayloadDto) -> ksp_core_lib::Result<()> {
let level = parse_level(payload.level.as_str());
let level = match level {
std::result::Result::Ok(value) => value,

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-store-desk/src/splash.rs
// version: 1
// version: 2
//! Common splash settings and frontend event contracts for Store Desk.
@@ -25,7 +25,7 @@ pub(crate) struct SplashSettings {
fade_out_source: ksp_config_lib::ConfigEnvironmentSource,
}
impl SplashSettings {
impl crate::SplashSettings {
/// Resolves splash timings through the Config-owned environment snapshot.
pub(crate) fn load() -> ksp_core_lib::Result<Self> {
let environment = ksp_config_lib::ConfigEnvironment::load();
@@ -144,7 +144,7 @@ pub(crate) struct SplashOrderDto {
pub(crate) duration_ms: std::option::Option<u32>,
}
impl SplashOrderDto {
impl crate::SplashOrderDto {
/// Creates a new `SplashOrderDto` value.
#[must_use]
pub(crate) fn new(action: &str, message: std::option::Option<&str>, status: std::option::Option<&str>, duration_ms: std::option::Option<u32>) -> Self {

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-store-desk/src/store_runtime.rs
// version: 1
// version: 2
//! Composite-selected Store readiness, status and bounded shutdown lifecycle owned by Store Desk.
@@ -9,10 +9,10 @@ pub(crate) struct StoreStartup {
diagnostic: std::option::Option<crate::CommandErrorDto>,
network: std::option::Option<String>,
profile_id: std::option::Option<String>,
runtime: std::option::Option<StoreRuntime>,
runtime: std::option::Option<crate::StoreRuntime>,
}
impl StoreStartup {
impl crate::StoreStartup {
/// Builds a fresh backend-neutral runtime/health projection for the Overview screen.
pub(crate) async fn status(&self) -> crate::StoreRuntimeStatusDto {
let runtime = self.runtime.as_ref();
@@ -51,7 +51,7 @@ pub(crate) struct StoreRuntime {
store: tokio::sync::RwLock<std::option::Option<ksp_store_lib::Store>>,
}
impl StoreRuntime {
impl crate::StoreRuntime {
/// Builds one fresh safe Store status from the retained facade without exposing backend connection details.
pub(crate) async fn status(&self) -> crate::StoreRuntimeStatusDto {
let locked = self.store.read().await;
@@ -128,7 +128,7 @@ impl StoreRuntime {
}
/// Resolves the composite Store target, opens Store through the facade and captures one initial readiness probe.
pub(crate) async fn initialize_store(management: &ksp_config_lib::ConfigManagement) -> StoreStartup {
pub(crate) async fn initialize_store(management: &ksp_config_lib::ConfigManagement) -> crate::StoreStartup {
let environment = ksp_config_lib::ConfigEnvironment::load();
let environment = match environment {
std::result::Result::Ok(value) => value,
@@ -189,12 +189,12 @@ pub(crate) async fn initialize_store(management: &ksp_config_lib::ConfigManageme
pending_migration_count = health.pending_migration_count(),
"initialized Store Desk Store from composite-managed configuration"
);
return StoreStartup {
return crate::StoreStartup {
backend_kind: std::option::Option::Some(backend_kind),
diagnostic: non_ready_health_diagnostic(&health),
network: std::option::Option::Some(network),
profile_id: std::option::Option::Some(profile_id.clone()),
runtime: std::option::Option::Some(StoreRuntime { profile_id, store: tokio::sync::RwLock::new(std::option::Option::Some(store)) }),
runtime: std::option::Option::Some(crate::StoreRuntime { profile_id, store: tokio::sync::RwLock::new(std::option::Option::Some(store)) }),
};
}
@@ -230,7 +230,7 @@ fn unavailable_startup(
backend_kind: std::option::Option<String>,
network: std::option::Option<String>,
error: ksp_core_lib::Error,
) -> StoreStartup {
) -> crate::StoreStartup {
let diagnostic = crate::CommandErrorDto::from_error(&error);
ksp_logging_lib::warn!(
target: crate::TRACING_TARGET,
@@ -239,7 +239,7 @@ fn unavailable_startup(
error_code = diagnostic.code.as_str(),
"Store Desk Store readiness is unavailable; keeping desktop shell available"
);
return StoreStartup {
return crate::StoreStartup {
backend_kind,
diagnostic: std::option::Option::Some(diagnostic),
network,

View File

@@ -1,12 +1,12 @@
// file: crates/ksp-app-store-desk/src/tw_main.rs
// version: 1
// version: 2
//! Tauri-window helpers for the Store Desk main window.
use tauri::Manager; // rust-rules: trait-import
/// Crate-internal `WINDOW_LABEL_MAIN` constant.
pub(crate) const WINDOW_LABEL_MAIN: &str = "main";
/// Private main-window label owned by this module.
const WINDOW_LABEL_MAIN: &str = "main";
/// Resolves the required main window or returns a typed error.
pub(crate) fn require_main_window(manager: &impl Manager<tauri::Wry>) -> ksp_core_lib::Result<tauri::WebviewWindow> {

View File

@@ -1,15 +1,14 @@
// file: crates/ksp-app-store-desk/src/tw_splash.rs
// version: 1
// version: 2
//! Tauri-window lifecycle for the Store Desk splash window.
use tauri::Emitter; // rust-rules: trait-import
use tauri::Manager; // rust-rules: trait-import
/// Crate-internal splash window label.
pub(crate) const WINDOW_LABEL_SPLASH: &str = "splash";
const SPLASH_EVENT_NAME: &str = "ksp-splash-order";
/// Private splash-window label owned by this module.
const WINDOW_LABEL_SPLASH: &str = "splash";
/// Resolves the required splash window or returns a typed error.
pub(crate) fn require_splash_window(manager: &impl Manager<tauri::Wry>) -> ksp_core_lib::Result<tauri::WebviewWindow> {

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-store-desk/tests/dependency_boundary.rs
// version: 3
// version: 4
//! Dependency-boundary tests for the Store Desk application.
@@ -40,3 +40,38 @@ fn pre_006_store_open_is_owned_by_store_runtime_and_never_escapes_to_physical_sq
assert!(!sources.contains(forbidden), "Store Desk leaked forbidden physical Store surface: {forbidden}");
}
}
#[test]
fn pre_006_fix_001_shared_visible_items_use_the_crate_root_facade_inside_owner_modules() {
let lib = include_str!("../src/lib.rs");
let dto_common = include_str!("../src/dto_common.rs");
let frontend_logging = include_str!("../src/frontend_logging.rs");
let splash = include_str!("../src/splash.rs");
let store_runtime = include_str!("../src/store_runtime.rs");
let tw_main = include_str!("../src/tw_main.rs");
let tw_splash = include_str!("../src/tw_splash.rs");
for expected in [
"pub(crate) use self::dto_common::CommandErrorDto;",
"pub(crate) use self::frontend_logging::FrontendLogPayloadDto;",
"pub(crate) use self::splash::SplashOrderDto;",
"pub(crate) use self::splash::SplashSettings;",
"pub(crate) use self::store_runtime::StoreRuntime;",
"pub(crate) use self::store_runtime::StoreStartup;",
] {
assert!(lib.contains(expected), "missing Store Desk crate-root re-export: {expected}");
}
assert!(dto_common.contains("std::option::Option<crate::CommandErrorDto>"));
assert!(frontend_logging.contains("payload: crate::FrontendLogPayloadDto"));
assert!(splash.contains("impl crate::SplashSettings"));
assert!(splash.contains("impl crate::SplashOrderDto"));
assert!(store_runtime.contains("std::option::Option<crate::StoreRuntime>"));
assert!(store_runtime.contains("impl crate::StoreRuntime"));
assert!(store_runtime.contains("impl crate::StoreStartup"));
assert!(store_runtime.contains("-> crate::StoreStartup"));
assert!(store_runtime.contains("crate::StoreStartup {"));
assert!(store_runtime.contains("std::option::Option::Some(crate::StoreRuntime {"));
assert!(tw_main.contains("const WINDOW_LABEL_MAIN: &str = \"main\";"));
assert!(!tw_main.contains("pub(crate) const WINDOW_LABEL_MAIN"));
assert!(tw_splash.contains("const WINDOW_LABEL_SPLASH: &str = \"splash\";"));
assert!(!tw_splash.contains("pub(crate) const WINDOW_LABEL_SPLASH"));
}