Skip to content

fix(jellycompat): serve scrobble lock waiters in arrival order (revamp copy of #1886) - #1887

Merged
Quick104 merged 2 commits into
feat/collections-revampfrom
fix/revamp-scrobble-lock-order
Oct 4, 2026
Merged

Quick104 merged 2 commits into
feat/collections-revampfrom
fix/revamp-scrobble-lock-order

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

This brings #1886's fix for the jellycompat scrobble lock onto feat/collections-revamp. The test TestHandlePlaybackPositionlessStoppedUsesQueuedReportPosition fails in a large share of CI runs on this branch, as on main, and it has failed CI on most revamp PRs so far. The same two commits are on #1886 into main; when main merges 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

Risks

Same as #1886. None beyond it.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewers)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: see fix(jellycompat): serve scrobble lock waiters in arrival order #1886; two independent reviewers checked the lock for mutual exclusion, arrival-order handoff and lost wakeups, and found the test flake and double-release issues that the second commit fixes.

🤖 Generated with Claude Code

Note

Serve scrobble lock waiters FIFO in compatScrobbleLocks

Replaces 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.

  • Release closes the oldest waiter's channel to transfer ownership, and removes the key entry when no waiters remain.
  • Invoking the same release closure twice now panics before touching lock ownership.
  • Adds tests for arrival-order acquisition and the double-release panic in playback_scrobble_test.go.
  • Behavioral Change: double release of a lock closure panics instead of being a silent no-op.

Macroscope summarized babf7d4.

Quick104 and others added 2 commits October 4, 2026 02:49
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)
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e65282f4-4a7d-4aa8-9469-9e516f2ad1e5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T06:53:19.337437Z babf7d4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Quick104
Quick104 merged commit d8f776f into feat/collections-revamp Oct 4, 2026
13 checks passed
@Quick104
Quick104 deleted the fix/revamp-scrobble-lock-order branch October 4, 2026 12:22
Quick104 added a commit that referenced this pull request Oct 4, 2026
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]>
Quick104 added a commit that referenced this pull request Oct 4, 2026
…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]>
Quick104 added a commit that referenced this pull request Oct 4, 2026
…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]>
Quick104 added a commit that referenced this pull request Oct 4, 2026
…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]>
Quick104 added a commit that referenced this pull request Oct 4, 2026
… 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]>
Quick104 added a commit that referenced this pull request Oct 4, 2026
…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]>
Quick104 added a commit that referenced this pull request Oct 4, 2026
…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]>
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