refactor(server): plumb Arc<Settings> through workers and routes

Config sheds its 14 Bucket-B fields (retention, whisper, ollama, llm) and
gains a sibling Arc<Settings> in AppState, loaded from settings.toml at
startup via Settings::load_or_default. Workers (transcribe, analyze,
recovery, auto_trigger) and routes (health, bulk, case_actions,
user_web) take settings as a separate parameter or State<> extractor;
Config::llm_configured moves to Settings::llm_configured.

TestConfig::build_pair() returns (Arc<Config>, Arc<Settings>); the new
create_router_with_settings / create_router_and_session_store_with_settings
helpers wire both into integration tests that exercise LLM/Whisper/Ollama.
The legacy single-Arc create_router falls back to Settings::default()
so the 17 non-LLM tests stay untouched.

Verified: cargo build clean, clippy --all-targets clean, 318 tests pass.
This commit is contained in:
2026-04-27 11:48:41 +02:00
parent 6bbbf10f77
commit a510c20e75
21 changed files with 310 additions and 248 deletions
+10 -3
View File
@@ -55,10 +55,10 @@ async fn silent_only_case_settles_to_empty_without_llm_call() {
.mount(&mock)
.await;
let config = TestConfig::new()
let (_config, settings) = TestConfig::new()
.with_data_path(data.path().to_path_buf())
.with_ollama(mock.uri())
.build();
.build_pair();
let vocab = Arc::new(Gazetteer::empty());
let events_tx = events::channel();
@@ -77,7 +77,14 @@ async fn silent_only_case_settles_to_empty_without_llm_call() {
};
pipeline
.heal_orphans_if_idle(&user_root, slug, &http_client, &config, &vocab, &events_tx)
.heal_orphans_if_idle(
&user_root,
slug,
&http_client,
&settings,
&vocab,
&events_tx,
)
.await;
// Heal spawn drops the busy flag on completion — poll until idle.