test: persistence e2e and registration-relogin e2e; lint clean

Adds a lib target (soulseek_rs_tui) exposing cli/models/persist so
integration tests can drive the persistence pipeline: state and config
survive a simulated restart through the real files, with the incomplete
download flagged for auto-resume. The lib e2e suite gains a
register-then-relogin test against soulfind proving the stored-credential
flow's server assumptions. cargo clippy --all-targets and cargo fmt are
clean.
This commit is contained in:
michel
2026-07-20 20:20:54 +02:00
parent c945bd5d5e
commit 36819d4c42
14 changed files with 203 additions and 66 deletions
+8 -6
View File
@@ -5,7 +5,7 @@ use std::path::Path;
/// Optional settings read from `config.toml`. Every field is optional so a
/// partial file (or none at all) is valid; unknown keys are ignored so newer
/// configs still load in older builds.
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default)]
pub struct FileConfig {
pub username: Option<String>,
@@ -54,7 +54,7 @@ impl FileConfig {
/// Fully-resolved settings after layering CLI (which already includes env via
/// clap) over the config file over built-in defaults.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Resolved {
pub username: Option<String>,
pub server: String,
@@ -73,10 +73,12 @@ pub const DEFAULT_DOWNLOAD_DIR: &str = "~/Downloads";
pub const DEFAULT_MAX_CONCURRENT_DOWNLOADS: usize = 5;
pub const DEFAULT_SEARCH_TIMEOUT: u64 = 10;
/// Layer CLI/env values over the config file over defaults. The
/// `--disable-listener` flag can only enable the disable (a bare flag has no
/// "explicitly off" form), so file `disable_listener = true` wins unless the
/// flag is passed.
/// Layer CLI/env values over the config file over defaults.
///
/// The `--disable-listener` flag can only enable the disable (a bare flag
/// has no "explicitly off" form), so file `disable_listener = true` wins
/// unless the flag is passed.
#[must_use]
pub fn resolve(cli: &crate::cli::Cli, file: &FileConfig) -> Resolved {
Resolved {
username: cli.username.clone().or_else(|| file.username.clone()),