test(medium): Refactor Spotify Polling Architecture #7654
Closed
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.
Description
Refactor the Spotify polling architecture to improve robustness and testability.
Key changes:
SpotifyManagerContextinterface to provide a stable way forSpotifyPlayerManagerandSpotifyDeviceManagerto access the Spotify SDK and shared state. This resolves the "fragile SDK propagation" issue where managers could hold references to stale SDK instances.SpotifyPlayerManager.refreshPlaybackStateto fetch the new playback state before capturing the current local state, ensuring comparisons are made against the most recent data and preventing race conditions._test_block and associated helper methods fromSpotifyPollingin favor of more robust integration-style testing using public methods and mocks.SafeSpotifyApitype definition totypes/spotify.tsto resolve circular dependency issues between services and types.SpotifyPolling,SpotifyPlayerManager, andSpotifyDeviceManagerto align with the new architecture and constructor signatures.Fixes # (issue)
Change Type: 🏗️ Refactoring (code change that neither fixes bug nor adds feature)
PR Scope Checklist
This checklist is mandatory for all PRs.
Impact Assessment
Original PR Body
Refactor the Spotify polling architecture to improve robustness and testability.
Key changes:
SpotifyManagerContextinterface to provide a stable way forSpotifyPlayerManagerandSpotifyDeviceManagerto access the Spotify SDK and shared state. This resolves the "fragile SDK propagation" issue where managers could hold references to stale SDK instances.SpotifyPlayerManager.refreshPlaybackStateto fetch the new playback state before capturing the current local state, ensuring comparisons are made against the most recent data and preventing race conditions._test_block and associated helper methods fromSpotifyPollingin favor of more robust integration-style testing using public methods and mocks.SafeSpotifyApitype definition totypes/spotify.tsto resolve circular dependency issues between services and types.SpotifyPolling,SpotifyPlayerManager, andSpotifyDeviceManagerto align with the new architecture and constructor signatures.PR created automatically by Jules for task 2752464580658856891 started by @arii