You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(soloist): keep remote playback running on quit - #1004
Closes#994. With the Soloist engine, quitting spotatui after playback had moved to another device (a phone) paused the music there.
stop in src/infra/soloist/supervisor.rs sent Pause (when the status said playing) and Deactivate on every quit. After a handoff Soloist's status follows the device that plays, and its transport commands reach that device, so the quit paused the phone.
The commands now come from shutdown_commands(is_active, status): none while Soloist's device is not the active one; Pause + Deactivate or just Deactivate while it is, as before.
The librespot engine was already right: its Pause is ignored while its device is inactive. Closing the terminal skipped stop, which is why it did not happen there.
Testing
cargo fmt --all --check: clean
cargo clippy --locked -- -D warnings, and with telemetry,tui and telemetry,tui,soloist: clean
cargo test with the gui leg's features -- typescript_bindings_are_written: passed, no binding changes
New tests: shutdown_leaves_playback_on_another_device_untouched, shutdown_pauses_active_soloist_before_deactivating_it, shutdown_deactivates_paused_or_idle_soloist_without_pausing_it. The first one fails against the old command list.
Additional notes
Not tested with a real phone handoff; the fix reads Soloist's own is_active flag, which its playback_state, auth_state and device events keep current.
💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit
Bug Fixes
Quitting while Spotify playback is handed off to another device no longer interrupts playback; quitting during local playback continues to pause and release it.
Free Qobuz accounts now receive a clear message that a paid subscription is required, instead of a parse error.
Playback controls now update their state immediately when used through supported media controls.
Spotify connections allow more time to complete, and network or DNS timeouts now show a more specific message.
Reviewing files that changed from the base of the PR and between 160c626 and 98b8db8.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Soloist shutdown now selects commands based on whether the device is active and its playback status. Tests cover inactive devices and active devices in Playing, Buffering, Idle, and Paused states.
Changes: Soloist shutdown
Layer / File(s)
Summary
Select shutdown commands by activity and status src/infra/soloist/supervisor.rs, CHANGELOG.md
Shutdown sends no commands when Soloist is inactive. When active, it pauses before deactivation if status is Playing or Buffering, and only deactivates for other statuses. Tests cover these cases. The changelog records the playback handoff behavior.
LargeModGames/spotatui#935: Adds the Soloist playback engine and its supervisor shutdown path, which this change modifies.
Merge Risk: Minimal · previous review 160c6
Quitting after playback has moved to another device should no longer pause that device. Behavior for local playback is unchanged. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title uses the conventional-commit prefix "fix" with the scope "soloist" and states the main behavior change: remote playback keeps running when the user quits. The changeset adds shutdown_command…
Linked Issues check
Issue #994 requires that quitting spotatui after playback moved to another device (such as a phone) must not pause that device. The change in src/infra/soloist/supervisor.rs replaces the unconditional…
Out of Scope Changes check
The whole-PR diff against the merge base changes two files. In src/infra/soloist/supervisor.rs, the change adds the Status import, the shutdown_commands helper, the updated stop body, the doc co…
Full details: Title check
Explanation
The title uses the conventional-commit prefix "fix" with the scope "soloist" and states the main behavior change: remote playback keeps running when the user quits. The changeset adds shutdown_commands, which sends no commands when Soloist is inactive, so the title matches the main change. The title is concise, imperative, and within the required format.
Full details: Linked Issues check
Explanation
Issue #994 requires that quitting spotatui after playback moved to another device (such as a phone) must not pause that device. The change in src/infra/soloist/supervisor.rs replaces the unconditional link.pause() and link.send(Command::Deactivate) in stop with shutdown_commands(snapshot.is_active, snapshot.status). When snapshot.is_active is false, the function returns an empty list, so no command reaches the other device. When Soloist is active and playing or buffering, it sends Pause then Deactivate. When Soloist is active and paused or idle, it sends only Deactivate. This keeps the existing local-playback behavior. In src/infra/soloist/link.rs, is_active is updated by the Auth, State, and Device events, so the flag used for the decision is kept current. Three unit tests cover inactive playback across Playing, Buffering, Paused, and Idle, active playback that pauses, and paused or idle playback that only deactivates. The issue's reproduction path (q then y) reaches stop. I did not inspect the quit call site directly, and a real phone handoff was not tested, so that end-to-end path rests on the PR description and code review.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes two files. In src/infra/soloist/supervisor.rs, the change adds the Status import, the shutdown_commands helper, the updated stop body, the doc comment, and three tests for the shutdown behavior. Each of these serves issue #994. In CHANGELOG.md, the only added line is the #994 entry under Fixed. The other Fixed entries (#984, #985, #977) already exist at the merge base and are not added by this PR. No unrelated behavior or code changes are present.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Simplify code
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between 4c5fc99 and 160c626.
Files selected for processing: 2
CHANGELOG.md
src/infra/soloist/supervisor.rs
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
# Summary
Starting another source after a Soloist handoff could pause Spotify on
the other device. Soloist could still report a playing status after its
own device became inactive.
Require an active Soloist device before queueing Pause or Deactivate.
Pause also requires playing or buffering. Check the device activity
generation again before submitting either command to the WebSocket. This
drops commands from before a handoff, even if Soloist becomes active
again.
Related to [#994](#994)
and the quit fix in
[#1004](#1004).
# Testing
Ran on Apple Silicon macOS with isolated app paths.
~~~text
cargo fmt --all --check
Exit 0. No output.
cargo clippy --locked --no-default-features --features telemetry,tui --
-D warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s
cargo clippy --locked -- -D warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
cargo clippy --locked --no-default-features --features
telemetry,tui,soloist,local-files -- -D warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.52s
cargo test --locked --no-default-features --features
telemetry,tui,soloist,local-files --lib -- soloist
Finished `test` profile [unoptimized + debuginfo] target(s) in 9.82s
test result: ok. 88 passed; 0 failed; 0 ignored; 0 measured; 2415
filtered out; finished in 0.03s
cargo test --locked --no-default-features --features telemetry,tui
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.45s
test result: ok. 2042 passed; 0 failed; 0 ignored; 0 measured; 0
filtered out; finished in 3.68s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered
out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered
out; finished in 0.00s
~~~
Four regressions failed when the enqueue activity check and the writer's
generation comparison were temporarily removed. All four passed with
both checks restored.
~~~text
test result: FAILED. 84 passed; 4 failed; 0 ignored; 0 measured; 2415
filtered out; finished in 0.02s
~~~
# Additional notes
Tests use simulated Soloist events. A real Soloist session and phone
handoff remain unverified. A frame already submitted to the WebSocket
may still complete during a handoff.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Soloist handoffs now pause local playback only when the device is
active and playback is playing or buffering.
* Queued pause and deactivation commands are discarded if the device
changes state or hands off before they can be applied.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: 2570165831 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #994. With the Soloist engine, quitting spotatui after playback had moved to another device (a phone) paused the music there.
stopinsrc/infra/soloist/supervisor.rssentPause(when the status said playing) andDeactivateon every quit. After a handoff Soloist's status follows the device that plays, and its transport commands reach that device, so the quit paused the phone.shutdown_commands(is_active, status): none while Soloist's device is not the active one;Pause+Deactivateor justDeactivatewhile it is, as before.stop, which is why it did not happen there.Testing
telemetry,tuiandtelemetry,tui,soloist: cleanguileg's features -- typescript_bindings_are_written: passed, no binding changesNew tests:
shutdown_leaves_playback_on_another_device_untouched,shutdown_pauses_active_soloist_before_deactivating_it,shutdown_deactivates_paused_or_idle_soloist_without_pausing_it. The first one fails against the old command list.Additional notes
Not tested with a real phone handoff; the fix reads Soloist's own
is_activeflag, which itsplayback_state,auth_stateanddeviceevents keep current.💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit