When configuration has multiple sources (env vars, CLI flags, socket overrides) and/or platform-specific test compilation, treat only the effective configuration as authoritative.
Apply this standard:
--session > HERDR_SESSION unless HERDR_SOCKET_PATH overrides socket selection).#[cfg]; if needed, gate at the narrowest helper/function scope.Example (precedence regression shape):
// If no explicit --session is provided and HERDR_SOCKET_PATH is set,
// skip HERDR_SESSION validation because it is not authoritative.
#[test]
fn socket_path_wins_over_invalid_session_env() {
std::env::set_var("HERDR_SOCKET_PATH", "/tmp/herdr.sock");
std::env::set_var("HERDR_SESSION", "bad/name");
// invoke: `herdr workspace list` (or the function that reads config)
// assert: command proceeds (no validation error), and uses /tmp/herdr.sock
}
This prevents confusing failures from overridden settings and keeps tests compiling cleanly across platforms.