fix(qt): type local/plex playlist rows by provenance, not as qobuz
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
This commit is contained in:
1 file changed
+23
-2
@@ -525,6 +525,23 @@ pub(crate) fn row_to_queue_public(row: &PlaylistTrackRow) -> QueueTrack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn row_to_queue(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 {
|
QueueTrack {
|
||||||
id: row.id.parse().unwrap_or(0),
|
id: row.id.parse().unwrap_or(0),
|
||||||
title: row.title.clone(),
|
title: row.title.clone(),
|
||||||
@@ -546,7 +563,7 @@ fn row_to_queue(row: &PlaylistTrackRow) -> QueueTrack {
|
|||||||
hires: row.quality_tier == "hires",
|
hires: row.quality_tier == "hires",
|
||||||
bit_depth: row.bit_depth,
|
bit_depth: row.bit_depth,
|
||||||
sample_rate: row.sample_rate,
|
sample_rate: row.sample_rate,
|
||||||
is_local: false,
|
is_local: provenance == "local",
|
||||||
album_id: if row.album_id.is_empty() {
|
album_id: if row.album_id.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
@@ -554,7 +571,11 @@ fn row_to_queue(row: &PlaylistTrackRow) -> QueueTrack {
|
|||||||
},
|
},
|
||||||
artist_id: row.artist_id.parse::<u64>().ok(),
|
artist_id: row.artist_id.parse::<u64>().ok(),
|
||||||
streamable: true,
|
streamable: true,
|
||||||
source: Some("qobuz".to_string()),
|
source: Some(if is_local_row {
|
||||||
|
provenance.to_string()
|
||||||
|
} else {
|
||||||
|
"qobuz".to_string()
|
||||||
|
}),
|
||||||
parental_warning: row.explicit,
|
parental_warning: row.explicit,
|
||||||
source_item_id_hint: None,
|
source_item_id_hint: None,
|
||||||
// A ROW does not know which playlist it belongs to. Stamping a kind
|
// A ROW does not know which playlist it belongs to. Stamping a kind
|
||||||
|
|||||||
Reference in new issue
Block a user