fix: address 7 code review findings for V2 architecture

HIGH priority fixes:
- Enable WAL mode in qbz-integrations caches (ADR-002)
- v2_auto_login/v2_manual_login now call activate_session()
- RequiresUserSession allows offline sessions (only checks session_activated)

MEDIUM priority fixes:
- Consolidate lifecycle: legacy commands delegate to session_lifecycle
- ListenBrainz teardown now calls disconnect() to clear tokens
- Add SessionActivationFailed degraded reason and emit event on failure
This commit is contained in:
vicrodh committed 2026-02-15 12:21:17 -06:00
1 parent d6e4b3349b
commit 59e3141aa6
6 files changed
+46 -220

No files matched your search

@@ -21,6 +21,10 @@ impl ListenBrainzCache {
let conn = Connection::open(db_path)
.map_err(|e| format!("Failed to open ListenBrainz cache: {}", e))?;
// Enable WAL mode for concurrent read/write (ADR-002)
conn.execute_batch("PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;")
.map_err(|e| format!("Failed to enable WAL mode: {}", e))?;
let cache = Self { conn };
cache.init_schema()?;
@@ -31,6 +31,10 @@ impl MusicBrainzCache {
let conn = Connection::open(db_path)
.map_err(|e| format!("Failed to open MusicBrainz cache: {}", e))?;
// Enable WAL mode for concurrent read/write (ADR-002)
conn.execute_batch("PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;")
.map_err(|e| format!("Failed to enable WAL mode: {}", e))?;
let cache = Self { conn };
cache.init_schema()?;