fix(edit-track): regenerate the preview when the preview start changes - #14556
Merged
Conversation
The edit flow never passed generatePreview to sdk.tracks.updateTrack, and the SDK only regenerates a preview when asked. Editing a gated track's preview start point therefore updated preview_start_seconds in metadata while the track kept streaming the clip at the old offset — the stored preview_cid was never replaced. Pass generatePreview when the preview start is set and differs from the cached previous value. The SDK already skips regeneration when a new audio file is uploaded (transcoding produces the preview then), so this only fires on metadata-only edits. A cache miss for the previous track errs on the side of regenerating, which is idempotent for the same offset. Found while tracing the client preview flows during the content-auth review: the only current caller of updateTrack's generatePreview branch was nobody. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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.
Follow-up bug fix from the content-auth review of #14550/#14552 — independent of the redesign in #14555, works against today's servers.
The bug
useUpdateTracknever passesgeneratePreviewtosdk.tracks.updateTrack, and the SDK'supdateTrackonly callsgenerate_previewwhen that flag is set. So editing a gated track's preview start point updatespreview_start_secondsin the track metadata while the track keeps streaming the oldpreview_cid's clip — the preview is never re-sliced at the new offset. As far as I can trace, nothing else regenerates it (populateTrackMetadataWithUploadResponseV2only touchespreviewCidwhen a new audio file was uploaded).The fix
Pass
generatePreview: truewhen the preview start is set and differs from the cached previous track's value:audioFileis present (transcoding produces the preview then) and whenpreviewStartSecondsis undefined.Once #14555 lands, this call site inherits the attributed
generate_previewrequest automatically —updateTrackthreads itsuserIdinternally.Testing
packages/commontypechecks clean; eslint clean on the touched file.🤖 Generated with Claude Code