fix: harden transcode cache integrity and cleanup - #499
Closed
JHNY5 wants to merge 1 commit into
Closed
Conversation
JHNY5
marked this pull request as ready for review
August 14, 2026 00:15
Member
|
WahWah already handle these check. so no need to do it again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents serving corrupt or stale transcoded audio from cache.
Problem
The transcode cache integrity check (
valid_cache?) only compares tag duration (±2s) via WahWah. This accepts an empty or partially-written cache file (serving a 0-byte audio response) and never evicts stale entries, so a changed bitrate or replaced media can leave permanently-wrong content cached for a song id.Changes
app/controllers/transcoded_stream_controller.rb:valid_cache?now rejects missing or zero-length cache files before trusting the duration comparisonapp/models/stream.rb: newStream#clean_transcode_cache!evicts stale cache entries for a song (bitrate/source changes)test/controllers/transcoded_stream_controller_test.rb: regression test for the empty-cache caseVerification
This is the master-targeted component; a separate PR targets the v3.2.0 release branch where the API-level fixes live.