fix(speech-to-text): write the transcoded .wav under tmp/ like the extension - #3157
fix(speech-to-text): write the transcoded .wav under tmp/ like the extension#3157cabljac wants to merge 4 commits into
Conversation
…tension The extension named the transcoded WAV after its local temp file, so the object landed at tmp/<original path>.wav, prefixed with OUTPUT_STORAGE_PATH verbatim when set (no separator normalisation, so a trailing slash gave a double slash). The kit derived the name from the input object and normalised the prefix, which moved the file for migrated users. Issue #3140 decided on parity, so the kit now reproduces the extension's path exactly. The .txt transcript path is unchanged.
There was a problem hiding this comment.
Code Review
This pull request restores the legacy behavior of writing transcoded ".wav" files to a "tmp/" subpath (e.g., "tmp/.wav" or under "OUTPUT_STORAGE_PATH" when set). It also removes trailing-slash normalization for "OUTPUT_STORAGE_PATH", matching the legacy extension's behavior. The CHANGELOG, README, implementation in "handlers.ts", and corresponding tests have been updated accordingly. No review comments were provided, so there is no additional feedback.
Restoring the `tmp/` segment on the transcoded `.wav` moved the transcript too, because the Speech API output was named after the uploaded object. Strip the segment back off when naming the transcript, as the extension did, and build the object path with `path.posix.join` so it gets the normalisation the extension got from `path.join(os.tmpdir(), filePath)`.
|
Pushed fixes for all four points in 5222924, and merged The transcript was the substantive one: The README section is now a table covering both outputs across the unset, Two legacy quirks are left alone and called out in the description: an |
The extension concatenated the prefix raw, so `transcriptions/` produced
`transcriptions//tmp/a.mp3.wav`. Cloud Storage accepts that object name but
Speech-to-Text rejects the URI ("is an invalid GCS path"), so the audio was
uploaded and no transcript was ever written. Verified on a live deploy: the
transcript is missing and the Firestore document is left on "Transcoding audio
file.". Matching the extension there would only reproduce the failure, so the
slash is stripped and `transcriptions/` behaves like `transcriptions`.
|
Tested this on a live deploy, and it turned up one thing that changes the decision in #3140. Deployed three instances against one bucket so a single upload exercised all three prefix cases, on The Cloud Storage accepts the double-slash object name, so the transcode uploads fine and the failure only lands at the recognition call. The result is an orphaned So 103cf4e puts the strip back and keeps everything else. After that, all three configs succeed. Worth noting the Happy to be talked out of it if the double slash matters to someone, but as it stands parity there means reproducing a hard failure. |
The extension named the transcoded WAV after the local temp file it had just written, so the object landed at
tmp/<original path>.wavunderOUTPUT_STORAGE_PATH. The kit named it after the input object instead, so migrated users could not find their transcoded audio.This restores the extension's paths for both outputs. Because the Speech API output was named after the uploaded object, putting
tmp/back also moved the.txt, sotranscribeAndUploadnow takes an explicit transcript object name and the handler strips the segment back off, exactly as the extension did.path.posix.joinsupplies the normalisationpath.join(os.tmpdir(), filePath)gave for free.One deviation, and it needs a decision: a trailing slash on
OUTPUT_STORAGE_PATHis stripped rather than doubled. The extension'stranscriptions//tmp/a.mp3.wavis a valid object name but not a valid Speech API audio URI, so that config uploaded the audio and never wrote a transcript, leaving the Firestore document on "Transcoding audio file.". #3140 chose parity "double slash included"; that would reproduce a total failure, so this reverses that half.Verified on a live deploy (three instances, one bucket): all six paths are as documented above, with real transcripts. The double-slash failure and its fix were both observed there, not inferred.
vitest run(44 tests),tsc --noEmitand prettier pass.Fixes #3140