Keep a rollback to 0.12 safe for sync and the typed queue
Release 0.12 fails a whole sync batch on a podcast operation kind, so rolling back is only safe after the relayed podcast operations are removed: document the step in docs/administration.md and run it in the m_0055 backwards operation. The typed queue now records the current track id and queue position written with it, next to the legacy ids. A 0.12 release that only moved to another track in the same queue no longer leaves a stale typed position that the next upgrade would restore. Jam placeholders are never stored in a user's own typed queue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f3ed4b7ee
commit
3af0e8ccc9
6 files changed
+219
-48
No files matched your search
+20
-4
@@ -1704,7 +1704,12 @@ mod queue_persistence_tests {
|
||||
let stored = stored_queue_from_request(&dto).unwrap();
|
||||
// Written to queue_items_json and read back with the legacy ids.
|
||||
let column = serde_json::to_value(&stored).unwrap();
|
||||
let loaded = queue_items::StoredQueue::from_columns(Some(&column), &[3, 4]).unwrap();
|
||||
let row = queue_items::LegacyColumns {
|
||||
queue: dto.queue.clone(),
|
||||
current_track_id: dto.current_track_id,
|
||||
queue_position: dto.queue_position,
|
||||
};
|
||||
let loaded = queue_items::StoredQueue::from_columns(Some(&column), &row).unwrap();
|
||||
assert_eq!(loaded, stored);
|
||||
assert_eq!(loaded.position, 1);
|
||||
let items = browser_queue_items(&offline_pool(), &loaded).await.unwrap();
|
||||
@@ -6745,8 +6750,15 @@ async fn get_state_handler(
|
||||
let dto = match state {
|
||||
Some(s) => {
|
||||
let queue: Vec<i64> = serde_json::from_str(&s.queue_json).unwrap_or_default();
|
||||
// Prefer the typed queue while it matches `queue_json`.
|
||||
let typed = queue_items::StoredQueue::from_columns(s.queue_items_json.as_ref(), &queue);
|
||||
// Prefer the typed queue while it matches the legacy columns.
|
||||
let typed = queue_items::StoredQueue::from_columns(
|
||||
s.queue_items_json.as_ref(),
|
||||
&queue_items::LegacyColumns {
|
||||
queue: queue.clone(),
|
||||
current_track_id: s.current_track_id,
|
||||
queue_position: s.queue_position,
|
||||
},
|
||||
);
|
||||
let (queue_items, queue_items_position) = match typed {
|
||||
Some(stored) => (
|
||||
Some(
|
||||
@@ -6815,7 +6827,11 @@ fn stored_queue_from_request(dto: &PlaybackStateDto) -> Option<queue_items::Stor
|
||||
queue_items::StoredQueue::new(
|
||||
items,
|
||||
dto.queue_items_position.unwrap_or(0),
|
||||
dto.queue.clone(),
|
||||
queue_items::LegacyColumns {
|
||||
queue: dto.queue.clone(),
|
||||
current_track_id: dto.current_track_id,
|
||||
queue_position: dto.queue_position,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user