TT-7596 TT-7609 fix: tag PBT takes with their language and load an existing take mid-navigation - #522
Merged
Conversation
…isting take mid-navigation Phrase BT takes were uploaded with the language attribute keyed 'language-bcp47'. The API expects the single lowercase token 'languagebcp47' and silently drops the dasherized form, so every take was stored untagged. Any consumer that scopes rows by step language then failed to match them: the PBT Transcribe step reported segments as missing recordings, and returning to an already-recorded segment showed an empty recorder, both clearing once the record was re-read from the server. MediaRecord also dropped its load when mediaId changed while a load or save was in flight, with no retry, so the take of the segment navigated to stayed invisible until the step was remounted. The load is now deferred rather than dropped, and an in-flight load that is overtaken by navigation is abandoned instead of handing the previous segment's audio to the new one. The reset stays tied to a real mediaId change so a take whose upload failed is not wiped out from under the TT-7583 retry. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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
Takes uploaded untagged (TT-7596). The media upload payload sent the language attribute as
'language-bcp47'. The API expects the single lowercase tokenlanguagebcp47— unlike the other multi-word attributes it is not dasherized — and silently drops the unknown key. Every Phrase BT take was therefore stored with no language.Anything that scopes rows by step language then failed to match them:
recordingRow— and soMediaRecord'smediaId— never resolved.Both cleared once the record was re-read from the server, which is why leaving the step and returning "fixed" it.
Load dropped mid-navigation. On top of that,
MediaRecordloaded an existing take only on amediaIdchange, and skipped it outright while a load or save was in flight (if (!loading) handleLoadAudio()), with nothing to retry it. Changing clause during that window lost the load until the step was remounted. An in-flight load was also never abandoned, so a late-resolving fetch could hand the previous clause's audio to the clause just navigated to.Changes
store/upload: sendlanguagebcp47; the type carries a comment about the non-dasherized key so it does not regress.MediaRecord: defer the load instead of dropping it — a new effect keyed on[loading, mediaId]runs the skipped load once the recorder is idle, guarded by the id a load was started for so it runs at most once per take.MediaRecord:handleLoadAudiocaptures the id it was started for and bails at eachawaitifmediaIdhas moved on, so a stale fetch cannot paint the wrong take.MediaRecord: a just-uploaded id is marked as already present, so saving no longer blanks the take and re-fetches it.reset()stays tied to a realmediaIdchange (not toloading), so a take whose upload failed is not wiped out from under the TT-7583 retry.Test plan
MediaRecord.load.test.tsx. Verified failing-before / passing-after against unfixed source: pre-fix the mid-load case never loads the second take (loadCallsstays at the abandoned url) and hands the stale blob to the waveform; post-fix both assertions hold.npx jest src/components/MediaRecord→ 12/12 pass, including the pre-existing suite (the TT-7583 "keeps save available so the same take can be retried" test guards the reset behavior above).tsc --noEmitclean; Prettier clean on the touched files.actions.tsxhas a pre-existing formatting deviation that also fails ondevelop, left alone to keep the diff to one line.Note: the
cypress-testscheck failure is unrelated to this diff — the Cypress binary is missing from the runner cache, so no spec runs. It is failing the same way on other current PRs and on recentdeveloppushes.🤖 Generated with Claude Code