Skip to content

fix(jellycompat): stop play session ids leaking into the id codec map - #384

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
JeremySNR:fix/jellycompat-playsession-map-leak
Aug 20, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
JeremySNR:fix/jellycompat-playsession-map-leak

Conversation

@JeremySNR

Copy link
Copy Markdown
Contributor

Every PlaybackInfo request and stream open mints a fresh random UUID for the play session and runs it through EncodeStringID, which recorded it in the codec's reverse map. Play session ids are never decoded back: clients echo the encoded id and it's matched as an opaque string against the playback session store, including across restarts via the durable store. So each playback left one permanent entry in a process-lifetime singleton, and since clients probe PlaybackInfo while browsing, the map grew faster than actual plays. The other hashed kinds in there (genres, studios) dedupe by value and plateau at catalog size, so in normal operation this was the only key space feeding the map without bound.

The fix skips the reverse map write for play session ids. The guard sits after the hashing, so the returned id is byte identical and encoding stays deterministic. Even the odd case of feeding a play session UUID to DecodeStringID with a different kind behaves the same: it failed the kind check before and returned unknown compat id, now it misses the map and returns the same error.

Tested with the package's idcodec tests plus a new regression test. The new test fails against the old code (reverse map retained 3 play session entries, want 0) and passes with the fix, and the existing restart-safety, legacy numeric and genre round-trip tests all still pass.

Built with AI assistance. I've read through the whole diff and tested it myself, and I'm happy to own it.

Every PlaybackInfo request and stream open mints a fresh random UUID and
runs it through EncodeStringID, which recorded it in the codec's reverse
map. Play session ids are never decoded back: clients echo the encoded
id and it is matched as an opaque string against the playback session
store. Each playback therefore left one permanent entry in a
process-lifetime singleton, and since clients probe PlaybackInfo while
browsing, the map grew faster than actual plays. Other hashed kinds
(genres, studios) dedupe by value and plateau at catalog size, so in
normal operation this was the only key space feeding the map without
bound.

Skip the reverse map for play session ids and add a regression test.
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@JeremySNR, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6fdcb41e-e867-4aae-9e3b-bc0362a93b14

📥 Commits

Reviewing files that changed from the base of the PR and between 28c6ddc and 5d5a29b.

📒 Files selected for processing (2)
  • internal/jellycompat/idcodec.go
  • internal/jellycompat/idcodec_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Quick104
Quick104 merged commit 5e1effd into Silo-Server:main Aug 20, 2026
1 check 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.

2 participants