Repository navigation
feat(jellycompat): support DELETE /Videos/ActiveEncodings transcode teardown - #159
Conversation
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a ChangesDELETE /Videos/ActiveEncodings endpoint
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Code reviewI validated the PR's claims and they largely hold: ownership enforcement, Found 1 issue:
silo-server/internal/jellycompat/streams.go Lines 702 to 709 in 0b6c3e7 The sibling guard it diverges from: silo-server/internal/jellycompat/streams.go Lines 748 to 750 in 0b6c3e7 Adding Note (process): per the root CLAUDE.md "Silo v1 Process," a new user-facing capability needs a filed/triaged v1 capability proposal and a 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…ted sessions HandleDeleteActiveEncodings omitted the UpstreamSessionID == "" guard that the sibling Stopped-report path uses. A PlaybackSession is created by PlaybackInfo with an empty UpstreamSessionID; it is only populated once the first manifest request reaches ensureUpstreamPlayback. A DELETE /Videos/ActiveEncodings arriving in that window (with a matching token) passed the ownership guard and ran teardownPlaySession, which deletes the compat play session from the store. A subsequent HandleMasterManifest then 404s, and the teardown was not the "no-op-safe" operation its doc comment claims. Mirror the Stopped report path by treating an unknown, not-owned, OR not-yet-started PlaySessionId as a uniform idempotent 204 no-op. Add a regression test that fails if the guard is removed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Pushed
The scope-gate process note (v1 capability proposal + 🤖 Generated with Claude Code |
…eardown (#159) * feat(jellycompat): support DELETE /Videos/ActiveEncodings transcode teardown * fix(jellycompat): guard ActiveEncodings teardown against not-yet-started sessions HandleDeleteActiveEncodings omitted the UpstreamSessionID == "" guard that the sibling Stopped-report path uses. A PlaybackSession is created by PlaybackInfo with an empty UpstreamSessionID; it is only populated once the first manifest request reaches ensureUpstreamPlayback. A DELETE /Videos/ActiveEncodings arriving in that window (with a matching token) passed the ownership guard and ran teardownPlaySession, which deletes the compat play session from the store. A subsequent HandleMasterManifest then 404s, and the teardown was not the "no-op-safe" operation its doc comment claims. Mirror the Stopped report path by treating an unknown, not-owned, OR not-yet-started PlaySessionId as a uniform idempotent 204 no-op. Add a regression test that fails if the guard is removed. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Quick <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
Problem
Jellyfin clients (e.g. JellyCon) call
DELETE /Videos/ActiveEncodingswhen playback stops, to tear down the running HLS transcode. The compat layer didn't implement it, so a transcode kept running until the playback-session TTL (default 6 h) expired.Approach
Implement
DELETE /Videos/ActiveEncodingsin the session-auth group (Jellyfin marks the endpoint[Authorize]). It resolves the play session byPlaySessionIdand tears it down, reusing a sharedteardownPlaySessionhelper extracted from the existing Stopped-report stop path (removing duplicated teardown logic). Every step is idempotent, so an already-gone session is a clean204.Ownership is enforced: only the session's own caller (matching
CompatToken) may tear it down; an unknown or not-ownedPlaySessionIdis a uniform204no-op — no cross-session teardown and no ownership oracle — mirroring the ownership check the Stopped report already uses.DeviceIdis intentionally ignored: Silo's store is keyed byPlaySessionId, clients always send it, and Jellyfin's own teardown matches byplaySessionIdwhen it is non-empty.Testing
New tests: happy path stops the upstream session and deletes the store entry (
204); missingPlaySessionId→204no-op; unknown session →204; lowercaseplaySessionIdkey resolves; a foreign-token request does not tear down the session (ownership guard); and the realDeviceId=...&PlaySessionId=...client shape. Green in a libvips container; the ownership guard was mutation-verified (the foreign-session test fails when the check is removed).Notes / scope
This adds a new compat endpoint. If it falls under the v1 capability scope gate (
docs/architecture/v1-scope.md), I'm happy to file a capability proposal first — flagging for triage.DeviceIdis accepted but ignored by design (the store has no device index).AI-use disclosure: implemented and tested with AI assistance (Claude Code), including an adversarial review that caught and fixed a cross-session IDOR (a missing ownership check) before submission. Diff and tests were human-reviewed and run in a libvips Docker container.
Summary by CodeRabbit
Release Notes
New Features
DELETE /Videos/ActiveEncodingsendpoint to stop active encoding sessions with session ownership validation.Improvements
Tests