From 7c9e4f18789db9557282bf347e2a6bd90fb564cb Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 1 Aug 2026 22:20:51 -0600 Subject: [PATCH] fix(qt): type local/plex playlist rows by provenance, not as qobuz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit row_to_queue hardcoded source "qobuz" for every row, so a local/Plex row in a local playlist's detail — adopted into the shared page with its library rowid (or 2^40 synthetic Plex id) — was re-typed as a catalog track and passed every Qobuz Connect admission guard (id > 0 && source != local/plex). A row ⋯-menu enqueue with a peer active pushed the rowid to the WebSocket as a Qobuz catalog id and the peer renderer played an UNRELATED track; with no peer the bogus id was synced and resolved to the wrong track locally. That is the track-source-admission P0 class from the QConnect hardening review. Make row_to_queue provenance-aware (the row already carries row.source). Typed correctly, the existing guards do their job: peer active -> refusal toast, added nowhere (Slint parity); no peer -> lands local, correctly typed, sync-on-add skips it. Unavailable rows (raw path / kind:ref ids) parse to 0 and fail the id > 0 guard, so they can never reach the WS either. One choke point, which also closes the latent mistype for the day the online-playlist sidecar merge is ported (PARITY-DEBT #103). Verified: build + 204/204 tests. Owner smoke: local row enqueue with QConnect on a peer toasts "Track not castable to Qobuz Connect" and adds nothing. km --- crates/qbz-qt/src/playlist_qt.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/qbz-qt/src/playlist_qt.rs b/crates/qbz-qt/src/playlist_qt.rs index 184730a0f..ff40f6fe7 100644 --- a/crates/qbz-qt/src/playlist_qt.rs +++ b/crates/qbz-qt/src/playlist_qt.rs @@ -525,6 +525,23 @@ pub(crate) fn row_to_queue_public(row: &PlaylistTrackRow) -> QueueTrack { } fn row_to_queue(row: &PlaylistTrackRow) -> QueueTrack { + // PROVENANCE IS LOAD-BEARING (wrong-track hazard, the QConnect + // track-source-admission P0 family). A LOCAL playlist's detail adopts + // its rows into this shared page via `local_playlist_qt::adopt_doc`, and + // its local/Plex rows carry `row.source` + the LIBRARY rowid (or a 2^40 + // synthetic Plex id) in `row.id` — NOT a catalog id. Hardcoding + // `source: "qobuz"` here passed every QConnect admission guard + // (`id > 0 && source != local/plex`) and pushed the rowid to the + // WebSocket as a Qobuz catalog id: the peer renderer played an + // UNRELATED track (reference guards this at main.rs:11906-11932, "the + // catalog path below would mis-resolve them"). Typed correctly, the + // existing guards do their job: with a peer active the add is refused + // with the castable toast and lands nowhere; with no peer it lands + // locally, correctly typed, and the sync-on-add predicate skips it. + // Unavailable rows (a raw path or `kind:ref` id) parse to 0 and fail + // the `id > 0` guard — they can never reach the WS either. + let provenance = row.source.as_str(); + let is_local_row = matches!(provenance, "local" | "plex"); QueueTrack { id: row.id.parse().unwrap_or(0), title: row.title.clone(), @@ -546,7 +563,7 @@ fn row_to_queue(row: &PlaylistTrackRow) -> QueueTrack { hires: row.quality_tier == "hires", bit_depth: row.bit_depth, sample_rate: row.sample_rate, - is_local: false, + is_local: provenance == "local", album_id: if row.album_id.is_empty() { None } else { @@ -554,7 +571,11 @@ fn row_to_queue(row: &PlaylistTrackRow) -> QueueTrack { }, artist_id: row.artist_id.parse::().ok(), streamable: true, - source: Some("qobuz".to_string()), + source: Some(if is_local_row { + provenance.to_string() + } else { + "qobuz".to_string() + }), parental_warning: row.explicit, source_item_id_hint: None, // A ROW does not know which playlist it belongs to. Stamping a kind