Skip to content

fix(jellycompat): repair episode handoff - #529

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
Pukabyte:fix/jellycompat-continue-watching
Aug 11, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
Pukabyte:fix/jellycompat-continue-watching

Conversation

@Pukabyte

@Pukabyte Pukabyte commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • trust token-derived playback identity when clients retain stale UserId values
  • fall back to requested item files when Continue Watching carries a previous MediaSourceId
  • strip NUL code points throughout durable playback-session JSON before PostgreSQL writes

Validation

  • targeted Jellyfin compat regression tests pass
  • production build and compat health probe pass
  • active HLS segment requests return HTTP 200

Regression coverage

  • stale request UserId
  • stale MediaSourceId across episode transitions
  • client DeviceId containing NUL
  • nested playback metadata containing NUL while literal \u0000 text remains intact

Summary by CodeRabbit

  • Bug Fixes
    • Improved playback negotiation when requests contain outdated user or media-source details.
    • Playback now falls back to the current media sources when a selected source is no longer valid.
    • Removed invalid NUL characters from saved device and playback-session data.
    • Preserved valid escaped text while cleaning persisted playback information.

Continue Watching clients can retain stale user and media-source values across episode transitions. Keep token-derived authorization authoritative and fall back to the requested item files.

Strip NUL code points across durable playback-session JSON so PostgreSQL persistence cannot leave negotiated sessions cache-only.
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d3685820-5c2d-4888-8b8b-2cc770c13cb5

📥 Commits

Reviewing files that changed from the base of the PR and between 64cb734 and f4b7a4f.

📒 Files selected for processing (1)
  • internal/jellycompat/handlers_playback.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/jellycompat/handlers_playback.go

📝 Walkthrough

Walkthrough

Playback negotiation now trusts authenticated session identity, falls back from stale media-source IDs, and removes NUL characters from client device IDs and persisted playback-session JSON.

Changes

Playback compatibility

Layer / File(s) Summary
Playback request normalization
internal/jellycompat/handlers_playback.go, internal/jellycompat/playback_negotiation_dedup_test.go
Stale request user IDs no longer cause rejection. Unmatched media-source IDs are cleared. Client device IDs are sanitized before storage. Tests cover these cases.
Session persistence sanitization
internal/jellycompat/playback_sessions_postgres.go, internal/jellycompat/playback_sessions_postgres_test.go
Playback-session JSON marshaling removes encoded NUL characters while preserving literal escape text. All PostgreSQL session persistence paths use the helper. Tests cover nested session values.

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

Possibly related PRs

Suggested labels: v1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Jellyfin compatibility fix for episode handoff, which matches the primary playback negotiation changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Aug 1, 2026
@Quick104
Quick104 merged commit 20c6b14 into Silo-Server:main Aug 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants