Skip to content

fix shuffle track start time shift - #531

Merged
LargeModGames merged 1 commit into
mainfrom
fix/shuffle-mode-track-start-time
Sep 16, 2026
Merged

LargeModGames merged 1 commit into
mainfrom
fix/shuffle-mode-track-start-time

Conversation

@shilicioo

@shilicioo shilicioo commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix native Spotify shuffle carrying the previous song’s playback position into a newly selected song. Pending shuffle reloads now retain their intended seek position instead of reading potentially stale global playback progress.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --locked --no-default-features --features telemetry,tui -- -D warnings
  • cargo test --locked --no-default-features --features telemetry,tui
  • cargo clippy --locked -- -D warnings
  • cargo test --locked
  • cargo test --locked native_shuffle
  • tools/check_gates_ratchet.sh origin/main

Additional notes

Only native Spotify playback with client-side shuffle is affected. External Spotify Connect devices and alternative-source players are unchanged.

Summary by CodeRabbit

  • Bug Fixes

    • Improved native shuffle reloading to preserve the correct playback position when continuing a track.
    • Prevented newly loaded tracks from inheriting stale playback progress.
    • Improved handling of shuffle reloads during playback so track and seek-position updates remain synchronized.
  • Tests

    • Added coverage for shuffle reloads that confirm both the selected track and playback position.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview 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: Advanced

Run ID: 361496c0-e792-41f8-84a7-9c2266bc9656

📥 Commits

Reviewing files that changed from the base of the PR and between dc9c0ab and efdfbb7.

📒 Files selected for processing (4)
  • src/core/app/native_shuffle.rs
  • src/core/app/queue_suspend.rs
  • src/infra/network/native_shuffle.rs
  • tools/gates.count

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


📝 Walkthrough

Walkthrough

Native shuffle reloads now store a target index and seek position. Reload creation, synchronization, full-context completion, fixtures, and tests use the structured state.

Changes

Native shuffle reload tracking

Layer / File(s) Summary
Reload state contract and synchronization
src/core/app/native_shuffle.rs, src/core/app/queue_suspend.rs
NativeSpotifyShuffleSession now stores PendingNativeShuffleReload. Synchronization confirms matching reloads and consumes the pending state. Related fixtures and tests use the renamed field.
Reload state creation paths
src/infra/network/native_shuffle.rs
Initial loads, shuffle toggles, album shuffle, reshuffles, and queue resumes record target indexes with seek positions.
Reload completion and validation
src/infra/network/native_shuffle.rs, tools/gates.count
Full-context completion selects the captured seek position or observed progress. Tests cover new-track, confirmed, and mid-track reloads. The test attribute baseline increases from 1879 to 1883.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to efdfb

This change makes newly selected shuffle tracks start at their intended position instead of inheriting the previous song's progress, with behavior limited to native Spotify playback. No outstanding correctness or build concerns were found, so it looks ready to merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title describes the native shuffle playback-position fix, but it does not use the required conventional-commit format because fix: must include a colon. The subject is also not imperative. Change the title to a conventional-commit title with an imperative subject, for example: fix: prevent shuffle tracks from inheriting stale playback position.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
  • Fix all pre-merge checks with AI
✨ 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/shuffle-mode-track-start-time
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/shuffle-mode-track-start-time

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 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.44444% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/infra/network/native_shuffle.rs 45.0% 22 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit 97aba0e into main Sep 16, 2026
31 checks passed
@LargeModGames
LargeModGames deleted the fix/shuffle-mode-track-start-time branch September 16, 2026 15:15
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.

2 participants