From 123a67732f255925fef417e994d3d857b019ce02 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 5 Oct 2026 07:52:33 +0200 Subject: [PATCH] refactor(M0.3): establish domain crate boundary Add dependency-free fader-core and inward-only fader-config crates, wire existing adapters and clients toward the domain layer, and remove scaffold arithmetic tests. Tests: cargo test -p fader-core -p fader-config --all-targets --locked (passed without device/runtime dependencies) Tests: cargo check --workspace --all-targets --all-features --locked; cargo tree --workspace --locked --edges normal; git diff --check (passed) --- Cargo.lock | 25 +++++++++++++++++++++++++ Cargo.toml | 7 ++++++- config/Cargo.toml | 11 +++++++++++ config/src/lib.rs | 5 +++++ core/Cargo.toml | 10 ++++++++++ core/src/lib.rs | 6 ++++++ fader_master/Cargo.toml | 5 +++++ midi/Cargo.toml | 1 + midi/src/lib.rs | 15 ++------------- sound/Cargo.toml | 1 + sound/src/lib.rs | 15 ++------------- task.md | 2 +- tui/Cargo.toml | 1 + tui/src/lib.rs | 7 ------- 14 files changed, 76 insertions(+), 35 deletions(-) create mode 100644 config/Cargo.toml create mode 100644 config/src/lib.rs create mode 100644 core/Cargo.toml create mode 100644 core/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1278905..8977d6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,9 +140,27 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "fader-config" +version = "0.1.0" +dependencies = [ + "fader-core", +] + +[[package]] +name = "fader-core" +version = "0.1.0" + [[package]] name = "fader_master" version = "0.1.0" +dependencies = [ + "fader-config", + "fader-core", + "midi", + "tui", + "volume_lib", +] [[package]] name = "foldhash" @@ -249,6 +267,9 @@ dependencies = [ [[package]] name = "midi" version = "0.1.0" +dependencies = [ + "fader-core", +] [[package]] name = "mio" @@ -541,6 +562,7 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" name = "tui" version = "0.1.0" dependencies = [ + "fader-core", "ratatui", ] @@ -582,6 +604,9 @@ checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "volume_lib" version = "0.1.0" +dependencies = [ + "fader-core", +] [[package]] name = "wasi" diff --git a/Cargo.toml b/Cargo.toml index 23d63b6..38def33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["fader_master", "midi", "sound", "tui"] +members = ["config", "core", "fader_master", "midi", "sound", "tui"] resolver = "3" [workspace.package] @@ -11,7 +11,12 @@ repository = "https://git.dandaedre.com/MadGobblins/fader_master" publish = false [workspace.dependencies] +fader-config = { path = "config" } +fader-core = { path = "core" } +midi = { path = "midi" } ratatui = { version = "0.29.0", features = ["all-widgets", "serde"] } +tui = { path = "tui" } +volume_lib = { path = "sound" } [profile.dev] debug = true diff --git a/config/Cargo.toml b/config/Cargo.toml new file mode 100644 index 0000000..a379458 --- /dev/null +++ b/config/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "fader-config" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +publish.workspace = true + +[dependencies] +fader-core.workspace = true diff --git a/config/src/lib.rs b/config/src/lib.rs new file mode 100644 index 0000000..abc0828 --- /dev/null +++ b/config/src/lib.rs @@ -0,0 +1,5 @@ +//! TOML schemas, validation, migration, and persistence for fader_master. +//! +//! Configuration depends on domain contracts but never on runtime adapters. + +#![forbid(unsafe_code)] diff --git a/core/Cargo.toml b/core/Cargo.toml new file mode 100644 index 0000000..ad42891 --- /dev/null +++ b/core/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "fader-core" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +publish.workspace = true + +[dependencies] diff --git a/core/src/lib.rs b/core/src/lib.rs new file mode 100644 index 0000000..0e16a67 --- /dev/null +++ b/core/src/lib.rs @@ -0,0 +1,6 @@ +//! Pure domain contracts for fader_master. +//! +//! This crate deliberately has no runtime, terminal, filesystem, MIDI, or +//! native audio dependencies. + +#![forbid(unsafe_code)] diff --git a/fader_master/Cargo.toml b/fader_master/Cargo.toml index 0beace4..fdeef12 100644 --- a/fader_master/Cargo.toml +++ b/fader_master/Cargo.toml @@ -8,3 +8,8 @@ repository.workspace = true publish.workspace = true [dependencies] +fader-config.workspace = true +fader-core.workspace = true +midi.workspace = true +tui.workspace = true +volume_lib.workspace = true diff --git a/midi/Cargo.toml b/midi/Cargo.toml index 4a830c7..4e8ad2c 100644 --- a/midi/Cargo.toml +++ b/midi/Cargo.toml @@ -8,3 +8,4 @@ repository.workspace = true publish.workspace = true [dependencies] +fader-core.workspace = true diff --git a/midi/src/lib.rs b/midi/src/lib.rs index b93cf3f..2d21a0c 100644 --- a/midi/src/lib.rs +++ b/midi/src/lib.rs @@ -1,14 +1,3 @@ -pub fn add(left: u64, right: u64) -> u64 { - left + right -} +//! MIDI transport, device identity, bindings, and feedback adapters. -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} +#![forbid(unsafe_code)] diff --git a/sound/Cargo.toml b/sound/Cargo.toml index d54ac4e..08386ad 100644 --- a/sound/Cargo.toml +++ b/sound/Cargo.toml @@ -8,3 +8,4 @@ repository.workspace = true publish.workspace = true [dependencies] +fader-core.workspace = true diff --git a/sound/src/lib.rs b/sound/src/lib.rs index b93cf3f..a4cfeec 100644 --- a/sound/src/lib.rs +++ b/sound/src/lib.rs @@ -1,14 +1,3 @@ -pub fn add(left: u64, right: u64) -> u64 { - left + right -} +//! Audio adapter workers for fader_master. -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} +#![forbid(unsafe_code)] diff --git a/task.md b/task.md index 4e1c20d..32bbb4f 100644 --- a/task.md +++ b/task.md @@ -21,7 +21,7 @@ Dependencies: planning. - [ ] **M0.2 CI gates:** align Jenkins with AGENTS.md, including doctests, Clippy `-D warnings`, release build and later backend feature matrix. Acceptance: representative formatting/lint/test failures fail the pipeline; default and full-feature builds pass with provisioned dependencies. Repository configuration now runs locked default, no-default-features, and all-features checks/tests plus warning-strict documentation, Clippy, and release gates. Keep this open until a real Jenkins run on the provisioned worker passes. - [x] **M0.2a Coverage badges:** measure locked all-target line coverage with a pinned tool, enforce the documented 20% scaffold floor, and generate/archive the version, test, and coverage badges on every build. Publish atomically only from `main`, with fresh-build markers preventing stale test or coverage values. Acceptance: renderer, coverage lifecycle, finalization, and publication fixture tests pass; the real local measurement is above the floor. Jenkins publication and public retrieval remain deployment checks. -- [ ] **M0.3 Domain boundary:** add `fader-core` and `fader-config`, wire current crates inward, remove placeholder arithmetic tests as real contracts replace them. Acceptance: core tests run without a terminal, sound daemon, native device connection, or Tokio runtime; dependency graph has no cycles. +- [x] **M0.3 Domain boundary:** add `fader-core` and `fader-config`, wire current crates inward, remove placeholder arithmetic tests as real contracts replace them. Acceptance: core tests run without a terminal, sound daemon, native device connection, or Tokio runtime; dependency graph has no cycles. ## M1 — Domain state and virtual objects diff --git a/tui/Cargo.toml b/tui/Cargo.toml index 9b61c45..087302f 100644 --- a/tui/Cargo.toml +++ b/tui/Cargo.toml @@ -8,4 +8,5 @@ repository.workspace = true publish.workspace = true [dependencies] +fader-core.workspace = true ratatui.workspace = true diff --git a/tui/src/lib.rs b/tui/src/lib.rs index a21014d..51dac35 100644 --- a/tui/src/lib.rs +++ b/tui/src/lib.rs @@ -103,10 +103,3 @@ pub struct SingleFader { // application: String, midi_note: Vec, } - -#[cfg(test)] -mod tests { - - #[test] - fn it_works() {} -}