Files
khadhroony-solana-project/crates/ksp-app-backfill-desk/src/lib.rs
2026-09-02 20:29:50 +02:00

193 lines
11 KiB
Rust

// file: crates/ksp-app-backfill-desk/src/lib.rs
// version: 11
//! Tauri desktop application scaffold for controlling and inspecting KSP RAW backfill jobs.
#![forbid(unsafe_code)]
#![deny(unreachable_pub)]
#![warn(missing_docs)]
mod app_state;
mod backfill_request;
mod backfill_run;
mod backfill_status;
mod bootstrap;
mod constants;
mod dto_backfill;
mod dto_common;
mod errors;
mod frontend_logging;
mod logging_runtime;
mod splash;
mod store_runtime;
mod tauri;
mod transport_runtime;
mod tw_main;
mod tw_splash;
/// Runs the KSP Backfill desktop application.
pub use self::tauri::run;
/// Shared Backfill Desk application state managed by Tauri.
pub(crate) use self::app_state::AppState;
/// Maps one app-owned campaign DTO to the validated KSP Backfill request contract.
pub(crate) use self::backfill_request::map_backfill_request;
/// Projects one validated Backfill request without returning address or signature values.
pub(crate) use self::backfill_request::project_backfill_request;
/// Fully prepared Backfill launch moved into the async runtime after single-run admission.
pub(crate) use self::backfill_run::BackfillRunLaunch;
/// Single-active-run admission state retained by the application.
pub(crate) use self::backfill_run::BackfillRunState;
/// Stable Tauri event carrying coalesced latest-value Backfill status.
pub(crate) use self::backfill_status::BACKFILL_STATUS_EVENT_NAME;
/// Frontend-safe latest-value Backfill runtime projection.
pub(crate) use self::backfill_status::BackfillRunStatusDto;
/// Projects one complete Job notification to the safe desktop monitoring contract.
pub(crate) use self::backfill_status::project_backfill_status;
/// Crate-internal Logging startup state shared by the application state.
pub(crate) use self::bootstrap::LoggingStartup;
/// Builds the Config management facade from the common KSP CLI bootstrap contract.
pub(crate) use self::bootstrap::config_management;
/// Initializes Logging from the Backfill Desk composite, with a trace-level development fallback.
pub(crate) use self::bootstrap::initialize_logging;
/// Loads the concrete Backfill Desk Config composite.
pub(crate) use self::bootstrap::load_backfill_desk_composite;
/// Returns one required component profile from the Backfill Desk composite.
pub(crate) use self::bootstrap::required_composite_component_profile;
/// Composite component identifier for Logging.
pub(crate) use self::constants::COMPOSITE_COMPONENT_ID_LOGGING;
/// Composite component identifier for Store.
pub(crate) use self::constants::COMPOSITE_COMPONENT_ID_STORE;
/// Composite component identifier for Transport.
pub(crate) use self::constants::COMPOSITE_COMPONENT_ID_TRANSPORT;
/// Initial hydration concurrency proposed by the Backfill campaign form.
pub(crate) use self::constants::DEFAULT_BACKFILL_HYDRATION_CONCURRENCY;
/// Initial candidate cap proposed by the Backfill campaign form.
pub(crate) use self::constants::DEFAULT_BACKFILL_MAX_CANDIDATES;
/// Initial discovery-page cap proposed by the Backfill campaign form.
pub(crate) use self::constants::DEFAULT_BACKFILL_MAX_PAGES;
/// Initial signature page size proposed by the Backfill campaign form.
pub(crate) use self::constants::DEFAULT_BACKFILL_PAGE_SIZE;
/// Structured domain used while bootstrapping Config and Logging.
pub(crate) use self::constants::TRACING_DOMAIN_BOOTSTRAP;
/// Structured domain used by technical frontend events.
pub(crate) use self::constants::TRACING_DOMAIN_FRONTEND;
/// Structured domain used by Backfill campaign admission and request mapping.
pub(crate) use self::constants::TRACING_DOMAIN_REQUEST;
/// Structured domain used by concrete Backfill run admission and execution.
pub(crate) use self::constants::TRACING_DOMAIN_RUN;
/// Structured domain used by the Backfill Desk shell.
pub(crate) use self::constants::TRACING_DOMAIN_SHELL;
/// Structured domain used by Store readiness and shutdown operations.
pub(crate) use self::constants::TRACING_DOMAIN_STORE;
/// Structured domain used by Transport readiness and role inventory operations.
pub(crate) use self::constants::TRACING_DOMAIN_TRANSPORT;
/// Structured domain used by Tauri window lifecycle operations.
pub(crate) use self::constants::TRACING_DOMAIN_WINDOWS;
/// Owning target for backend events emitted by Backfill Desk.
pub(crate) use self::constants::TRACING_TARGET;
/// Owning target for generic frontend events emitted through the KSP bridge.
pub(crate) use self::constants::TRACING_TARGET_FRONTEND;
/// Owning target for main-window frontend events.
pub(crate) use self::constants::TRACING_TARGET_FRONTEND_MAIN;
/// Owning target for splash-window frontend events.
pub(crate) use self::constants::TRACING_TARGET_FRONTEND_SPLASH;
/// Safe acknowledgement returned by targeted cooperative cancellation.
pub(crate) use self::dto_backfill::BackfillCancelResponseDto;
/// Backend-derived request bounds and Desk defaults for the campaign form.
pub(crate) use self::dto_backfill::BackfillRequestLimitsDto;
/// Safe request preview produced after strict backend mapping.
pub(crate) use self::dto_backfill::BackfillRequestPreviewDto;
/// Safe acknowledgement returned after in-session checkpoint Resume admission.
pub(crate) use self::dto_backfill::BackfillResumeResponseDto;
/// App-owned campaign request received from the frontend.
pub(crate) use self::dto_backfill::BackfillStartRequestDto;
/// Safe immediate acknowledgement returned after one Backfill run is admitted and spawned.
pub(crate) use self::dto_backfill::BackfillStartResponseDto;
/// Returns commitment codes admitted by the current Backfill contract.
pub(crate) use self::dto_backfill::backfill_commitment_codes;
/// Builds frontend-safe campaign limits from Job-owned public constants.
pub(crate) use self::dto_backfill::backfill_request_limits;
/// Returns scope kind codes admitted by the current Backfill contract.
pub(crate) use self::dto_backfill::backfill_scope_kind_codes;
/// Safe Backfill Desk options contract combining readiness and campaign metadata.
pub(crate) use self::dto_common::BackfillDeskOptionsDto;
/// Safe logical HTTP route exposed for operator selection.
pub(crate) use self::dto_common::BackfillHttpRouteOptionDto;
/// Safe command error projection exposed to Tauri commands.
pub(crate) use self::dto_common::CommandErrorDto;
/// Safe canonical Program ID entry exposed only for free-form address autocomplete.
pub(crate) use self::dto_common::ProgramIdAutocompleteOptionDto;
/// Safe scaffold/runtime snapshot exposed to the shell.
pub(crate) use self::dto_common::ShellStatusDto;
/// Projects the canonical Core Program ID registry to autocomplete entries.
pub(crate) use self::dto_common::program_id_autocomplete_options;
/// Shared Backfill Desk runtime state is internally inconsistent.
pub(crate) use self::errors::ERROR_CODE_APP_STATE_INVALID;
/// Shared Backfill Desk runtime state cannot be locked safely.
pub(crate) use self::errors::ERROR_CODE_APP_STATE_LOCK_FAILED;
/// Backfill Desk cannot admit a campaign before Transport and Store composition is ready.
pub(crate) use self::errors::ERROR_CODE_BACKFILL_COMPOSITION_NOT_READY;
/// Backfill Desk received a campaign field that cannot map to the Backfill contract.
pub(crate) use self::errors::ERROR_CODE_BACKFILL_REQUEST_INVALID;
/// Backfill Desk has no retained safe checkpoint available for in-session Resume.
pub(crate) use self::errors::ERROR_CODE_BACKFILL_RESUME_UNAVAILABLE;
/// Backfill Desk refuses a concurrent Start while another Backfill run owns the single-run slot.
pub(crate) use self::errors::ERROR_CODE_BACKFILL_RUN_ACTIVE;
/// Backfill Desk rejects stale or mismatched Job identity control requests.
pub(crate) use self::errors::ERROR_CODE_BACKFILL_RUN_MISMATCH;
/// Backfill Desk has no active or retained matching run for the requested control operation.
pub(crate) use self::errors::ERROR_CODE_BACKFILL_RUN_NOT_ACTIVE;
/// Backfill Desk composite configuration is missing or references an unexpected document.
pub(crate) use self::errors::ERROR_CODE_CONFIG_COMPOSITE_INVALID;
/// Frontend logging requested an unsupported level.
pub(crate) use self::errors::ERROR_CODE_FRONTEND_LOG_LEVEL_INVALID;
/// Frontend logging requested a target outside the application whitelist.
pub(crate) use self::errors::ERROR_CODE_FRONTEND_LOG_TARGET_INVALID;
/// Backfill Desk could not install the managed Logging runtime or its safe fallback.
pub(crate) use self::errors::ERROR_CODE_LOGGING_BOOTSTRAP_FAILED;
/// Splash readiness was invoked from a window other than the splash window.
pub(crate) use self::errors::ERROR_CODE_SPLASH_ORIGIN_INVALID;
/// A KSP desk splash environment duration is malformed or exceeds its safety bound.
pub(crate) use self::errors::ERROR_CODE_SPLASH_SETTING_INVALID;
/// Backfill Desk Store and Transport configuration target different logical networks.
pub(crate) use self::errors::ERROR_CODE_STORE_NETWORK_MISMATCH;
/// Backfill Desk cannot prove a single Transport network before Store opening.
pub(crate) use self::errors::ERROR_CODE_STORE_NETWORK_UNAVAILABLE;
/// Backfill Desk cannot complete the bounded Store shutdown lifecycle.
pub(crate) use self::errors::ERROR_CODE_STORE_SHUTDOWN_FAILED;
/// Tauri runtime assembly or execution failed.
pub(crate) use self::errors::ERROR_CODE_TAURI_RUNTIME_FAILED;
/// A required Tauri window is missing from the configured application runtime.
pub(crate) use self::errors::ERROR_CODE_TAURI_WINDOW_MISSING;
/// A Tauri window show/focus/destroy/event operation failed.
pub(crate) use self::errors::ERROR_CODE_TAURI_WINDOW_OPERATION_FAILED;
/// Backfill Desk cannot derive a safe Transport readiness contract.
pub(crate) use self::errors::ERROR_CODE_TRANSPORT_READINESS_INVALID;
/// Log payload sent by Backfill Desk frontend scripts.
pub(crate) use self::frontend_logging::FrontendLogPayloadDto;
/// Emits one validated frontend event through the KSP Logging facade.
pub(crate) use self::frontend_logging::emit_frontend_log_event;
/// Creates the stable runtime identity for this Backfill Desk process launch.
pub(crate) use self::logging_runtime::launch_identity;
/// Command emitted by Rust to the splash frontend.
pub(crate) use self::splash::SplashOrderDto;
/// Runtime timings used by the common desk splash lifecycle.
pub(crate) use self::splash::SplashSettings;
/// Store startup state retained by the application shell.
pub(crate) use self::store_runtime::StoreStartup;
/// Initializes Store only after composite-selected Transport/Store network coherence is proven.
pub(crate) use self::store_runtime::initialize_store;
/// Safe and executable Transport runtime retained by application state.
pub(crate) use self::transport_runtime::TransportRuntime;
/// Initializes the composite-selected HTTP Transport runtime.
pub(crate) use self::transport_runtime::initialize_transport;
/// Resolves the required main window or returns a typed error.
pub(crate) use self::tw_main::require_main_window;
/// Shows and focuses the main Backfill Desk window.
pub(crate) use self::tw_main::show_main_window;
/// Resolves the required splash window or returns a typed error.
pub(crate) use self::tw_splash::require_splash_window;
/// Starts the one-shot splash lifecycle after the splash frontend reports readiness.
pub(crate) use self::tw_splash::splash_frontend_ready_service;