Skip to content

fix(queue): refuse a plugin's repeat while the queue slot owns playback - #503

Merged
LargeModGames merged 1 commit into
mainfrom
fix/376-plugin-repeat-queue-slot
Sep 2, 2026
Merged

fix(queue): refuse a plugin's repeat while the queue slot owns playback#503
LargeModGames merged 1 commit into
mainfrom
fix/376-plugin-repeat-queue-slot

Conversation

@LargeModGames

@LargeModGames LargeModGames commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the second half of #376. After #390 closed the internet-radio path, a plugin's set_repeat still reached the user's real Spotify device whenever the native queue slot owned playback: Action::SetRepeat dispatches a raw IoEvent::Repeat, no router consumed it, and Network::repeat changed repeat on a track the user was not listening to, with nothing on screen to show for it. This is reachable in a plain default build.

The fix is a Repeat arm in route_queue_event, gated on queue_owns_playback(). That router is compiled unconditionally and runs first in the pump, so it covers the Spotify and decoded queue slots in one place without touching the per-source dispatchers. It sets the same "Repeat does not apply to this source" status the keyboard path uses, so the plugin caller gets the same answer as the key.

set_shuffle does not have the same hole: Action::SetShuffle goes through App::shuffle, which already carries the queue-slot guard.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings: clean
  • cargo test --no-default-features --features telemetry,tui: 906 passed
  • cargo clippy -- -D warnings: clean
  • cargo test: 1208 passed, including the new repeat_is_refused_while_the_queue_slot_owns_playback (gated on streaming, since the slim build's QueueNowPlaying has no variants)
  • tools/check_gates_ratchet.sh origin/main: ok

Not verified: a live run with a Lua plugin calling set_repeat over a queued track.

Additional notes

test_attribute_total moves 1770 to 1771 in tools/gates.count for the new test.


💬 Questions or want to chat with other contributors? Join the spotatui Discord.

Summary by CodeRabbit

  • New Features

    • Queue playback now handles repeat actions directly while playback is active and displays a status message.
    • Repeat actions continue to be forwarded normally when the queue does not control playback.
  • Tests

    • Added coverage for repeat handling in both playback scenarios.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 1e70eb78-507f-4a1a-807d-8561259904ee

📥 Commits

Reviewing files that changed from the base of the PR and between 08bf085 and 31d1c4c.

📒 Files selected for processing (2)
  • src/infra/queue/dispatch.rs
  • tools/gates.count

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Queue routing now consumes repeat events when a queue slot owns playback and reports an unsupported-source status. Events without queue ownership continue through normal routing. Streaming tests cover both paths.

Changes

Queue repeat handling

Layer / File(s) Summary
Route and validate repeat events
src/infra/queue/dispatch.rs, tools/gates.count
route_queue_event consumes repeat events for queue-owned playback and emits a status message. Repeat events without queue ownership fall through. Streaming tests cover both behaviors. The test attribute baseline increases from 1770 to 1771.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 31d1c

The change narrowly prevents repeat commands from affecting playback owned by the queue slot; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the allowed conventional-commit prefix fix(queue):, clearly describes the queue repeat handling change, and uses a concise imperative subject.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/376-plugin-repeat-queue-slot
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/376-plugin-repeat-queue-slot

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit 8444374 into main Sep 2, 2026
31 checks passed
@LargeModGames
LargeModGames deleted the fix/376-plugin-repeat-queue-slot branch September 2, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant