Repository navigation
fix(queue): drop the suspended context when a handoff ends the queue (#708) - #718
Conversation
…argeModGames#708) A handoff during a queued Spotify track dropped the queue slot but kept the suspended context. With no Spotify slot and a context still suspended, the stray-play guard read every later librespot Playing event as "between two queue items" and paused it, so playback handed back to spotatui stayed paused. The handoff now ends the queue episode: the suspended context goes with the slot, as agreed in LargeModGames#708. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe handoff teardown now clears suspended Spotify context and restores desired playback when it removes a Spotify queue slot. The ChangesStreaming handoff
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Clearing stale queue context is intended to prevent handed-back playback from being re-paused. No concrete merge-blocking issue is evident, though a live Spotify Connect handoff was not exercised. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5ef63e4 to
d9f87dd
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
#722) # Summary Part of #716: the start itself. `snapshot_tracks` (`infra/queue/mod.rs`) dropped every URI it could not find in the track table or the search results. An MCP or AI DJ `play_now` usually sends a URI that is in neither, so `start_qobuz_queue`, `start_youtube_queue` and `start_subsonic_queue` got an empty list, flashed "No … tracks to play", and played nothing while the tool reported "Sent … to the player". A dropped URI also shifted `start_idx` off the track the caller asked for whenever only some of a list was off screen. An unknown URI now gets a placeholder `TrackInfo` named after the URI, the same shape the native queue (`tracks_for_uris` in `network/dj.rs`) and the radio router (`snapshot_station`) already use for opaque items. The start goes ahead, and a URI the source cannot fetch fails through the source's own error path as before. YouTube reads `duration_ms == 0` as a livestream, and a placeholder's 0 only means the duration is unknown. So `start_youtube_queue` and `play_index` now refuse only a known row with no duration, and a placeholder (`is_placeholder`) downloads like any other video. Left for a follow-up, as said in #716: - The real title. Until the source resolves it, the playbar shows the URI. Qobuz has the catalogue call for it; Subsonic and YouTube each need their own. - `play_now` reporting a start that later fails, instead of "Sent … to the player". # Testing rustc / clippy 1.99.0, macOS (aarch64): - `cargo fmt --all --check`: clean. - `cargo clippy --locked <leg> -- -D warnings`: clean for `default`, `slim`, `headless`, `headless-streaming`, `mcp-only`, `ai-dj-only`, `gui`, `telemetry,tui,subsonic`, and the `macos` job's feature set. - `cargo test --locked`: `default` 1853 passed, `slim` 1447 passed, the `macos` feature set 2453 passed, 22 ignored; after rebasing onto #718, `telemetry,tui,local-files,subsonic,internet-radio,youtube,qobuz,mcp-server,ai-dj` 1976 passed, 22 ignored. One earlier `macos`-set run failed `a_stalled_response_gives_up_at_the_deadline_as_a_transient_error` (its 3 s bound) while another build was compiling; it passed alone three times and in the full rerun. - New router test `an_off_screen_youtube_start_is_not_refused_as_a_livestream` (yt-dlp pointed at a missing path, so it stops right after); it fails with the live-stream error without the fix. `livestream_rows_are_refused_without_session` still passes, and `a_placeholder_is_told_apart_from_a_known_row_with_no_duration` covers the predicate. - After the YouTube fix: fmt and clippy clean on the same legs plus `telemetry,tui,youtube`; `default` 1854, `slim` 1447, `macos` set 2455 passed. - `snapshot_drops_unknown_uris` becomes `snapshot_keeps_an_off_screen_uri_as_a_placeholder_named_after_it`; new `snapshot_keeps_positions_aligned_when_one_uri_is_off_screen`. Not run here: the Linux `all-sources` leg, and a live `play_now` against Qobuz, YouTube or Subsonic. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Queues now retain requested tracks even when they aren’t found in the library or search results, preserving their position with a placeholder entry. * Unknown-duration YouTube tracks are no longer automatically treated as livestreams, allowing playback to proceed to the normal audio or download steps. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: 2570165831 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
# Summary Version bump and changelog for v0.44.0. No application code changes. - `Cargo.toml` and `Cargo.lock` go to 0.44.0, and `SECURITY.md` names 0.44 as the supported version. - `CHANGELOG.md`: `## [Unreleased]` is now `## [v0.44.0] 2026-10-12`. I checked every PR merged since v0.43.0 against it and added 24 entries that were missing, for #524, #569, #570, #574, #593, #618, #623, #624, #651, #652, #656, #675, #684, #700, #701, #706, #707, #709, #718, #719, #722, #730, #741 and #742. - Five older entries blamed the Web API, Development Mode or the token refresh, which #752 removed. They now describe what a v0.44 user sees. The #752 entry also says that related artists are empty for now. - The agent plugin goes to 0.2.0 (both manifests and the marketplace entry), because its skill now lists the ten new MCP tools. - README and `docs/roadmap.md`: rspotify is only models and ids now, `--debug` logs every Spotify request, recommendations work again, and related artists come back empty. - The `spotatui.wiki` submodule moves to the commit that replaces the client-id setup with the pairing login. # Testing - `cargo update -p spotatui --offline`, then `cargo metadata --locked`: ok - `cargo check --locked`: ok (`Checking spotatui v0.44.0`) # Additional notes This is the first release without a client id. Every Spotify user logs in once more with the pairing code, and Spotify in spotatui needs Premium. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Search and sort playlists using loaded tracks, play playlists randomly, and browse artist albums across pages. * Spotify sessions now support HTTP proxies; listening parties stay connected with keep-alives. * **Improvements** * Playback handoffs, polling, and slow Spotify operations have been adjusted for smoother playback. * Skipped downloads can be canceled, and AI DJ/MCP playback can continue when off-screen. * **Bug Fixes** * Fixed issues with theme color startup, key handling, focus navigation, cursor placement, playlist sorting, and Qobuz retries. * **Documentation** * Updated installation, keybinding, and Spotify guidance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Fixes #708.
A handoff during a queued Spotify track left playback on spotatui paused once it was handed back.
disconnect_streaming_playerdropped the Spotify queue slot but keptqueue_suspended. With no Spotify slot and a context still suspended, the stray-play guard inhandle_player_eventstreats every librespotPlayingevent as the gap between two queue items and pauses it, so the transferred track loads paused and Space only plays it for a moment.As agreed in #708 (option 1), the handoff now ends the queue episode:
App::forget_queue_slot_after_handoff(core/app/queue.rs) is the slot teardown fromdisconnect_streaming_player, and now also clearsqueue_suspendedand resetsqueue_slot_desired_playing.App::librespot_playing_is_strayis the guard's predicate, moved unchanged out ofevents.rsso it can be tested.playback_handed_back_after_a_handoff_mid_queue_is_not_re_paused;test_attribute_total2542 → 2543.Testing
rustc / clippy 1.99.0, macOS (aarch64):
cargo fmt --all --check: clean.cargo clippy --locked <leg> -- -D warnings: clean fordefault,slim,headless,headless-streaming,mcp-only,ai-dj-only,gui, and themacosjob's feature set.cargo test --locked:default1854 passed (on currentmain); earlier, before rebasing onto fix(network): move slow Spotify work off the pump #717,slim1440 passed and themacosfeature set 2441 passed, 22 ignored.queue_suspended = Noneline removed, the new test fails ("the transferred track would be re-paused on every Playing event"); with it, it passes.Not run here: the Linux
all-sourcesleg (PipeWire), and a real phone handoff.Additional notes
Only the Spotify-slot case is touched. A handoff while a decoded queue item owns the sink keeps today's behaviour.
💬 Questions or want to chat with other contributors? Join the spotatui Discord.
🤖 Generated with Claude Code
Summary by CodeRabbit