fix(review): re-sign instrumental preview URLs on expiry (refresh-on-error) - #973
Merged
beveradb merged 2 commits intoSep 1, 2026
Merged
Conversation
…error)
The combined-review preview modal's overlaid instrumental <audio> used the
signed GCS URL baked into the review payload at page load (120-min expiry).
A review session (or a reload that rehydrates cached correction data from
localStorage) can outlive that, so toggling to "Instrumental" silently fails
to load the stem (Firefox surfaces it as NS_ERROR_DOM_NETWORK_ERR).
- Backend: extract a shared `_build_instrumental_options` helper and add
`GET /api/review/{job_id}/instrumental-urls` returning freshly-signed URLs.
- Frontend: on the stem <audio> `error`, re-fetch fresh URLs via the new
endpoint and swap them in; the existing sync effect resumes playback in
place. Capped at 3 refreshes per modal open so a genuinely-broken stem
can't loop.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Google's cloud-sdk apt mirror intermittently serves a Packages index whose checksum doesn't match its Release file, and stale runner apt-lists caches produce the same "Hash Sum mismatch" — repeatedly failing the emulator job's setup with exit code 100 (unrelated to the code under test). Clear the apt lists cache and retry the update+install a few times to ride out the desync. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
beveradb
deleted the
feat/sess-20260901-1626-preview-instrumental-audio
branch
September 1, 2026 22:38
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.
Problem
Completing a combined review failed to play the instrumental in the preview modal — toggling to Instrumental loaded nothing, with
NS_ERROR_DOM_NETWORK_ERRin DevTools (Firefox) on thereview-audio/instrumental_with_backing.oggGCS request.Root cause: the overlaid instrumental
<audio>uses the signed GCS URL baked into the review payload at page load, which has a 120-minute expiry. A long review session outlives it, so the stem fetch returns400 ExpiredTokenand playback silently fails. Confirmed by fetching the exact URL from the report:ExpiredToken — Request signature expired at 2026-09-01T20:16:26Z(page had been open ~2h11m).Reloading didn't help because the review UI persists the full
CorrectionData— includinginstrumental_options[].audio_url— tolocalStorage(lyrics_analyzer_data) and rehydrates it when the user has unsaved edits, so the same expired URL came back.The
[SW] Service worker registeredlog is a red herring:frontend/public/sw.jshas nofetchhandler.Fix (refresh-on-error)
_build_instrumental_optionshelper and addGET /api/review/{job_id}/instrumental-urlsreturning freshly-signed stem URLs.<audio>errorevent, re-fetch fresh URLs via the new endpoint and swap them in. The existing video↔audio sync effect (keyed on the URL) resumes playback in place. Capped at 3 refreshes per modal open so a genuinely-broken stem (404) can't loop.No new user-facing strings (the recovery is silent) → no i18n changes.
Testing
TestInstrumentalUrlsRefresh. Fulltest_routes_review.py+test_combined_review_flow.py+test_audio_transcoding_service.py= 111 passed.PreviewVideoSectiontests (swap on error / cap at 3 / no-op without refresh fn). Full unit suite = 1248 passed.@coderabbitai ignore