Repository navigation
fix(jellycompat): stop play session ids leaking into the id codec map - #384
Conversation
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.
|
Warning Review limit reached
Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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.