fix(qc): dispatch TTS+render for source-only jobs when accessible_video_mp4 is requested

When EN is approved on a source-only job (no target languages), the translation
branch was skipped entirely, leaving the accessible video render pipeline never
dispatched. Added elif branch: if accessible_video_mp4 is requested and there
are no target languages to translate, dispatch translate_and_synthesize_task
(which will skip translation, run TTS for source language, and dispatch the
render task).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-05-08 16:58:39 +01:00
parent 36b3b3e47c
commit 39a9d62b06

View file

@ -726,6 +726,33 @@ async def approve_language(
return LanguageQCState(**updated_state)
except Exception as exc:
logger.error(f"Job {job_id}: failed to dispatch translation after EN approval: {exc}")
elif (refreshed.get("requested_outputs") or {}).get("accessible_video_mp4"):
# Source-only job requesting accessible video: no translation needed,
# but TTS+render pipeline must run to produce the accessible MP4.
try:
from ..services.cloud_run_dispatch import dispatch as _cr_dispatch
await db[_JOBS].update_one(
{"_id": job_id},
{
"$set": {
"status": JobStatus.TRANSLATING.value,
"updated_at": datetime.utcnow(),
},
"$push": {
"review.history": {
"at": datetime.utcnow(),
"status": JobStatus.TRANSLATING.value,
"by": "system",
"notes": "EN approved — dispatching TTS and accessible video render (source-only)",
}
},
},
)
await _cr_dispatch("translate", job_id)
logger.info(f"Job {job_id}: EN approved (source-only), dispatched TTS+render pipeline")
return LanguageQCState(**updated_state)
except Exception as exc:
logger.error(f"Job {job_id}: failed to dispatch TTS+render after EN approval: {exc}")
await _maybe_advance_job(db, refreshed)