Commit 83c34e7
authored
fix(transcription): resolve three deepsec transcription-pipeline bugs (#224)
* fix(transcription): don't save failed chunks as a completed transcript
A chunk that exhausted its retries wrote an "[Error transcribing chunk N]"
placeholder and was counted as completed, and buildTranscriptBody only
rejected a fully-empty body. A transcript made of error placeholders was
therefore saved as "completed", and the existence check then blocked any
retry, leaving the user with a corrupt transcript and no easy way to re-run.
transcribeChunks now reports how many chunks failed. buildTranscriptBody
strips the error placeholders to decide whether any real speech was
transcribed: if nothing real remains (every chunk failed, or the only
successes were empty) it throws, so no file is written and the episode stays
retryable - mirroring the diarization provider's all-chunks-failed contract.
When some chunks fail but real speech remains, the transcript is kept and a
warning notice reports the partial failure instead of a clean success.
Fixes deepsec finding other-silent-failure.
* fix(transcription): decode container/lossless audio to WAV before splitting
createChunkFiles only routed m4a over the decode+WAV path; every other
format over the 20 MB request limit fell through to raw byte-splitting. MP3
frames are self-synchronizing so that is fine, but container/header-dependent
formats (ogg, webm, flac, wav, m4a) carry codec setup only at the stream
start, so non-first byte slices are undecodable and the API rejects or
garbles them.
Restrict raw byte-splitting to MP3; route every other format through the
existing decode+WAV re-encode path. When WAV conversion yields nothing (no
Web Audio decoder, or an undecodable codec) throw a clear error rather than
byte-splitting a container into corrupt chunks, keeping the run retryable.
Fixes deepsec finding other-logic-bug (audioChunker).
* fix(diarization): insert speaker labels verbatim in formatSpeakerLabel
formatSpeakerLabel passed the speaker label as the replacement string to
String.replace, which interprets special patterns ($$, $&, $`, $', $n). A
label containing one of those would be rewritten with matched/surrounding
text instead of inserted literally. Use a replacer function so the label is
inserted verbatim.
Fixes deepsec finding other-logic-bug (diarization segments).1 parent 053d51f commit 83c34e7
6 files changed
Lines changed: 378 additions & 35 deletions
File tree
- src/services
- diarization
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
197 | 210 | | |
198 | 211 | | |
199 | 212 | | |
| |||
205 | 218 | | |
206 | 219 | | |
207 | 220 | | |
208 | | - | |
| 221 | + | |
209 | 222 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 223 | + | |
219 | 224 | | |
220 | 225 | | |
221 | 226 | | |
| |||
231 | 236 | | |
232 | 237 | | |
233 | 238 | | |
234 | | - | |
235 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
236 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
237 | 366 | | |
238 | 367 | | |
239 | 368 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
168 | 176 | | |
169 | 177 | | |
170 | 178 | | |
171 | | - | |
| 179 | + | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
| |||
182 | 190 | | |
183 | 191 | | |
184 | 192 | | |
185 | | - | |
| 193 | + | |
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
| |||
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
204 | 221 | | |
205 | 222 | | |
206 | 223 | | |
207 | 224 | | |
208 | | - | |
| 225 | + | |
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
| |||
217 | 234 | | |
218 | 235 | | |
219 | 236 | | |
220 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
221 | 240 | | |
222 | 241 | | |
223 | 242 | | |
224 | 243 | | |
225 | 244 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
231 | 261 | | |
232 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
233 | 272 | | |
234 | 273 | | |
235 | 274 | | |
| |||
269 | 308 | | |
270 | 309 | | |
271 | 310 | | |
272 | | - | |
| 311 | + | |
273 | 312 | | |
274 | 313 | | |
275 | 314 | | |
| 315 | + | |
276 | 316 | | |
277 | 317 | | |
278 | 318 | | |
| |||
308 | 348 | | |
309 | 349 | | |
310 | 350 | | |
311 | | - | |
| 351 | + | |
| 352 | + | |
312 | 353 | | |
313 | 354 | | |
314 | 355 | | |
| |||
329 | 370 | | |
330 | 371 | | |
331 | 372 | | |
332 | | - | |
| 373 | + | |
333 | 374 | | |
334 | 375 | | |
335 | 376 | | |
| |||
0 commit comments