From af3b460375f025c39dd5839a4c0b61700826f35e Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sun, 18 Oct 2026 13:01:15 +0200 Subject: [PATCH] feat: show loaded config path in Config Expose the server-owned active profile path through IPC and render it in the Config tab. Keep the displayed path current when switching profiles and document the diagnostic. Tests: cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo test -p tui; cargo test -p fader_master profile_switch_prepares_before_commit_and_invalid_candidate_keeps_old_profile; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo test --workspace --doc --all-features; cargo build --workspace --release --all-features. Full workspace tests reach the pre-existing user-edited arch-pipewire fixture failure: expected surface id apc-mini, got apc-mini-apc-mini-midi-1. --- architecture.md | 2 +- fader_master/src/editor.rs | 9 ++++++++- fader_master/src/ipc.rs | 4 +++- fader_master/src/live.rs | 1 + fader_master/src/local.rs | 12 ++++++++++++ fader_master/src/tui_client.rs | 1 + task.md | 2 ++ tui/examples/doc_screenshots.rs | 1 + tui/src/lib.rs | 8 ++++++++ 9 files changed, 37 insertions(+), 3 deletions(-) diff --git a/architecture.md b/architecture.md index 6ffdd7e..fefba9c 100644 --- a/architecture.md +++ b/architecture.md @@ -578,7 +578,7 @@ reserved relative-mode runtime work is complete. The secondary Config tab is not an alternative object editor. It presents profile theme, mixer orientation and pickup-status selection, a popup listing all hidden faders for individual restoration, unsaved and Save state, active -profile/backend status, MIDI-learn +profile/backend status, the server-resolved loaded configuration path, MIDI-learn cancellation, and MIDI device diagnostics. Object and layout edits stay on the main mixer. Its quick-help footer calls out Left/Right layout switching alongside Save and navigation. There is no separate hidden-fader mode: hidden diff --git a/fader_master/src/editor.rs b/fader_master/src/editor.rs index 171271b..eef757b 100644 --- a/fader_master/src/editor.rs +++ b/fader_master/src/editor.rs @@ -1,4 +1,7 @@ -use std::{fs, io, path::PathBuf}; +use std::{ + fs, io, + path::{Path, PathBuf}, +}; use fader_config::{ AtomicFile, ConfigError, PersistenceError, Profile, ProfileDocument, SelectorDraft, @@ -47,6 +50,10 @@ impl ConfigurationEditor { } } + pub(crate) fn path(&self) -> &Path { + &self.path + } + pub(crate) const fn revision(&self) -> u64 { self.revision } diff --git a/fader_master/src/ipc.rs b/fader_master/src/ipc.rs index 535f8a9..4cd32dc 100644 --- a/fader_master/src/ipc.rs +++ b/fader_master/src/ipc.rs @@ -3,7 +3,7 @@ use std::io::{self, Read, Write}; use serde::{Deserialize, Serialize, de::DeserializeOwned}; use thiserror::Error; -pub const PROTOCOL_VERSION: u16 = 23; +pub const PROTOCOL_VERSION: u16 = 24; pub const MAX_FRAME_BYTES: usize = 64 * 1024; /// Kind of mixer object addressed by a client. @@ -264,6 +264,8 @@ pub struct ConfigurationSnapshot { pub error: Option, pub profile_id: String, #[serde(default)] + pub profile_path: Option, + #[serde(default)] pub available_profiles: Vec, pub mixer_orientation: MixerOrientation, pub status_display: StatusDisplayMode, diff --git a/fader_master/src/live.rs b/fader_master/src/live.rs index f91b2d7..d6a4009 100644 --- a/fader_master/src/live.rs +++ b/fader_master/src/live.rs @@ -117,6 +117,7 @@ pub(crate) fn configuration_snapshot( learning: None, error: None, profile_id: profile.id().to_string(), + profile_path: None, available_profiles: vec![profile.id().to_string()], mixer_orientation: match profile.mixer_orientation() { fader_config::MixerOrientation::Vertical => crate::ipc::MixerOrientation::Vertical, diff --git a/fader_master/src/local.rs b/fader_master/src/local.rs index 4273763..2e0dad9 100644 --- a/fader_master/src/local.rs +++ b/fader_master/src/local.rs @@ -398,6 +398,8 @@ impl LocalServer { self.configuration.dirty(), self.applied_configuration_revision, ); + configuration.profile_path = + Some(self.configuration.path().to_string_lossy().into_owned()); configuration.available_profiles = available_profile_ids(&self.profile_directory, profile.id().as_str()); configuration.learning = Some(format!("{surface} -> {fader} ({action:?})")); @@ -630,6 +632,7 @@ impl LocalServer { self.configuration.dirty(), self.applied_configuration_revision, ); + configuration.profile_path = Some(self.configuration.path().to_string_lossy().into_owned()); configuration.available_profiles = available_profile_ids(&self.profile_directory, profile.id().as_str()); configuration.error = error; @@ -945,6 +948,15 @@ mod tests { panic!("valid candidate should activate"); }; assert_eq!(snapshot.configuration.profile_id, "secondary"); + assert_eq!( + snapshot.configuration.profile_path.as_deref(), + Some( + root.path() + .join("secondary.toml") + .to_string_lossy() + .as_ref() + ) + ); assert_eq!(snapshot.objects[0].label, "Listening"); assert!(snapshot.revision > old_revision); let active = fader_config::ActiveConfig::parse( diff --git a/fader_master/src/tui_client.rs b/fader_master/src/tui_client.rs index b0cd28f..869155a 100644 --- a/fader_master/src/tui_client.rs +++ b/fader_master/src/tui_client.rs @@ -109,6 +109,7 @@ impl IpcMixerClient { learning: snapshot.configuration.learning, error: snapshot.configuration.error, profile_id: snapshot.configuration.profile_id, + profile_path: snapshot.configuration.profile_path, available_profiles: snapshot.configuration.available_profiles, mixer_orientation: match snapshot.configuration.mixer_orientation { crate::ipc::MixerOrientation::Vertical => tui::MixerOrientation::Vertical, diff --git a/task.md b/task.md index 3cde7fb..70853cf 100644 --- a/task.md +++ b/task.md @@ -378,6 +378,8 @@ Dependencies: M8, M2, M1. The server now owns the validated draft and its independent revision; stale or invalid edit requests are rejected without advancing or altering it, and accepted edits are exposed as an unsaved draft in the Config tab. + The Config tab also reports the server-resolved path of the loaded profile so + configuration failures can be traced to the file that needs inspection. - [x] **M9.2 Surface bindings / MIDI learn:** select surface, listen for one supported control, preview conflicts and save binding. Tests: learning suppresses the normal action, other surfaces are not captured accidentally, cancellation restores routing, duplicate binding is rejected. The Config tab starts surface/fader/action-scoped learning with `L` and cancels with `C`. Captured CC/note identity is added to the validated server diff --git a/tui/examples/doc_screenshots.rs b/tui/examples/doc_screenshots.rs index 03a90c9..5b93538 100644 --- a/tui/examples/doc_screenshots.rs +++ b/tui/examples/doc_screenshots.rs @@ -144,6 +144,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot { learning: None, error: None, profile_id: "desktop".to_owned(), + profile_path: Some("/home/alex/.config/fader_master/profiles/desktop.toml".to_owned()), available_profiles: vec!["desktop".to_owned()], mixer_orientation, status_display: tui::StatusDisplayMode::Symbol, diff --git a/tui/src/lib.rs b/tui/src/lib.rs index b21dc31..f4d424b 100644 --- a/tui/src/lib.rs +++ b/tui/src/lib.rs @@ -99,6 +99,7 @@ pub struct ConfigurationSnapshot { pub learning: Option, pub error: Option, pub profile_id: String, + pub profile_path: Option, pub available_profiles: Vec, pub mixer_orientation: MixerOrientation, pub status_display: StatusDisplayMode, @@ -4590,6 +4591,9 @@ impl LiveTui { )) .bold(), ]; + if let Some(path) = &config.profile_path { + lines.push(Line::from(format!("Config file: {path}"))); + } lines.push(Line::from(format!( "Backend: {} · {} · mixer revision {}", self.snapshot.backend, self.snapshot.status, self.snapshot.revision @@ -7052,6 +7056,7 @@ mod tests { learning: None, error: None, profile_id: "desktop".into(), + profile_path: Some("/home/test/.config/fader_master/profiles/desktop.toml".into()), available_profiles: vec!["desktop".into(), "streaming".into()], mixer_orientation: MixerOrientation::Vertical, status_display: StatusDisplayMode::Detailed, @@ -7122,6 +7127,9 @@ mod tests { .collect::(); assert!(rendered.contains("Profile: desktop")); + assert!( + rendered.contains("Config file: /home/test/.config/fader_master/profiles/desktop.toml") + ); assert!(rendered.contains("unsaved draft")); assert!(rendered.contains("Theme Default")); assert!(rendered.contains("Pickup status Detailed"));