Repository navigation
fix(jellycompat): serve scrobble lock waiters in arrival order (revamp copy of #1886) - #1887
Conversation
sendCompatResumeStart holds the per-session scrobble lock across the watch-provider call, so client reports queue behind it. The lock was a sync.Mutex, which lets a position-less Stopped report that reaches the lock just as the start releases it take the lock ahead of a progress report already waiting. The stop is then staged from the earlier position and providers get the wrong resume point. TestHandlePlaybackPositionlessStoppedUsesQueuedReportPosition failed intermittently (11-49% of runs locally) mostly for a test-side reason: the old lock counted a caller as queued before it waited on the mutex, so the test could not reliably set up the queue order. Handing the lock to waiters in the order they reached it fixes both, because a caller now counts as queued exactly when it joins the queue. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 9888fe5)
The FIFO lock's unlock closure was not idempotent. A second call with no waiters deleted the map entry even if a newer caller had since taken the lock, so a third caller could get in beside that owner. sync.Mutex panicked in this case; the closure now does the same. No current caller releases twice. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit fd791e0)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Brings in login-wide personal collection sharing (#1875), the scrobble lock fix (#1887), and the import owner-access fix (#1874). Conflict resolution keeps both sides: the capabilities test expects login_sharing and create_description, the fixture list keeps collection_order_foreign_id before this branch's appended cases, and the create-description DB test no longer sets the removed AllowedProfileIDs. The OpenAPI document, fixtures, and web types are regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…view-posters Brings in login-wide personal collection sharing (#1875), the scrobble lock fix (#1887), and the earlier phase-1 merges from feat/collections-revamp. Capabilities now advertise both login_sharing and preview_posters, the fixture deps carry the shared collection alongside the preview view, and the preview fixture case stays appended after the create-description cases. Generated contract artifacts were regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…emplate-summaries Brings in personal login sharing (#1875), the scrobble lock fix (#1887), and the preview-poster work. The only conflict was the contract digest in get_system_info_ok.json; regenerated the OpenAPI document, fixtures, and web types after the merge. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…es' into feat/api-collection-capabilities-sync Brings in personal login sharing (#1875), the scrobble lock fix (#1887), and the phase-1 collection PRs. The personal capability test now expects both login_sharing and this branch's mdblist_search and schedule_time_zone. The OpenAPI document, fixtures, and web types are regenerated, with the admin collection capability fixture still appended last. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… into feat/api-collection-row-references Brings in the base's personal login sharing (#1875), the scrobble lock fix (#1887), and the phase-1 API branches. The only conflict was the contract digest in get_system_info_ok.json; the OpenAPI document, fixtures, and web types were regenerated from the merged router. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…es' into fix/sections-missing-collection-log Brings in the moved feat/collections-revamp base (#1875 personal login sharing, #1887 scrobble lock fix) through the row-references branch. The merge applied cleanly; the missing-collection logging tests pass under the login-wide sharing model without changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…log' into feat/api-collections-contains-item Brings in login-wide personal collection sharing (#1875), the scrobble lock fix (#1887), and the earlier phase-1 collection PRs. The contains_item tests now create shared collections with is_shared alone, since allowed_profile_ids is gone. The capability test expects both login_sharing and contains_item. The fixture list carries the shared collection, which gets no contains flag. Contract artifacts were regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: N/A
Validation tasks: none
This brings #1886's fix for the jellycompat scrobble lock onto
feat/collections-revamp. The testTestHandlePlaybackPositionlessStoppedUsesQueuedReportPositionfails in a large share of CI runs on this branch, as onmain, and it has failed CI on most revamp PRs so far. The same two commits are on #1886 intomain; whenmainmerges into this branch later, the identical change merges cleanly.The lock fix itself, its tests and its review are described in #1886: the per-session scrobble lock now serves waiters in the order they reached it, and releasing it twice panics.
Approach
Cherry-picks of the two commits from #1886, unchanged.
Validation
go test -count=20 ./internal/jellycompat/ -run 'Scrobble|Stopped|CompatScrobbleLocks': pass on this branch.go vet ./internal/jellycompat/: clean.Risks
Same as #1886. None beyond it.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Serve scrobble lock waiters FIFO in
compatScrobbleLocksReplaces the per-key embedded mutex and holder counter in playback_scrobble.go with a FIFO queue of waiter channels, so a newly arriving caller can no longer overtake callers already waiting on the same scrobble key.
Macroscope summarized babf7d4.