Skip to content

fix(network): release the playback poll when the auth gate drops it (#563) - #720

Merged
LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:fix/auth-gate-releases-playback-poll
Oct 8, 2026
Merged

LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:fix/auth-gate-releases-playback-poll

Conversation

@kapok-4o

@kapok-4o kapok-4o commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #563.

Only the GetCurrentPlayback handler clears is_fetching_current_playback, and the tick polls only while it is false. When the auth gate in handle_network_event drops a poll (the refresh fails, or there is no session), the handler never runs, the latch stays set, and the tick never polls again. With spotatui controlling another Connect device, the playbar stays frozen until a restart, even after the next timed refresh succeeds.

Both drop paths at the gate now release the latch when the dropped event is GetCurrentPlayback, next to the cleanup they already do (is_loading, pending_playlist_open).

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, and the macos job's feature set.
  • cargo test --locked: default 1854 passed, slim 1448 passed, the macos feature set 2453 passed, 22 ignored.
  • New test a_playback_poll_dropped_by_a_failed_refresh_lets_the_tick_poll_again: the tick polls, the poll hits a refresh that fails (an expired token with no refresh token, as in pre_event_auth_failure_clears_loading_state), and the tick polls again afterwards. Without the fix it fails at !app.is_fetching_current_playback.

Not run here: the Linux all-sources leg, and the live suspend-and-resume repro from the issue.


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

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 908f6215-1726-4bb7-8c03-1ac83bb3d78a
📥 Commits

Reviewing files that changed from the base of the PR and between 38cbb85 and 8f70b25.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba131c74-ead7-4ca2-b395-93f960c2c78e
📥 Commits

Reviewing files that changed from the base of the PR and between bfacbbd and 38cbb85.

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

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The network event handler now clears the playback-fetch latch when the authentication gate rejects a GetCurrentPlayback event. A regression test checks that a later tick dispatches another poll.

Changes

Playback poll recovery

Layer / File(s) Summary
Clear the latch for rejected playback polls
src/infra/network/mod.rs, tools/gates.count
The handler clears the playback-fetch latch when Spotify is disconnected or authentication refresh fails. A regression test verifies that a subsequent tick dispatches another poll. The test-attribute adoption baseline increases from 2542 to 2543.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 38cbb

No actionable merge-blocking risk is identified; the playback poll recovery change is mergeable after normal checks.

🚥 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 fix prefix with the network scope, and it clearly summarizes the playback-poll fix.
Linked Issues check ✅ Passed Issue #563 requires the playback poll to resume after the auth gate drops GetCurrentPlayback. The change clears is_fetching_current_playback on both drop paths and adds a regression test that veri…
Out of Scope Changes check ✅ Passed The changes are limited to releasing the playback-poll latch at the auth gate, testing that recovery, and updating the test-count baseline. These changes support issue #563; no unrelated changes are i…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR
  • Autopilot · 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.

❤️ Share

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

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/infra/network/mod.rs 97.7% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…argeModGames#563)

Only the GetCurrentPlayback handler cleared is_fetching_current_playback,
and the tick polls only while it is false. A poll dropped at the auth
gate (failed refresh, or no session) left the latch set, so the tick
never polled again and a remote device's playbar stayed frozen until a
restart. Both drop paths now release it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kapok-4o
kapok-4o force-pushed the fix/auth-gate-releases-playback-poll branch from 38cbb85 to 8f70b25 Compare October 7, 2026 20:07
@LargeModGames
LargeModGames merged commit 7f5debd into LargeModGames:main Oct 8, 2026
30 of 31 checks passed
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.

A failed token refresh stops the playback poll for the rest of the session

2 participants