Summary
LifecycleError::LaunchDaemon and LifecycleError::StartupFailed in crates/weaver-cli/src/lifecycle/error.rs carry a runtime_dir: PathBuf field whose sole purpose is to let crates/weaver-cli/src/actionable_guidance.rs derive the weaverd.health path for CLI guidance output.
This violates the domain/adapter boundary: the lifecycle domain error type is carrying CLI adapter context. The runtime directory is already available in the CLI layer (via RuntimePaths) at the call sites that call spawn_daemon, poll_spawned_child, and try_auto_start_daemon; it does not need to travel through the error value to reach write_startup_guidance.
Required refactoring
- Remove
runtime_dir: PathBuf from LifecycleError::LaunchDaemon and LifecycleError::StartupFailed.
- Update
spawn_daemon and poll_spawned_child to drop the runtime_dir argument they accepted solely to set this field.
- Pass
runtime_dir separately through the CLI adapter layer (e.g., as an additional argument to write_startup_guidance, or by making the caller derive health_path before calling guidance functions) rather than extracting it from the error.
- Update
crates/weaver-cli/src/actionable_guidance.rs, crates/weaver-cli/src/lifecycle/utils.rs, and crates/weaver-cli/src/lifecycle/spawning.rs accordingly.
- Update unit tests in
crates/weaver-cli/src/tests/unit/actionable_guidance.rs.
Context
Identified during review of PR #128 (Define local daemon observability). The runtime_dir field was threaded through error variants in that PR to improve actionable guidance output; this issue tracks the follow-up architectural cleanup.
Raised by @leynos.
Summary
LifecycleError::LaunchDaemonandLifecycleError::StartupFailedincrates/weaver-cli/src/lifecycle/error.rscarry aruntime_dir: PathBuffield whose sole purpose is to letcrates/weaver-cli/src/actionable_guidance.rsderive theweaverd.healthpath for CLI guidance output.This violates the domain/adapter boundary: the lifecycle domain error type is carrying CLI adapter context. The runtime directory is already available in the CLI layer (via
RuntimePaths) at the call sites that callspawn_daemon,poll_spawned_child, andtry_auto_start_daemon; it does not need to travel through the error value to reachwrite_startup_guidance.Required refactoring
runtime_dir: PathBuffromLifecycleError::LaunchDaemonandLifecycleError::StartupFailed.spawn_daemonandpoll_spawned_childto drop theruntime_dirargument they accepted solely to set this field.runtime_dirseparately through the CLI adapter layer (e.g., as an additional argument towrite_startup_guidance, or by making the caller derivehealth_pathbefore calling guidance functions) rather than extracting it from the error.crates/weaver-cli/src/actionable_guidance.rs,crates/weaver-cli/src/lifecycle/utils.rs, andcrates/weaver-cli/src/lifecycle/spawning.rsaccordingly.crates/weaver-cli/src/tests/unit/actionable_guidance.rs.Context
Identified during review of PR #128 (Define local daemon observability). The
runtime_dirfield was threaded through error variants in that PR to improve actionable guidance output; this issue tracks the follow-up architectural cleanup.Raised by @leynos.