From a57ff8c271efec4a6fbdb80d002d0c5909d01904 Mon Sep 17 00:00:00 2001 From: KeyffMS <124252104+KeyffMS@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:45:48 +0200 Subject: [PATCH 1/4] refactor: split application runtime boundary (R2h) --- crates/lantern-app/src/application/runtime.rs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 crates/lantern-app/src/application/runtime.rs diff --git a/crates/lantern-app/src/application/runtime.rs b/crates/lantern-app/src/application/runtime.rs new file mode 100644 index 00000000..2796041b --- /dev/null +++ b/crates/lantern-app/src/application/runtime.rs @@ -0,0 +1,35 @@ +use thiserror::Error; + +use super::{ApplicationAction, ApplicationEffect, ApplicationState}; + +#[derive(Debug, Error)] +#[error("application effect failed: {0}")] +pub struct ApplicationEffectError(pub String); + +pub trait EffectRunner { + fn execute(&mut self, effect: ApplicationEffect) -> Result<(), ApplicationEffectError>; +} + +pub struct ApplicationRuntime { + state: ApplicationState, + runner: R, +} + +impl ApplicationRuntime { + #[must_use] + pub fn new(state: ApplicationState, runner: R) -> Self { + Self { state, runner } + } + + pub fn dispatch(&mut self, action: ApplicationAction) -> Result<(), ApplicationEffectError> { + for effect in self.state.reduce(action) { + self.runner.execute(effect)?; + } + Ok(()) + } + + #[must_use] + pub const fn state(&self) -> &ApplicationState { + &self.state + } +} From be1fb03290fbea5bcfca990b1f1d716370955a86 Mon Sep 17 00:00:00 2001 From: KeyffMS <124252104+KeyffMS@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:46:53 +0200 Subject: [PATCH 2/4] refactor: split application runtime boundary (R2h) --- crates/lantern-app/src/application.rs | 35 ++------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/crates/lantern-app/src/application.rs b/crates/lantern-app/src/application.rs index 96326194..2c389700 100644 --- a/crates/lantern-app/src/application.rs +++ b/crates/lantern-app/src/application.rs @@ -2,7 +2,6 @@ use std::{path::PathBuf, sync::Arc}; use lantern_domain::{DriveState, ProfileId, SessionId, SlaveId}; use lantern_profile::ValidatedDeviceProfile; -use thiserror::Error; use crate::{ AuditHealth, Authorization, BackupCaptureRequest, BackupRestoreAction, BackupRestoreEffect, @@ -18,11 +17,13 @@ use crate::{ mod connection; mod faults; mod monitoring; +mod runtime; mod state; mod view; use state::{ApplicationMonitoringState, ApplicationParameterState}; use view::port_label; +pub use runtime::{ApplicationEffectError, ApplicationRuntime, EffectRunner}; pub use view::{ ApplicationView, AuditHealthView, AuthorizationView, OperationView, SessionPhaseView, SessionView, @@ -625,38 +626,6 @@ pub enum ApplicationEffect { Session(SessionEffect), } -#[derive(Debug, Error)] -#[error("application effect failed: {0}")] -pub struct ApplicationEffectError(pub String); - -pub trait EffectRunner { - fn execute(&mut self, effect: ApplicationEffect) -> Result<(), ApplicationEffectError>; -} - -pub struct ApplicationRuntime { - state: ApplicationState, - runner: R, -} - -impl ApplicationRuntime { - #[must_use] - pub fn new(state: ApplicationState, runner: R) -> Self { - Self { state, runner } - } - - pub fn dispatch(&mut self, action: ApplicationAction) -> Result<(), ApplicationEffectError> { - for effect in self.state.reduce(action) { - self.runner.execute(effect)?; - } - Ok(()) - } - - #[must_use] - pub const fn state(&self) -> &ApplicationState { - &self.state - } -} - #[cfg(test)] mod tests { use std::{path::PathBuf, sync::Arc}; From 00cb06c16000c76fee44788e6bb1ddfe91a78a95 Mon Sep 17 00:00:00 2001 From: KeyffMS <124252104+KeyffMS@users.noreply.github.com> Date: Fri, 18 Sep 2026 15:36:12 +0200 Subject: [PATCH 3/4] style: rustfmt application runtime split --- crates/lantern-app/src/application.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/lantern-app/src/application.rs b/crates/lantern-app/src/application.rs index 2c389700..9f3c178c 100644 --- a/crates/lantern-app/src/application.rs +++ b/crates/lantern-app/src/application.rs @@ -22,8 +22,8 @@ mod state; mod view; use state::{ApplicationMonitoringState, ApplicationParameterState}; -use view::port_label; pub use runtime::{ApplicationEffectError, ApplicationRuntime, EffectRunner}; +use view::port_label; pub use view::{ ApplicationView, AuditHealthView, AuthorizationView, OperationView, SessionPhaseView, SessionView, From 75c9b9fe3d70b57d2e98f59be83c965b7a164063 Mon Sep 17 00:00:00 2001 From: KeyffMS <124252104+KeyffMS@users.noreply.github.com> Date: Sat, 19 Sep 2026 06:01:43 +0200 Subject: [PATCH 4/4] style: match pinned rustfmt ordering --- crates/lantern-app/src/application.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/lantern-app/src/application.rs b/crates/lantern-app/src/application.rs index 9f3c178c..b498b844 100644 --- a/crates/lantern-app/src/application.rs +++ b/crates/lantern-app/src/application.rs @@ -21,8 +21,8 @@ mod runtime; mod state; mod view; -use state::{ApplicationMonitoringState, ApplicationParameterState}; pub use runtime::{ApplicationEffectError, ApplicationRuntime, EffectRunner}; +use state::{ApplicationMonitoringState, ApplicationParameterState}; use view::port_label; pub use view::{ ApplicationView, AuditHealthView, AuthorizationView, OperationView, SessionPhaseView,