From f4f0f6af772d53ba95bf9be8add2658af621ff9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrew=20Beveridge=20=E2=98=84=EF=B8=8F?= Date: Thu, 19 Nov 2026 16:12:58 -0500 Subject: [PATCH] feat(review): only show the review button once the job is fully prepared (v0.298.0) (#1273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary The review button now appears only once a job is fully prepared: stems separated, auto-approval re-scored with them, AI lyric corrections generated and applied on the server, and review audio + waveforms cached. The browser no longer applies AI corrections by itself, so there is one code path. Prompted by job ae995697 (a Made For You order): the review button showed at 18:29, but the stems, backing verdict and vocal waveform only existed from 18:32, and the server pre-apply had aborted on a duplicate-word check, leaving the browser to apply corrections on load. ## Changes - **Hold every job until stems land** (`review_gate.route_after_scoring`). Before, only jobs whose lyrics would auto-ship were held, so Made For You and lyrics-gated jobs opened review early. Same kill switch (`AUTO_APPROVAL_AUDIO_HOLD_ENABLED`) and 20-minute backstop. - **Generate AI suggestions on the API service before parking.** The hold is released inside the audio-separation job, which has no LLM credentials, so that job only applies an existing cache. - **`enter_human_review` prepares everything before AWAITING_REVIEW**: pre-apply (generating on a cache miss), then `review_assets.prepare_review_assets` (OGG transcodes, backing waveform, vocal peak envelope), then the transition. - **Non-strict pre-apply for human review** (`build_applied_segments(strict=False)`): what "Accept All" produces. Stale/duplicate signals are recorded as `warnings`. The auto-ship path stays strict. - **Removed the browser's on-load auto-run/auto-apply** from `useAutoCorrect`. - **Job card shows "[5/10] Preparing review"** while held (new summary field + 33 locales). - Docs: ARCHITECTURE review-gate step, `docs/archive/2026-11-19-review-ready-gate.md`. Trade-off: Made For You and lyrics-gated jobs reach review (and send the review-ready notification) ~3 minutes later. ## Testing - Backend unit suite: 7294 passed. Locally failing: 8 emulator-integration tests (something unrelated listens on :8080 so they don't skip; CI runs them against real emulators) and 1 locale test that tripped on a gitignored translation snapshot (passes once removed). - New/updated tests: review gate (review-verdict jobs held, kill switch, prepare-before-transition order, suggestions generated before parking, no double wait, missing job), non-strict apply, duplicate-word pre-apply (ae995697 case), review_assets. - Frontend Jest: 1834 passed; no type errors in touched files. - Local CodeRabbit: 2 minor findings fixed, re-review clean. @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012RYLVVdAxGitbw1FhYP4e4 --------- Co-authored-by: Claude Opus 5.5 --- backend/api/routes/jobs.py | 1 + backend/config.py | 6 +- backend/services/auto_approval/apply.py | 37 ++++-- backend/services/auto_approval/pre_apply.py | 44 ++++--- backend/services/auto_approval/review_gate.py | 117 ++++++++++++----- backend/services/firestore_service.py | 1 + backend/services/job_manager.py | 4 +- backend/services/review_assets.py | 86 +++++++++++++ .../services/auto_approval/test_apply.py | 44 +++++++ .../services/auto_approval/test_pre_apply.py | 21 +++- .../auto_approval/test_review_gate.py | 119 ++++++++++++++++-- backend/tests/services/test_review_assets.py | 72 +++++++++++ .../tests/test_screens_worker_review_hold.py | 23 +++- backend/workers/screens_worker.py | 73 +---------- docs/ARCHITECTURE.md | 10 ++ docs/archive/2026-11-19-review-ready-gate.md | 57 +++++++++ .../lyrics-review/AutoCorrectPanel.tsx | 2 +- .../lyrics-review/LyricsAnalyzer.tsx | 28 ++--- .../useAutoCorrect.preapplied.test.ts | 10 -- frontend/hooks/useAutoCorrect.ts | 66 ++-------- frontend/lib/job-status.ts | 13 ++ frontend/messages/ar.json | 3 +- frontend/messages/ca.json | 3 +- frontend/messages/cs.json | 3 +- frontend/messages/da.json | 3 +- frontend/messages/de.json | 3 +- frontend/messages/el.json | 3 +- frontend/messages/en.json | 3 +- frontend/messages/es.json | 3 +- frontend/messages/fi.json | 3 +- frontend/messages/fr.json | 3 +- frontend/messages/he.json | 3 +- frontend/messages/hi.json | 3 +- frontend/messages/hr.json | 3 +- frontend/messages/hu.json | 3 +- frontend/messages/id.json | 3 +- frontend/messages/it.json | 3 +- frontend/messages/ja.json | 3 +- frontend/messages/ko.json | 3 +- frontend/messages/ms.json | 3 +- frontend/messages/nb.json | 3 +- frontend/messages/nl.json | 3 +- frontend/messages/pl.json | 3 +- frontend/messages/pt.json | 3 +- frontend/messages/ro.json | 3 +- frontend/messages/ru.json | 3 +- frontend/messages/sk.json | 3 +- frontend/messages/sv.json | 3 +- frontend/messages/th.json | 3 +- frontend/messages/tl.json | 3 +- frontend/messages/tr.json | 3 +- frontend/messages/uk.json | 3 +- frontend/messages/vi.json | 3 +- frontend/messages/zh.json | 3 +- pyproject.toml | 2 +- 55 files changed, 658 insertions(+), 277 deletions(-) create mode 100644 backend/services/review_assets.py create mode 100644 backend/tests/services/test_review_assets.py create mode 100644 docs/archive/2026-11-19-review-ready-gate.md diff --git a/backend/api/routes/jobs.py b/backend/api/routes/jobs.py index e4330521..350fcd86 100644 --- a/backend/api/routes/jobs.py +++ b/backend/api/routes/jobs.py @@ -566,6 +566,7 @@ _SUMMARY_STATE_DATA_KEYS = { 'brand_code', 'youtube_url', 'dropbox_link', 'audio_progress', 'lyrics_progress', 'audio_complete', 'lyrics_complete', + 'auto_review_waiting_for_stems', 'backing_vocals_analysis', 'visibility_change_in_progress', 'render_pending_capacity', 'cloud_run_retry_pending', diff --git a/backend/config.py b/backend/config.py index cd43606f..5f19ff12 100644 --- a/backend/config.py +++ b/backend/config.py @@ -177,9 +177,9 @@ class Settings(BaseSettings): "AUTO_APPROVAL_TIMING_GATE_ENABLED", "true" ).lower() in ("true", "1", "yes") - # Review hold: when the lyrics would auto-ship but stems are still - # separating, keep the job out of review until the audio-worker re-score - # (backend/services/auto_approval/review_gate.py). Code-level default for + # Review hold: when stems are still separating after lyrics finish, keep + # the job out of review until the audio-worker re-score has run and the + # review is fully prepared (backend/services/auto_approval/review_gate.py). Code-level default for # the same two-environment reason as above. Kill switch: false. auto_approval_audio_hold_enabled: bool = os.getenv( "AUTO_APPROVAL_AUDIO_HOLD_ENABLED", "true" diff --git a/backend/services/auto_approval/apply.py b/backend/services/auto_approval/apply.py index 2c0cf4ed..c1d9a0ba 100644 --- a/backend/services/auto_approval/apply.py +++ b/backend/services/auto_approval/apply.py @@ -284,23 +284,38 @@ def apply_all_suggestions( def build_applied_segments( - corrections: Dict[str, Any], ai_suggestions: Optional[List[Suggestion]] + corrections: Dict[str, Any], + ai_suggestions: Optional[List[Suggestion]], + *, + strict: bool = True, ) -> Dict[str, Any]: - """Apply the AI suggestions to a corrections payload with the safety gates. + """Apply the AI suggestions to a corrections payload. - Shared by the executor (auto-complete) and the review-gate pre-apply. Returns - ``{"aborted": }`` on any anomaly (caller falls back to human review / - client-side apply), else ``{"segments", "applied_ids", "rejected_ids"}``. + ``strict=True`` (the executor's auto-complete path): any anomaly returns + ``{"aborted": }`` so the job falls back to human review. + + ``strict=False`` (the pre-apply that runs before a HUMAN opens review): + apply exactly what the reviewer would have got from "Accept All". Stale + suggestions are skipped and suspicious duplicates are reported in + ``warnings``, not treated as fatal, because a human reviews the result. + Before this, an abort here left the browser to apply the same suggestions + itself on load, which was a second code path (job ae995697, 2026-11-19). + + Success returns ``{"segments", "applied_ids", "rejected_ids", "undo_info", + "warnings"}``. """ segments = corrections.get("corrected_segments") or [] if not segments: return {"aborted": "no_segments"} result = apply_all_suggestions(segments, ai_suggestions or []) + warnings: List[str] = [] if result["stale_ids"]: # Nothing edits segments between generation and now, so staleness means # the cache doesn't match this corrections.json -> don't trust the apply. - return {"aborted": f"stale_suggestions:{len(result['stale_ids'])}"} + if strict: + return {"aborted": f"stale_suggestions:{len(result['stale_ids'])}"} + warnings.append(f"stale_suggestions:{len(result['stale_ids'])}") new_segments = result["segments"] if not new_segments or any(not (s.get("words") or []) for s in new_segments): @@ -309,13 +324,19 @@ def build_applied_segments( duplicates = find_suspicious_duplicates(new_segments, corrections.get("reference_lyrics")) if duplicates: # P1 signature: overlapping suggestions doubled a word ("you're you're"). - return {"aborted": f"duplicate_words:{','.join(duplicates[:5])}"} + reason = f"duplicate_words:{','.join(duplicates[:5])}" + if strict: + return {"aborted": reason} + warnings.append(reason) return { "segments": new_segments, "applied_ids": result["applied_ids"], - "rejected_ids": result["rejected_ids"], + # Stale suggestions were not applied: report them as rejected so the + # review panel shows them as not-applied rather than pending. + "rejected_ids": result["rejected_ids"] + result["stale_ids"], "undo_info": result["undo_info"], + "warnings": warnings, } diff --git a/backend/services/auto_approval/pre_apply.py b/backend/services/auto_approval/pre_apply.py index b3f61a9c..9fa145ff 100644 --- a/backend/services/auto_approval/pre_apply.py +++ b/backend/services/auto_approval/pre_apply.py @@ -3,19 +3,22 @@ Andrew's directive (2026-08-29): *"apply the ai-generated lyrics corrections and any post-ai heuristic fixes before the user ever sees the notification/button saying the lyrics review is ready ... it should all be done server-side and loaded as a single -load event when the lyrics review page launches."* +load event when the lyrics review page launches."* Reaffirmed 2026-11-19: *"i want +the ai corrections to always be processed before i open the review page"*, with no +second, in-browser code path. -Called from ``screens_worker`` for review-bound jobs (i.e. when the executor did NOT -auto-complete the whole job), just before the AWAITING_REVIEW transition. It applies -the same cached suggestions the review UI would auto-apply on load, using the same -machinery the executor uses (``apply.build_applied_segments``), and writes -``corrections_updated.json`` with a ``pre_applied`` marker so the ``/correction-data`` -endpoint serves the already-corrected state in a single load — eliminating the -in-browser auto-apply race. +Called from ``review_gate.enter_human_review`` just before the AWAITING_REVIEW +transition, and from ``/correction-data`` for jobs that reached review before this +existed. It applies the cached suggestions with the same machinery the executor uses +(``apply.build_applied_segments``, non-strict: what "Accept All" would produce) and +writes ``corrections_updated.json`` with a ``pre_applied`` marker, so the review page +loads the corrected lyrics in one load. The review UI never applies suggestions by +itself any more. -BEST-EFFORT: never raises, bounded. On any miss (proactive disabled, cache absent, -LLM outage, sanity-check abort) it simply does nothing and the review UI falls back to -its existing client-side on-load auto-apply. Auto-approval must never strand a job. +BEST-EFFORT: never raises, bounded. If no suggestions can be had (proactive +disabled, LLM outage) it does nothing, and the review opens with the uncorrected +lyrics; the reviewer can still run the AI panel by hand. Auto-approval must never +strand a job. """ from __future__ import annotations @@ -38,8 +41,7 @@ async def ensure_and_pre_apply(job_id: str, *, generate_on_miss: bool = True) -> ``generate_on_miss`` (default True, the screens_worker path): when the proactive cache is absent, generate it synchronously (bounded) before applying. The ``/correction-data`` load path passes False — it only applies an EXISTING cache - so a review page never blocks on a multi-model LLM call; a cache-miss there - falls through to the UI's own client-side apply. + so a review page never blocks on a multi-model LLM call. """ try: from backend.config import get_settings @@ -81,15 +83,20 @@ async def ensure_and_pre_apply(job_id: str, *, generate_on_miss: bool = True) -> ai_suggestions = await asyncio.to_thread(_load_ai_suggestions, storage, job_id) if ai_suggestions is None: - # Unknown suggestion set (proactive disabled or generation failed) — - # do NOT mark pre_applied; let the UI run its client-side apply. + # Unknown suggestion set (proactive disabled or generation failed): + # do NOT mark pre_applied; review opens with the uncorrected lyrics. return {"outcome": "skipped", "reason": "no_suggestions_cache"} - # 2) Apply with the executor's sanity gates. - result = await asyncio.to_thread(build_applied_segments, corrections, ai_suggestions) + # 2) Apply exactly what "Accept All" would. Non-strict: a human reviews + # the result, so stale/duplicate signals are warnings, not aborts. + result = await asyncio.to_thread( + lambda: build_applied_segments(corrections, ai_suggestions, strict=False) + ) if result.get("aborted"): - logger.info(f"[job:{job_id}] pre-apply aborted ({result['aborted']}) — UI will apply client-side") + logger.warning(f"[job:{job_id}] pre-apply could not apply ({result['aborted']})") return {"outcome": "skipped", "reason": result["aborted"]} + if result.get("warnings"): + logger.info(f"[job:{job_id}] pre-apply warnings: {result['warnings']}") # 3) Persist corrections_updated.json with the pre_applied marker + the # suggestions themselves (so the review panel renders applied state). @@ -105,6 +112,7 @@ async def ensure_and_pre_apply(job_id: str, *, generate_on_miss: bool = True) -> # UI can still revert an individual pre-applied correction even # though it never applied it client-side itself. "undo_info": result["undo_info"], + "warnings": result.get("warnings") or [], "applied_at": datetime.now(timezone.utc).isoformat(), } updated["metadata"] = metadata diff --git a/backend/services/auto_approval/review_gate.py b/backend/services/auto_approval/review_gate.py index c6f57c1c..2b3466f0 100644 --- a/backend/services/auto_approval/review_gate.py +++ b/backend/services/auto_approval/review_gate.py @@ -1,20 +1,30 @@ -"""Review gate: hold confident-lyrics jobs out of review until stems land. +"""Review gate: a job only reaches review once it is fully prepared. -Lyrics finish ~2-3 min before stem separation. When the screens worker scores a -job whose lyrics would auto-ship but whose stems aren't ready, opening review -right away loses the auto-ship: users open the editor within seconds -(AWAITING_REVIEW -> IN_REVIEW), so the audio worker's re-score finds a human in -the editor and backs off. Prod 2026-08-31..10-29: 109/340 jobs were last scored -without stems, so they never got a backing verdict, and lyrics-auto jobs went to -a human anyway. +"Fully prepared" (Andrew, 2026-11-19: *"i want the review button to only appear +when a job is 'fully prepared', including with the ai corrections and the lead +vocal waveform images ready to load"*) means, before AWAITING_REVIEW: -So for those jobs the screens worker parks the job in GENERATING_SCREENS with +1. audio separation has finished, so the stems, the backing-vocals analysis and + the stem-based checks (timing, vocal gaps) exist; +2. the auto-approval scorer has run with all of that, and either shipped the job + or sent it to a human; +3. the AI lyric corrections have been generated and applied server-side + (``pre_apply.ensure_and_pre_apply``; the browser never applies them itself); +4. the review audio transcodes and both review waveforms are cached + (``review_assets.prepare_review_assets``). + +Lyrics usually finish 2-3 min before the stems. Any job whose stems aren't ready +when the screens worker finishes is parked in GENERATING_SCREENS with ``state_data.auto_review_waiting_for_stems`` set (no review link, no -notification). Whoever atomically claims that flag re-scores and routes the job: -the audio worker once stems land (normal case), the screens worker itself if the -stems landed while it was parking, or recover_stuck_jobs after -``AUDIO_HOLD_TIMEOUT_SECONDS`` (backstop). The re-score either auto-completes -the review or opens human review exactly like the non-held path. +notification). Until 2026-11-19 only jobs whose lyrics would auto-ship were held; +everything else (including every Made For You order) opened review straight +away, before the stems, the backing verdict or the vocal waveform existed. + +Whoever atomically claims that flag re-scores and routes the job: the audio +worker once stems land (normal case), the screens worker itself if the stems +landed while it was parking, or recover_stuck_jobs after +``AUDIO_HOLD_TIMEOUT_SECONDS`` (backstop). The re-score either auto-completes the +review or opens human review via ``enter_human_review``. """ import logging @@ -33,23 +43,31 @@ AUDIO_HOLD_TIMEOUT_SECONDS = 20 * 60 async def enter_human_review( job_id: str, job_log: Optional[logging.Logger] = None, job_manager=None ) -> None: - """Pre-apply AI corrections server-side, then open the combined review.""" + """Apply AI corrections and prepare review assets, then open the review.""" from backend.services.auto_approval.pre_apply import ensure_and_pre_apply from backend.services.job_manager import JobManager + from backend.services.review_assets import prepare_review_assets + + job_manager = job_manager or JobManager() # Apply the AI corrections + heuristic fixes BEFORE the review-ready - # notification fires, so the review screen loads one final state (no - # in-browser auto-apply race). Best-effort + bounded: on any miss the UI - # falls back to its client-side on-load apply. + # notification fires, so the review screen loads one final state. + # Best-effort + bounded (generates the suggestions on a cache miss). pre_apply_result = await ensure_and_pre_apply(job_id) if pre_apply_result.get("outcome") == "pre_applied" and job_log: job_log.info( f"Pre-applied {pre_apply_result.get('applied', 0)} AI corrections " "server-side before review notification" ) + elif pre_apply_result.get("reason") not in ("already_applied", "corrections_updated_exists"): + logger.warning(f"[job:{job_id}] Opening review without pre-applied AI corrections: " + f"{pre_apply_result}") + + # Stem transcodes + backing waveform + vocal peaks, so the page paints at once. + await prepare_review_assets(job_id, job_manager, job_log) logger.info(f"[job:{job_id}] Screens generated, awaiting combined review") - (job_manager or JobManager()).transition_to_state( + job_manager.transition_to_state( job_id=job_id, new_status=JobStatus.AWAITING_REVIEW, progress=55, @@ -73,14 +91,24 @@ async def route_after_scoring( auto_result = await _rescore_if_suggestions_were_missing(job_id, auto_result, job_log) if auto_result.get("outcome") in ("auto_completed", "wrong_status"): return str(auto_result["outcome"]) - if not auto_result.get("hold_for_audio"): + job = job_manager.get_job(job_id) + if not job: + return "wrong_status" + if _stems_ready(job) or not _audio_hold_enabled(): await enter_human_review(job_id, job_log, job_manager) return "review" + # The hold is usually released by the audio-separation job, which has no LLM + # credentials: make sure the AI suggestions exist now, on the API service, + # so the release only has to apply them. + if (auto_result.get("ai_suggestions_available") is False + and not auto_result.get("ai_generation_attempted")): + await _generate_ai_suggestions(job_id) + job_manager.park_review_for_auto_check(job_id) fresh = job_manager.get_job(job_id) - if fresh and not (fresh.state_data or {}).get("audio_complete", False): - msg = "Lyrics look auto-approvable: holding review until audio separation finishes" + if fresh and not _stems_ready(fresh): + msg = "Holding review until audio separation finishes" logger.info(f"[job:{job_id}] {msg}") if job_log: job_log.info(msg) @@ -94,6 +122,36 @@ async def route_after_scoring( return "released_elsewhere" +async def _generate_ai_suggestions(job_id: str) -> bool: + """Generate (or join the in-flight generation of) the AI suggestion cache. + + Bounded (180s) and best-effort. False when proactive generation is off or + the attempt raised; the cache may still be missing after True (LLM outage). + """ + from backend.config import get_settings + + if not getattr(get_settings(), "auto_correct_proactive_enabled", False): + return False + try: + from backend.workers.auto_correct_worker import process_proactive_auto_correct + + await process_proactive_auto_correct(job_id) # bounded (180s), joins a run in flight + except Exception as e: # noqa: BLE001 best-effort, like ensure_and_pre_apply + logger.warning(f"[job:{job_id}] Waiting for AI suggestions before review failed: {e}") + return False + return True + + +def _stems_ready(job) -> bool: + return bool(job and (job.state_data or {}).get("audio_complete", False)) + + +def _audio_hold_enabled() -> bool: + from backend.config import get_settings + + return bool(getattr(get_settings(), "auto_approval_audio_hold_enabled", True)) + + async def _rescore_if_suggestions_were_missing( job_id: str, auto_result: Dict[str, Any], job_log: Optional[logging.Logger] = None ) -> Dict[str, Any]: @@ -109,18 +167,10 @@ async def _rescore_if_suggestions_were_missing( if auto_result.get("outcome") != "review" or auto_result.get("ai_suggestions_available") is not False: return auto_result - from backend.config import get_settings from backend.services.auto_approval.executor import maybe_auto_complete_review - if not getattr(get_settings(), "auto_correct_proactive_enabled", False): - return auto_result - try: - from backend.workers.auto_correct_worker import process_proactive_auto_correct - - await process_proactive_auto_correct(job_id) # bounded (180s), joins a run in flight - except Exception as e: # noqa: BLE001 best-effort, like ensure_and_pre_apply - logger.warning(f"[job:{job_id}] Waiting for AI suggestions before review failed: {e}") - return auto_result + if not await _generate_ai_suggestions(job_id): + return {**auto_result, "ai_generation_attempted": True} rescored = await maybe_auto_complete_review(job_id, trigger="screens_worker") outcome = rescored.get("outcome") @@ -128,7 +178,8 @@ async def _rescore_if_suggestions_were_missing( f"(hold_for_audio={rescored.get('hold_for_audio', False)})") if outcome == "auto_completed" and job_log: job_log.info("Auto-approved once AI suggestions were ready: review skipped") - return rescored if outcome in ("review", "auto_completed", "wrong_status") else auto_result + chosen = rescored if outcome in ("review", "auto_completed", "wrong_status") else auto_result + return {**chosen, "ai_generation_attempted": True} async def release_audio_hold(job_id: str, reason: str) -> Optional[str]: diff --git a/backend/services/firestore_service.py b/backend/services/firestore_service.py index 20e4b583..422f1594 100644 --- a/backend/services/firestore_service.py +++ b/backend/services/firestore_service.py @@ -331,6 +331,7 @@ class FirestoreService: 'state_data.brand_code', 'state_data.youtube_url', 'state_data.dropbox_link', 'state_data.audio_progress', 'state_data.lyrics_progress', 'state_data.audio_complete', 'state_data.lyrics_complete', + 'state_data.auto_review_waiting_for_stems', 'state_data.backing_vocals_analysis', 'state_data.visibility_change_in_progress', 'state_data.render_pending_capacity', 'state_data.cloud_run_retry_pending', diff --git a/backend/services/job_manager.py b/backend/services/job_manager.py index 0ac42ed2..0500a016 100644 --- a/backend/services/job_manager.py +++ b/backend/services/job_manager.py @@ -1559,10 +1559,10 @@ class JobManager: AUTO_REVIEW_HOLD_KEY = 'auto_review_waiting_for_stems' def park_review_for_auto_check(self, job_id: str) -> None: - """Record that review is held until stems land for the auto-approval re-score.""" + """Record that review is held until stems land and the review is prepared.""" self.update_job(job_id, { f'state_data.{self.AUTO_REVIEW_HOLD_KEY}': datetime.utcnow().isoformat(), - 'message': 'Lyrics look good: finishing automatic checks once audio separation is done', + 'message': 'Preparing review: waiting for audio separation and automatic checks', }) def claim_auto_review_hold(self, job_id: str) -> bool: diff --git a/backend/services/review_assets.py b/backend/services/review_assets.py new file mode 100644 index 00000000..f5bfaf32 --- /dev/null +++ b/backend/services/review_assets.py @@ -0,0 +1,86 @@ +"""Everything the review page loads, prepared before the review button appears. + +The review page plays OGG transcodes of the input audio and stems, draws the +backing-vocals waveform (``/waveform-data``) and the per-segment vocal waveform +strips (``/vocals-peaks``). Each endpoint can compute its asset on a cache miss, +but that costs the reviewer seconds of waiting and the API instance seconds of +CPU. ``prepare_review_assets`` fills every cache up front. + +It runs twice per job: in the screens worker (often before the stems exist, so +only the input-audio assets can be made), and again in +``review_gate.enter_human_review`` right before AWAITING_REVIEW, once the stems +have landed. The second run is mostly cache hits; the stem-based waveforms are +what it adds. Non-fatal throughout: every endpoint still works lazily. +""" +import asyncio +import logging +from typing import Optional + +logger = logging.getLogger(__name__) + +REVIEW_WAVEFORM_POINTS = 1000 +VOCALS_PEAKS_PER_SECOND = 400 + + +async def prepare_review_assets(job_id: str, job_manager=None, job_log: Optional[logging.Logger] = None) -> None: + """Transcode review audio and pre-compute both review waveforms. Never raises.""" + from backend.services.audio_transcoding_service import AudioTranscodingService + from backend.services.job_manager import JobManager + + log = job_log or logger + job_manager = job_manager or JobManager() + try: + job = await asyncio.to_thread(job_manager.get_job, job_id) + if not job: + log.warning(f"Could not get job {job_id} for review asset preparation") + return + + # GCS download of up to 4 ~35MB FLACs + an ffmpeg transcode each (7-15s + # apiece) — this ran ON the event loop and froze the whole instance for + # 10-45s per job (2026-10-03 analysis). Run it in a worker thread. + transcoding = AudioTranscodingService() + try: + transcoded = await asyncio.to_thread(transcoding.prepare_review_audio_for_job, job) + log.info(f"Review audio transcoding complete: {len(transcoded)} files") + except Exception as e: + # The waveforms below don't depend on it: carry on. + log.warning(f"Review audio transcoding failed (non-fatal): {e}") + + # The first import pulls in numpy/pydub/matplotlib (seconds of CPU on a + # fresh instance) — import it in a worker thread, not on the loop. + def _import_audio_analysis(): + from backend.services.audio_analysis_service import AudioAnalysisService + return AudioAnalysisService + + AudioAnalysisService = await asyncio.to_thread(_import_audio_analysis) + + # Same source choice as GET /waveform-data: backing vocals, else the input. + stems = job.file_urls.get("stems", {}) if job.file_urls else {} + waveform_source = stems.get("backing_vocals") or job.input_media_gcs_path + if waveform_source: + try: + await asyncio.to_thread( + AudioAnalysisService().get_review_waveform, + waveform_source, job_id, REVIEW_WAVEFORM_POINTS, transcoding, + ) + log.info("Review waveform data pre-computed") + except Exception as e: + log.warning(f"Review waveform pre-compute failed (non-fatal): {e}") + + # Vocal peak envelope for the per-segment waveform strips (needs a stem). + from backend.utils.stems import vocals_stem_path + + vocals_source = vocals_stem_path(job) + if vocals_source: + try: + await asyncio.to_thread( + AudioAnalysisService().get_vocals_peaks, + vocals_source, job_id, VOCALS_PEAKS_PER_SECOND, transcoding, + ) + log.info("Vocals peak envelope pre-computed") + except Exception as e: + log.warning(f"Vocals peaks pre-compute failed (non-fatal): {e}") + + except Exception as e: + log.warning(f"Review asset preparation failed (non-fatal): {e}") + logger.warning(f"Job {job_id}: Review asset preparation failed: {e}") diff --git a/backend/tests/services/auto_approval/test_apply.py b/backend/tests/services/auto_approval/test_apply.py index 9c1942bd..85320216 100644 --- a/backend/tests/services/auto_approval/test_apply.py +++ b/backend/tests/services/auto_approval/test_apply.py @@ -11,6 +11,7 @@ from typing import Any, Dict, List from backend.services.auto_approval.apply import ( apply_all_suggestions, apply_suggestion, + build_applied_segments, find_suspicious_duplicates, is_suggestion_stale, pick_accept_all_winners, @@ -245,3 +246,46 @@ def test_duplicates_supported_by_reference_are_ok() -> None: refs = {"genius": {"segments": [{"text": "Hey hey you"}]}} assert find_suspicious_duplicates(segments, refs) == [] assert find_suspicious_duplicates(segments, {}) == ["hey"] + + +# --- build_applied_segments: strict (auto-ship) vs non-strict (human review) --- + + +def _p1_conflict() -> List[Dict[str, Any]]: + return [_sug("insert_after", ["w3"], "you're", id="a"), + _sug("replace", ["w3"], "fire, you're", id="b")] + + +def test_strict_aborts_on_duplicates() -> None: + out = build_applied_segments({"corrected_segments": _segments()}, _p1_conflict()) + assert out["aborted"].startswith("duplicate_words:") + + +def test_non_strict_applies_duplicates_as_warning() -> None: + """Human-review pre-apply: same result as the UI's "Accept All", plus a warning.""" + out = build_applied_segments({"corrected_segments": _segments()}, _p1_conflict(), strict=False) + assert "aborted" not in out + assert out["applied_ids"] == ["a", "b"] + assert out["warnings"] == ["duplicate_words:you're"] + + +def test_strict_aborts_on_stale() -> None: + out = build_applied_segments({"corrected_segments": _segments()}, + [_sug("replace", ["nope"], "x", id="a")]) + assert out["aborted"] == "stale_suggestions:1" + + +def test_non_strict_skips_stale_and_applies_the_rest() -> None: + out = build_applied_segments( + {"corrected_segments": _segments()}, + [_sug("replace", ["nope"], "x", id="stale"), _sug("replace", ["w3"], "flame", id="ok")], + strict=False, + ) + assert out["applied_ids"] == ["ok"] + assert "stale" in out["rejected_ids"] + assert out["warnings"] == ["stale_suggestions:1"] + assert out["segments"][0]["words"][3]["text"] == "flame" + + +def test_non_strict_still_aborts_without_segments() -> None: + assert build_applied_segments({"corrected_segments": []}, [], strict=False) == {"aborted": "no_segments"} diff --git a/backend/tests/services/auto_approval/test_pre_apply.py b/backend/tests/services/auto_approval/test_pre_apply.py index 2c995314..c9a8ab31 100644 --- a/backend/tests/services/auto_approval/test_pre_apply.py +++ b/backend/tests/services/auto_approval/test_pre_apply.py @@ -2,8 +2,8 @@ ``ensure_and_pre_apply`` applies the cached AI suggestions BEFORE the review-ready notification and writes ``corrections_updated.json`` with a ``pre_applied`` marker. -It is best-effort: any miss leaves corrections_updated absent so the review UI falls -back to its client-side on-load auto-apply. +It is best-effort: if no suggestions can be had it leaves corrections_updated absent +and the review opens uncorrected (the UI never applies suggestions by itself). """ from __future__ import annotations @@ -206,3 +206,20 @@ async def test_pre_apply_raced_concurrent_write_does_not_clobber(): assert result["reason"] == "raced_concurrent_write" # The concurrent writer's content is untouched. assert storage._files[UPD]["metadata"] == {} + + +@pytest.mark.asyncio +async def test_pre_apply_applies_despite_duplicate_words(): + """Job ae995697: a "ne ne ne ne ne" duplicate aborted the pre-apply and left the + browser to apply the same suggestions. Human review now gets them server-side, + with the duplicate recorded as a warning.""" + corrections = _corrections() + corrections["corrected_segments"][0]["words"][2]["text"] = "ne" + dup = dict(_replace_suggestion(), id="dup", word_ids=["w1"], original_text="amateur", + new_text="ne") + storage = _FakeStorage({CORR: corrections, CACHE: {"suggestions": [dup]}}) + result, _, _gen = await _run(storage) + assert result["outcome"] == "pre_applied" + aa = storage.uploads[UPD]["metadata"]["auto_approval"] + assert aa["applied_suggestion_ids"] == ["dup"] + assert aa["warnings"] == ["duplicate_words:ne"] diff --git a/backend/tests/services/auto_approval/test_review_gate.py b/backend/tests/services/auto_approval/test_review_gate.py index ed874efe..b4dbeebd 100644 --- a/backend/tests/services/auto_approval/test_review_gate.py +++ b/backend/tests/services/auto_approval/test_review_gate.py @@ -1,6 +1,6 @@ -"""Tests for the review gate: holding lyrics-confident jobs out of review until -stems land, and releasing them exactly once (audio worker / screens worker race / -stuck-job sweep).""" +"""Tests for the review gate: holding every job out of review until stems land +and the review is fully prepared, and releasing it exactly once (audio worker / +screens worker race / stuck-job sweep).""" from __future__ import annotations from datetime import datetime, timedelta @@ -20,8 +20,12 @@ def _job(status=JobStatus.GENERATING_SCREENS, **state): def _jm(*jobs, claim=True): + """Job manager whose get_job returns ``jobs`` in order (default: stems ready).""" jm = MagicMock() - jm.get_job.side_effect = list(jobs) + if jobs: + jm.get_job.side_effect = list(jobs) + else: + jm.get_job.return_value = _job(audio_complete=True) jm.claim_auto_review_hold.return_value = claim return jm @@ -33,18 +37,22 @@ def _patches(jm, auto_result=None, pre_apply=None): AsyncMock(return_value=auto_result or {"outcome": "review"})), patch("backend.services.auto_approval.pre_apply.ensure_and_pre_apply", AsyncMock(return_value=pre_apply or {"outcome": "skipped"})), + patch("backend.services.review_assets.prepare_review_assets", AsyncMock()), ) async def _call(fn, jm, *args, auto_result=None, **kwargs): - p1, p2, p3 = _patches(jm, auto_result) - with p1, p2 as auto, p3 as pre: + p1, p2, p3, p4 = _patches(jm, auto_result) + with p1, p2 as auto, p3 as pre, p4: out = await fn(*args, **kwargs) return out, auto, pre +NOT_READY = dict(audio_complete=False) + + @pytest.mark.asyncio -async def test_no_hold_opens_review_with_pre_apply() -> None: +async def test_stems_ready_opens_review_with_pre_apply() -> None: jm = _jm() out, auto, pre = await _call(review_gate.route_after_scoring, jm, "j1", {"outcome": "review"}) assert out == "review" @@ -56,7 +64,7 @@ async def test_no_hold_opens_review_with_pre_apply() -> None: @pytest.mark.asyncio async def test_hold_parks_job_without_opening_review() -> None: - jm = _jm(_job(audio_complete=False)) + jm = _jm(_job(**NOT_READY), _job(**NOT_READY)) out, auto, pre = await _call( review_gate.route_after_scoring, jm, "j1", {"outcome": "review", "hold_for_audio": True}) assert out == "held" @@ -70,7 +78,7 @@ async def test_hold_parks_job_without_opening_review() -> None: async def test_stems_landing_while_parking_rescores_immediately() -> None: # Audio finished between scoring and parking: the screens worker claims the # hold itself (the audio worker already ran its release and found no flag). - jm = _jm(_job(audio_complete=True), _job(audio_complete=True)) + jm = _jm(_job(**NOT_READY), _job(audio_complete=True), _job(audio_complete=True)) out, auto, _ = await _call( review_gate.route_after_scoring, jm, "j1", {"outcome": "review", "hold_for_audio": True}, auto_result={"outcome": "auto_completed"}) @@ -80,7 +88,7 @@ async def test_stems_landing_while_parking_rescores_immediately() -> None: @pytest.mark.asyncio async def test_stems_landing_while_parking_but_audio_worker_claimed() -> None: - jm = _jm(_job(audio_complete=True), claim=False) + jm = _jm(_job(**NOT_READY), _job(audio_complete=True), claim=False) out, auto, _ = await _call( review_gate.route_after_scoring, jm, "j1", {"outcome": "review", "hold_for_audio": True}) assert out == "released_elsewhere" @@ -140,9 +148,9 @@ def test_audio_hold_expiry() -> None: @pytest.mark.asyncio async def test_rescore_crash_after_claim_falls_back_to_review() -> None: jm = _jm(_job(), _job()) - p1, p2, p3 = _patches(jm) + p1, p2, p3, p4 = _patches(jm) with p1, patch("backend.services.auto_approval.executor.maybe_auto_complete_review", - AsyncMock(side_effect=RuntimeError("boom"))), p3: + AsyncMock(side_effect=RuntimeError("boom"))), p3, p4: out = await review_gate.release_audio_hold("j1", reason="audio_worker") assert out == "review" assert jm.transition_to_state.call_args.kwargs["new_status"] == JobStatus.AWAITING_REVIEW @@ -177,7 +185,7 @@ async def _route_without_suggestions(jm, rescored, wait=None): @pytest.mark.asyncio async def test_missing_suggestions_rescore_holds_instead_of_notifying() -> None: """Job 7f89f884: the "review your lyrics" push went out minutes before auto-approval.""" - jm = _jm(_job(audio_complete=False)) + jm = _jm(_job(**NOT_READY), _job(**NOT_READY)) out, auto, pre = await _route_without_suggestions( jm, {"outcome": "review", "hold_for_audio": True, "ai_suggestions_available": True}) assert out == "held" @@ -233,3 +241,88 @@ async def test_suggestions_present_scores_only_once() -> None: {"outcome": "review", "ai_suggestions_available": True}) assert out == "review" auto.assert_not_awaited() + + +# ---- 2026-11-19: every job is held until it is fully prepared ---- + + +@pytest.mark.asyncio +async def test_review_verdict_is_held_until_stems_land() -> None: + """Job ae995697 (a Made For You order, lyrics phantom-gated): the review button + appeared at 18:29 while the stems, backing verdict and vocal waveform only + existed from 18:32. A job a human must review is held like any other.""" + jm = _jm(_job(**NOT_READY), _job(**NOT_READY)) + out, _, pre = await _call( + review_gate.route_after_scoring, jm, "j1", + {"outcome": "review", "hold_for_audio": False, "ai_suggestions_available": True}) + assert out == "held" + jm.park_review_for_auto_check.assert_called_once_with("j1") + jm.transition_to_state.assert_not_called() + pre.assert_not_awaited() + + +@pytest.mark.asyncio +async def test_hold_kill_switch_opens_review_without_stems() -> None: + jm = _jm(_job(**NOT_READY)) + with patch("backend.config.get_settings", + return_value=SimpleNamespace(auto_approval_audio_hold_enabled=False)): + out, _, pre = await _call( + review_gate.route_after_scoring, jm, "j1", + {"outcome": "review", "ai_suggestions_available": True}) + assert out == "review" + pre.assert_awaited_once_with("j1") + jm.park_review_for_auto_check.assert_not_called() + + +@pytest.mark.asyncio +async def test_enter_human_review_prepares_everything_before_the_button() -> None: + """AI corrections are applied and the review assets cached BEFORE the + AWAITING_REVIEW transition (which is what shows the review button).""" + order = [] + jm = MagicMock() + jm.transition_to_state.side_effect = lambda **kw: order.append("transition") + pre = AsyncMock(side_effect=lambda *a, **k: order.append("pre_apply") or {"outcome": "pre_applied"}) + assets = AsyncMock(side_effect=lambda *a, **k: order.append("assets")) + with patch("backend.services.auto_approval.pre_apply.ensure_and_pre_apply", pre), \ + patch("backend.services.review_assets.prepare_review_assets", assets): + await review_gate.enter_human_review("j1", None, jm) + assert order == ["pre_apply", "assets", "transition"] + assets.assert_awaited_once_with("j1", jm, None) + + +@pytest.mark.asyncio +async def test_suggestions_generated_on_api_service_before_parking() -> None: + """The hold is released in the audio-separation job, which has no LLM + credentials, so the screens worker makes sure the suggestions exist first.""" + jm = _jm(_job(**NOT_READY), _job(**NOT_READY)) + wait = AsyncMock() + with patch("backend.workers.auto_correct_worker.process_proactive_auto_correct", wait), \ + patch("backend.config.get_settings", + return_value=SimpleNamespace(auto_correct_proactive_enabled=True)): + out, auto, _ = await _call( + review_gate.route_after_scoring, jm, "j1", + {"outcome": "auto_completed_blocked", "ai_suggestions_available": False}) + assert out == "held" + wait.assert_awaited_once_with("j1") + auto.assert_not_awaited() + + +@pytest.mark.asyncio +async def test_suggestion_generation_not_repeated_before_parking() -> None: + """When the rescore path already waited (and failed), don't wait again.""" + jm = _jm(_job(**NOT_READY), _job(**NOT_READY)) + wait = AsyncMock(side_effect=RuntimeError("llm down")) + out, _, _ = await _route_without_suggestions(jm, {"outcome": "review"}, wait=wait) + assert out == "held" + assert wait.await_count == 1 + + +@pytest.mark.asyncio +async def test_missing_job_is_not_parked_or_opened() -> None: + jm = _jm(None) + out, _, pre = await _call(review_gate.route_after_scoring, jm, "j1", + {"outcome": "review", "ai_suggestions_available": True}) + assert out == "wrong_status" + jm.park_review_for_auto_check.assert_not_called() + jm.transition_to_state.assert_not_called() + pre.assert_not_awaited() diff --git a/backend/tests/services/test_review_assets.py b/backend/tests/services/test_review_assets.py new file mode 100644 index 00000000..01a87a07 --- /dev/null +++ b/backend/tests/services/test_review_assets.py @@ -0,0 +1,72 @@ +"""prepare_review_assets: everything the review page loads is cached before review opens.""" +from types import SimpleNamespace +from unittest.mock import MagicMock, patch + +import pytest + +from backend.services.review_assets import prepare_review_assets + + +def _job(stems=None): + return SimpleNamespace( + job_id="j1", + input_media_gcs_path="jobs/j1/input/audio/song.flac", + file_urls={"stems": stems or {}}, + ) + + +async def _run(job): + jm = MagicMock() + jm.get_job.return_value = job + transcoding = MagicMock() + transcoding.prepare_review_audio_for_job.return_value = ["a.ogg"] + analysis = MagicMock() + with patch("backend.services.audio_transcoding_service.AudioTranscodingService", + return_value=transcoding), \ + patch("backend.services.audio_analysis_service.AudioAnalysisService", + return_value=analysis): + await prepare_review_assets("j1", jm) + return transcoding, analysis + + +@pytest.mark.asyncio +async def test_with_stems_caches_backing_waveform_and_vocal_peaks(): + transcoding, analysis = await _run(_job({ + "backing_vocals": "jobs/j1/stems/backing_vocals.flac", + "vocals_clean": "jobs/j1/stems/vocals_clean.flac", + })) + transcoding.prepare_review_audio_for_job.assert_called_once() + assert analysis.get_review_waveform.call_args.args[:3] == ( + "jobs/j1/stems/backing_vocals.flac", "j1", 1000) + assert analysis.get_vocals_peaks.call_args.args[:3] == ( + "jobs/j1/stems/vocals_clean.flac", "j1", 400) + + +@pytest.mark.asyncio +async def test_without_stems_uses_input_audio_and_skips_vocal_peaks(): + _, analysis = await _run(_job()) + assert analysis.get_review_waveform.call_args.args[0] == "jobs/j1/input/audio/song.flac" + analysis.get_vocals_peaks.assert_not_called() + + +@pytest.mark.asyncio +async def test_failures_are_non_fatal(): + jm = MagicMock() + jm.get_job.side_effect = RuntimeError("firestore down") + await prepare_review_assets("j1", jm) # must not raise + + +@pytest.mark.asyncio +async def test_transcode_failure_still_caches_waveforms(): + jm = MagicMock() + jm.get_job.return_value = _job({"backing_vocals": "b.flac", "vocals_clean": "v.flac"}) + transcoding = MagicMock() + transcoding.prepare_review_audio_for_job.side_effect = RuntimeError("ffmpeg") + analysis = MagicMock() + with patch("backend.services.audio_transcoding_service.AudioTranscodingService", + return_value=transcoding), \ + patch("backend.services.audio_analysis_service.AudioAnalysisService", + return_value=analysis): + await prepare_review_assets("j1", jm) + analysis.get_review_waveform.assert_called_once() + analysis.get_vocals_peaks.assert_called_once() diff --git a/backend/tests/test_screens_worker_review_hold.py b/backend/tests/test_screens_worker_review_hold.py index c513b91e..16c65a53 100644 --- a/backend/tests/test_screens_worker_review_hold.py +++ b/backend/tests/test_screens_worker_review_hold.py @@ -1,6 +1,6 @@ -"""Screens worker + review gate: a lyrics-confident job whose stems are still -separating is held in GENERATING_SCREENS (no review link, no notification) -instead of opening review. See backend/services/auto_approval/review_gate.py.""" +"""Screens worker + review gate: a job whose stems are still separating is held +in GENERATING_SCREENS (no review link, no notification) instead of opening +review, whatever the lyrics verdict. See backend/services/auto_approval/review_gate.py.""" from datetime import datetime, timezone from unittest.mock import MagicMock, patch @@ -45,7 +45,8 @@ async def _run_screens(auto_result, *, audio_complete): patch.object(sw, "_apply_countdown_padding_if_needed", side_effect=noop), \ patch.object(sw, "_transcode_review_audio", side_effect=noop), \ patch("backend.services.auto_approval.executor.maybe_auto_complete_review", side_effect=auto), \ - patch("backend.services.auto_approval.pre_apply.ensure_and_pre_apply", pre_apply): + patch("backend.services.auto_approval.pre_apply.ensure_and_pre_apply", pre_apply), \ + patch("backend.services.review_assets.prepare_review_assets", side_effect=noop): assert await sw.generate_screens("j1") is True, jm.mark_job_failed.call_args return jm, pre_apply @@ -65,8 +66,18 @@ async def test_held_job_does_not_open_review(): @pytest.mark.asyncio -async def test_unheld_job_opens_review_as_before(): - jm, pre_apply = await _run_screens({"outcome": "review"}, audio_complete=False) +async def test_job_needing_human_review_is_also_held_until_stems_land(): + jm, pre_apply = await _run_screens( + {"outcome": "review", "hold_for_audio": False, "ai_suggestions_available": True}, + audio_complete=False) + jm.park_review_for_auto_check.assert_called_once_with("j1") + assert _review_transitions(jm) == [] + pre_apply.assert_not_called() + + +@pytest.mark.asyncio +async def test_job_with_stems_ready_opens_review(): + jm, pre_apply = await _run_screens({"outcome": "review"}, audio_complete=True) jm.park_review_for_auto_check.assert_not_called() assert len(_review_transitions(jm)) == 1 pre_apply.assert_called_once() diff --git a/backend/workers/screens_worker.py b/backend/workers/screens_worker.py index c69cbae8..90ff1bdd 100644 --- a/backend/workers/screens_worker.py +++ b/backend/workers/screens_worker.py @@ -777,75 +777,14 @@ async def _transcode_review_audio( job_manager: JobManager, job_log: logging.Logger, ) -> None: + """Transcode review audio and pre-compute the review waveforms (non-fatal). + + Runs on lyrics completion, usually before the stems exist; the review gate + runs the same preparation again once they land (backend/services/review_assets.py). """ - Transcode all review audio files to OGG Opus for fast browser playback. + from backend.services.review_assets import prepare_review_assets - This eagerly transcodes input audio + stems so the review UI serves - ~3 MB OGG files instead of 35+ MB FLACs. Non-fatal: if transcoding - fails, the review UI falls back to original FLAC signed URLs. - """ - from backend.services.audio_transcoding_service import AudioTranscodingService - - try: - job = await asyncio.to_thread(job_manager.get_job, job_id) - if not job: - job_log.warning(f"Could not get job {job_id} for review audio transcoding") - return - - # GCS download of up to 4 ~35MB FLACs + an ffmpeg transcode each (7-15s - # apiece) — this ran ON the event loop and froze the whole instance for - # 10-45s per job (2026-10-03 analysis). Run it in a worker thread. - transcoding = AudioTranscodingService() - transcoded = await asyncio.to_thread(transcoding.prepare_review_audio_for_job, job) - - job_log.info(f"Review audio transcoding complete: {len(transcoded)} files") - - # Pre-compute the review-page waveform JSON while we're here, so the - # /waveform-data endpoint is a pure GCS-cache read when the user opens - # review (a miss there decodes a whole stem — seconds of CPU on the - # API instance, which is what wedged it under concurrent load). - # The first import pulls in numpy/pydub/matplotlib (seconds of CPU on a - # fresh instance) — import it in a worker thread, not on the loop. - def _import_audio_analysis(): - from backend.services.audio_analysis_service import AudioAnalysisService - return AudioAnalysisService - - AudioAnalysisService = await asyncio.to_thread(_import_audio_analysis) - - stems = job.file_urls.get("stems", {}) if job.file_urls else {} - waveform_source = stems.get("backing_vocals") or job.input_media_gcs_path - if waveform_source: - try: - await asyncio.to_thread( - AudioAnalysisService().get_review_waveform, - waveform_source, job_id, 1000, transcoding, - ) - job_log.info("Review waveform data pre-computed") - except Exception as e: - # Non-fatal: /waveform-data computes + caches lazily on first open - job_log.warning(f"Review waveform pre-compute failed (non-fatal): {e}") - - # Pre-compute the vocals peak envelope too (Waveforms review mode) so - # /vocals-peaks is a pure cache read and the per-segment strips paint - # sub-second on first open. - from backend.utils.stems import vocals_stem_path - - vocals_source = vocals_stem_path(job) - if vocals_source: - try: - await asyncio.to_thread( - AudioAnalysisService().get_vocals_peaks, - vocals_source, job_id, 400, transcoding, - ) - job_log.info("Vocals peak envelope pre-computed") - except Exception as e: - # Non-fatal: /vocals-peaks computes + caches lazily on first open - job_log.warning(f"Vocals peaks pre-compute failed (non-fatal): {e}") - - except Exception as e: - # Non-fatal: review UI will fall back to FLAC signed URLs - job_log.warning(f"Review audio transcoding failed (non-fatal): {e}") - logger.warning(f"Job {job_id}: Review audio transcoding failed: {e}") + await prepare_review_assets(job_id, job_manager, job_log) async def _apply_countdown_padding_if_needed( diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index c25403b6..197d9b24 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -208,6 +208,16 @@ the zone to "full (strict)".** Full rationale + cutover runbook: • Analyze backing vocals track (for instrumental selection) • Transcode audio to OGG Opus for review UI (~3 MB vs 35 MB FLAC) ▼ +3b. REVIEW GATE (backend/services/auto_approval/review_gate.py) + • If stems aren't ready yet, hold in GENERATING_SCREENS + (state_data.auto_review_waiting_for_stems; job card: "Preparing review") + • Audio worker releases the hold → auto-approval re-score with stems + • Auto-ship if confident, else prepare the review BEFORE AWAITING_REVIEW: + AI corrections generated + applied server-side (pre_apply.py; the browser + never applies them), stem OGGs + backing waveform + vocal peaks cached + (review_assets.py) + • Backstop: recover_stuck_jobs releases a hold after 20 min + ▼ 4. COMBINED HUMAN REVIEW (AWAITING_REVIEW) • React UI for lyrics correction • Preview video generation (optionally via GCE for speed) diff --git a/docs/archive/2026-11-19-review-ready-gate.md b/docs/archive/2026-11-19-review-ready-gate.md new file mode 100644 index 00000000..7320fdd8 --- /dev/null +++ b/docs/archive/2026-11-19-review-ready-gate.md @@ -0,0 +1,57 @@ +# Review button only when the job is fully prepared (2026-11-19) + +## Ask + +Andrew, after job ae995697 showed "Review Lyrics" while audio separation was still running: + +> i want the review button to only appear when a job is "fully prepared", including with the ai +> corrections and the lead vocal waveform images ready to load - and i don't like the different +> code paths implied by this statement; i want the ai corrections to always be processed before i +> open the review page: "The AI corrections are already ready when the button appears: either +> applied on the server, or applied by the page when it loads" + +## What was happening (job ae995697, a Made For You order) + +| UTC | Event | +|---|---| +| 18:28:44 | Screens worker scored the job: lyrics `review/phantom-gate`, blockers `made_for_you`, `audio_incomplete` | +| 18:29:01 | Waited for AI suggestions, re-scored: still review, `hold_for_audio=False` → AWAITING_REVIEW (button shown) | +| 18:29:01 | Server pre-apply aborted (`duplicate_words:ne,ne,ne,ne,ne`), so the browser would apply on load | +| 18:32:41 | Stems landed; audio-worker re-score: backing `with_backing` | + +Two gaps: + +1. The review hold (gen #1232, 2026-10-29) only held jobs whose lyrics would **auto-ship** + (`executor.py` `hold_for_audio`). Any job a human had to review anyway (every Made For You + order, every lyrics-gated job) opened review before the stems, the backing verdict, the vocal + waveform (`/vocals-peaks`) and the missing-lyrics markers existed. +2. The server pre-apply used the auto-ship sanity gates (stale / duplicate-word aborts). On abort + the browser ran its own auto-run + auto-apply on load: a second code path. + +## Change + +- **Hold every job** whose stems aren't ready when the screens worker finishes + (`review_gate.route_after_scoring`), not just lyrics-auto ones. Kill switch unchanged + (`AUTO_APPROVAL_AUDIO_HOLD_ENABLED`); 20-minute backstop unchanged. +- **AI suggestions are generated on the API service before parking**: the hold is normally + released inside the audio-separation job, which has no LLM credentials and + `AUTO_CORRECT_PROACTIVE_ENABLED` unset, so it can only apply an existing cache. +- **`enter_human_review` prepares everything before AWAITING_REVIEW**: pre-apply (generate on + miss), then `review_assets.prepare_review_assets` (OGG transcodes, backing waveform from the + backing-vocals stem, vocal peak envelope), then the transition. +- **Pre-apply for human review is non-strict** (`build_applied_segments(strict=False)`): it + produces what "Accept All" would, records stale/duplicate signals as `warnings` in + `metadata.auto_approval`. The executor's auto-ship path stays strict. +- **The browser never auto-runs or auto-applies suggestions** (`useAutoCorrect` + `autoRunOnLoad`/`autoApplyOnLoad` and the on-load rebase removed). Without a server pre-apply + (only if the LLM was down for both attempts) the review opens uncorrected and the AI panel can be + run by hand. +- **Job card shows "[5/10] Preparing review"** while held (`auto_review_waiting_for_stems` added to + the job-list summary fields). + +The late-stems polling in `LyricsAnalyzer` stays as a backstop for timeout releases. + +## Cost + +Made For You and lyrics-gated jobs reach review ~3 minutes later (the separation tail), and their +review-ready notification fires then too. diff --git a/frontend/components/lyrics-review/AutoCorrectPanel.tsx b/frontend/components/lyrics-review/AutoCorrectPanel.tsx index b4fc5d84..f8d4cf7b 100644 --- a/frontend/components/lyrics-review/AutoCorrectPanel.tsx +++ b/frontend/components/lyrics-review/AutoCorrectPanel.tsx @@ -104,7 +104,7 @@ export default function AutoCorrectPanel({ auto-applied) keep their bulk controls. */} {!isReadOnly && pendingCount > 0 && ( <> - diff --git a/frontend/components/lyrics-review/LyricsAnalyzer.tsx b/frontend/components/lyrics-review/LyricsAnalyzer.tsx index 0ba40a5d..83d09584 100644 --- a/frontend/components/lyrics-review/LyricsAnalyzer.tsx +++ b/frontend/components/lyrics-review/LyricsAnalyzer.tsx @@ -281,18 +281,12 @@ export default function LyricsAnalyzer({ [history, historyIndex] ) - // Collapse history to a single baseline entry (used by the on-load auto-apply - // so auto-corrections are the starting point, not an undoable "edit"). - const rebaseHistory = useCallback((next: CorrectionData) => { - setHistory([next]) - setHistoryIndex(0) - }, []) - // Server-side pre-apply (C2): when the backend applied the AI corrections // before the review-ready notification, `initialData` already carries them and // marks `metadata.auto_approval.pre_applied`. In that case the UI must NOT - // auto-run/auto-apply again (no in-browser race) — it just displays what was - // applied. Keyed on the marker only (not live edits) so it doesn't churn. + // run/apply anything itself — it just displays what was applied. The browser + // never auto-applies: the backend does it before review opens (pre_apply.py). + // Keyed on the marker only (not live edits) so it doesn't churn. const preApplied = useMemo(() => { const m = initialData.metadata?.auto_approval if (isReadOnly || isLocalMode || !m?.pre_applied || !Array.isArray(m.suggestions)) return null @@ -309,23 +303,15 @@ export default function LyricsAnalyzer({ jobId, data, updateDataWithHistory, - rebaseData: rebaseHistory, editLog, getAuthToken: () => getAccessToken() ?? undefined, - // Auto-run + auto-apply once on load so the reviewer starts from the - // corrected lyrics (= clicking "Accept All"). The backend pre-generates + - // caches suggestions during lyrics processing, so this is normally an - // instant cache hit. Skipped in read-only / local mode, and only when a - // jobId exists (the request needs one). Also skipped when the server already - // pre-applied (C2) — the corrections are already in the loaded data. - autoRunOnLoad: !isReadOnly && !isLocalMode && Boolean(jobId) && !preApplied, - autoApplyOnLoad: !isReadOnly && !isLocalMode && Boolean(jobId) && !preApplied, preApplied, }) - // Late stems: review opens as soon as LYRICS finish, but audio separation usually - // lands 2-3 minutes later — so the page-load data often has no instrumental stems - // or backing analysis. Poll until separation completes and overlay the fresh + // Late stems: review is normally held until the stems land (review_gate.py), so + // this is a backstop for jobs released by the 20-minute hold timeout, or that + // reached review before the hold covered every job. Poll until separation + // completes and overlay the fresh // stems / analysis / auto-approval verdict, so the finish modal's instrumental // chooser appears without a reload. Kept OUT of `data` (history/undo, saved // sessions, and the preview render all key off it). diff --git a/frontend/hooks/__tests__/useAutoCorrect.preapplied.test.ts b/frontend/hooks/__tests__/useAutoCorrect.preapplied.test.ts index 767492f6..9dcd52e6 100644 --- a/frontend/hooks/__tests__/useAutoCorrect.preapplied.test.ts +++ b/frontend/hooks/__tests__/useAutoCorrect.preapplied.test.ts @@ -51,8 +51,6 @@ describe('useAutoCorrect pre-applied mode (C2)', () => { useAutoCorrect({ ...baseArgs, data: makeData(), - autoRunOnLoad: false, - autoApplyOnLoad: false, preApplied: { suggestions, appliedIds: ['a'], rejectedIds: ['b'] }, }), ) @@ -72,8 +70,6 @@ describe('useAutoCorrect pre-applied mode (C2)', () => { useAutoCorrect({ ...baseArgs, data: makeData(), - autoRunOnLoad: false, - autoApplyOnLoad: false, preApplied: null, }), ) @@ -99,8 +95,6 @@ describe('useAutoCorrect pre-applied mode (C2)', () => { { id: 's0', text: 'not much here', words: [{ id: 'w0', text: 'not', start_time: 0, end_time: 0.3 }], start_time: 0, end_time: 1 }, ], }, - autoRunOnLoad: false, - autoApplyOnLoad: false, preApplied: { suggestions, appliedIds: ['a'], @@ -151,8 +145,6 @@ describe('useAutoCorrect pre-applied mode (C2)', () => { { id: 's0', text: 'not much here', words: [{ id: 'w0', text: 'not', start_time: 0, end_time: 0.3 }], start_time: 0, end_time: 1 }, ], }, - autoRunOnLoad: false, - autoApplyOnLoad: false, preApplied: { suggestions, appliedIds: ['a'], @@ -193,8 +185,6 @@ describe('useAutoCorrect pre-applied mode (C2)', () => { useAutoCorrect({ ...baseArgs, data: makeData(), - autoRunOnLoad: false, - autoApplyOnLoad: false, preApplied: { suggestions, appliedIds: ['a'], rejectedIds: [] }, }), ) diff --git a/frontend/hooks/useAutoCorrect.ts b/frontend/hooks/useAutoCorrect.ts index 0e9f7526..58057848 100644 --- a/frontend/hooks/useAutoCorrect.ts +++ b/frontend/hooks/useAutoCorrect.ts @@ -38,24 +38,15 @@ interface UseAutoCorrectArgs { jobId?: string data: CorrectionData updateDataWithHistory: (newData: CorrectionData, desc?: string) => void - /** Commit data as the new review baseline (collapses undo history). Used for - * the on-load auto-apply so auto-corrections are the starting point, not a - * user "edit" that would trigger a save/restore prompt. */ - rebaseData?: (newData: CorrectionData) => void editLog: EditLog getAuthToken: () => string | undefined - /** Auto-trigger one run on load (when references exist) so suggestions are - * ready without a click. Normally a cache hit (backend pre-generates). */ - autoRunOnLoad?: boolean - /** After the auto-run completes, immediately apply all suggestions (the - * equivalent of clicking "Accept All") so the reviewer starts from the - * corrected lyrics. Implies autoRunOnLoad. */ - autoApplyOnLoad?: boolean /** Server-side pre-apply (C2): when the backend already applied the AI * corrections before the review-ready notification, the working `data` is the * final state. The hook then seeds the panel in read-only "already applied" - * mode and does NOT auto-run / auto-apply (no in-browser race). The caller - * passes autoRunOnLoad/autoApplyOnLoad = false in this case. */ + * mode. The browser never runs or applies suggestions on load by itself: + * the backend applies them before the job reaches review + * (backend/services/auto_approval/pre_apply.py). Without this, the panel + * starts idle and the reviewer can run it by hand. */ preApplied?: { suggestions: AiSuggestion[] appliedIds: string[] @@ -74,11 +65,8 @@ export function useAutoCorrect({ jobId, data, updateDataWithHistory, - rebaseData, editLog, getAuthToken, - autoRunOnLoad = false, - autoApplyOnLoad = false, preApplied = null, }: UseAutoCorrectArgs) { const [status, setStatus] = useState('idle') @@ -89,11 +77,6 @@ export function useAutoCorrect({ const [error, setError] = useState(null) const undoInfos = useRef>({}) const abortRef = useRef(null) - // Guards the one-shot auto-run on load. Reset on abort so a request that was - // cancelled mid-flight (e.g. React StrictMode's dev double-invoke, or a fast - // re-render) re-fires instead of permanently stranding the auto-run. - const autoRanRef = useRef(false) - const hasReferences = Object.keys(data.reference_lyrics ?? {}).length > 0 // Abort any in-flight request on unmount so no state updates land after. @@ -143,9 +126,6 @@ export function useAutoCorrect({ }) } catch (err) { if ((err as Error).name === 'AbortError') { - // Allow the load effect to retry: flipping status back to 'idle' is a - // dependency change that re-runs it, and the guard is now clear. - autoRanRef.current = false setStatus('idle') return } @@ -164,17 +144,6 @@ export function useAutoCorrect({ abortRef.current?.abort() }, []) - // Fire exactly one run on load once references + segments are available. - // The ref guard ensures it never re-fires as `data` changes during review - // (but is cleared on abort above so a cancelled attempt can retry). - useEffect(() => { - if (!(autoRunOnLoad || autoApplyOnLoad) || autoRanRef.current) return - if (!jobId || status !== 'idle') return - if (!hasReferences || !(data.corrected_segments?.length > 0)) return - autoRanRef.current = true - void run() - }, [autoRunOnLoad, autoApplyOnLoad, jobId, status, hasReferences, data.corrected_segments, run]) - // Pre-applied mode (C2): the backend already applied the corrections and the // working `data` is the final state. Seed the panel to show what was applied // (read-only) WITHOUT running the network call or re-applying. One-shot. @@ -283,7 +252,7 @@ export function useAutoCorrect({ ) const acceptAll = useCallback( - (asBaseline = false) => { + () => { let segments = data.corrected_segments const newDecisions: Record = { ...decisions } // In conflict groups only the winner (highest consensus, then @@ -311,18 +280,11 @@ export function useAutoCorrect({ applied += 1 } if (applied > 0) { - const next = { ...data, corrected_segments: segments } - // On-load auto-apply commits as the review baseline (no undo entry, no - // save/restore prompt); a manual "Accept all" is a normal edit. - if (asBaseline && rebaseData) { - rebaseData(next) - } else { - updateDataWithHistory(next, 'accept all AI suggestions') - } + updateDataWithHistory({ ...data, corrected_segments: segments }, 'accept all AI suggestions') } setDecisions(newDecisions) }, - [suggestions, decisions, data, updateDataWithHistory, rebaseData, logDecision], + [suggestions, decisions, data, updateDataWithHistory, logDecision], ) // Revert every applied auto-correction back to the original transcription @@ -354,20 +316,6 @@ export function useAutoCorrect({ setDecisions(newDecisions) }, [suggestions, decisions, data, updateDataWithHistory, logDecision]) - // Auto-apply: once the auto-run lands, apply every suggestion exactly as - // "Accept All" would, once. The ref guard survives the data/decisions churn - // that acceptAll triggers (each re-creates this callback), and re-runs on a - // reload no-op because the re-fetched suggestions are stale → 0 pending. - const autoAppliedRef = useRef(false) - useEffect(() => { - if (!autoApplyOnLoad || autoAppliedRef.current) return - if (status !== 'reviewing') return - const hasPending = suggestions.some((s) => decisions[s.id] === 'pending') - if (!hasPending) return - autoAppliedRef.current = true - acceptAll(true) - }, [autoApplyOnLoad, status, suggestions, decisions, acceptAll]) - const rejectAll = useCallback(() => { const newDecisions: Record = { ...decisions } for (const s of suggestions) { diff --git a/frontend/lib/job-status.ts b/frontend/lib/job-status.ts index 97ca5cfc..2a9eba85 100644 --- a/frontend/lib/job-status.ts +++ b/frontend/lib/job-status.ts @@ -226,6 +226,19 @@ export function getJobStep(job: Job): JobStep { }; } + // Screens are done but the review is held until audio separation, the + // auto-approval re-score, AI corrections and review waveforms are all ready + // (backend/services/auto_approval/review_gate.py). No button until then. + if (status === "generating_screens" && job.state_data?.auto_review_waiting_for_stems) { + return { + step: 5, + total: TOTAL_STEPS, + label: "preparingReview", + isBlocking: false, + color: "text-cyan-400", + }; + } + // Signed-URL upload jobs sit in "pending" until the browser finishes PUTting // the audio to GCS. "Setting up" implies we're working on it; we're not — // we're waiting on the submitting tab. diff --git a/frontend/messages/ar.json b/frontend/messages/ar.json index a04e25df..4ff7d583 100644 --- a/frontend/messages/ar.json +++ b/frontend/messages/ar.json @@ -648,7 +648,8 @@ "preparingAudio": "جارٍ تجهيز الصوت", "processing": "قيد المعالجة", "waitingForUpload": "بانتظار الرفع", - "restoringStems": "جارٍ استعادة مسارات الصوت المنفصلة (stems)" + "restoringStems": "جارٍ استعادة مسارات الصوت المنفصلة (stems)", + "preparingReview": "جارٍ إعداد المراجعة" }, "jobCard": { "actionNeeded": "إجراء مطلوب", diff --git a/frontend/messages/ca.json b/frontend/messages/ca.json index 7950e6f2..c1a4af2a 100644 --- a/frontend/messages/ca.json +++ b/frontend/messages/ca.json @@ -648,7 +648,8 @@ "preparingAudio": "Preparant el teu àudio", "processing": "Processant", "waitingForUpload": "Esperant la pujada", - "restoringStems": "Restaurant les pistes d'àudio" + "restoringStems": "Restaurant les pistes d'àudio", + "preparingReview": "Preparant la revisió" }, "jobCard": { "actionNeeded": "Acció necessària", diff --git a/frontend/messages/cs.json b/frontend/messages/cs.json index 7e5e0b79..fc106fa1 100644 --- a/frontend/messages/cs.json +++ b/frontend/messages/cs.json @@ -648,7 +648,8 @@ "preparingAudio": "Připravujeme tvoje audio", "processing": "Zpracovává se", "waitingForUpload": "Čeká se na nahrání", - "restoringStems": "Obnovování zvukových stop" + "restoringStems": "Obnovování zvukových stop", + "preparingReview": "Příprava kontroly" }, "jobCard": { "actionNeeded": "Vyžadována akce", diff --git a/frontend/messages/da.json b/frontend/messages/da.json index 6327b1f2..9214cc4b 100644 --- a/frontend/messages/da.json +++ b/frontend/messages/da.json @@ -648,7 +648,8 @@ "preparingAudio": "Forbereder din lyd", "processing": "Behandler", "waitingForUpload": "Venter på upload", - "restoringStems": "Gendanner lydspor" + "restoringStems": "Gendanner lydspor", + "preparingReview": "Forbereder gennemgang" }, "jobCard": { "actionNeeded": "Handling påkrævet", diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 46c5bcd6..90d1d1f7 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -648,7 +648,8 @@ "preparingAudio": "Dein Audio wird vorbereitet", "processing": "Wird verarbeitet", "waitingForUpload": "Wartet auf Upload", - "restoringStems": "Audio-Stems werden wiederhergestellt" + "restoringStems": "Audio-Stems werden wiederhergestellt", + "preparingReview": "Textüberprüfung wird vorbereitet" }, "jobCard": { "actionNeeded": "Aktion erforderlich", diff --git a/frontend/messages/el.json b/frontend/messages/el.json index fa6678fa..4ccdda3d 100644 --- a/frontend/messages/el.json +++ b/frontend/messages/el.json @@ -648,7 +648,8 @@ "preparingAudio": "Προετοιμασία του ήχου σου", "processing": "Επεξεργασία", "waitingForUpload": "Αναμονή μεταφόρτωσης", - "restoringStems": "Επαναφορά stems ήχου" + "restoringStems": "Επαναφορά stems ήχου", + "preparingReview": "Προετοιμασία προεπισκόπησης" }, "jobCard": { "actionNeeded": "Απαιτείται ενέργεια", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 8884470d..20eea16f 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -661,7 +661,8 @@ "correcting": "Correcting", "lyricsDone": "Lyrics done", "lyrics": "Lyrics", - "restoringStems": "Restoring audio stems" + "restoringStems": "Restoring audio stems", + "preparingReview": "Preparing review" }, "jobCard": { "actionNeeded": "Action needed", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index 44bb963a..b2c90f5f 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -648,7 +648,8 @@ "preparingAudio": "Preparando tu audio", "processing": "Procesando", "waitingForUpload": "Esperando la subida", - "restoringStems": "Restaurando pistas de audio" + "restoringStems": "Restaurando pistas de audio", + "preparingReview": "Preparando la revisión" }, "jobCard": { "actionNeeded": "Acción necesaria", diff --git a/frontend/messages/fi.json b/frontend/messages/fi.json index 8d90dbf5..898f0acc 100644 --- a/frontend/messages/fi.json +++ b/frontend/messages/fi.json @@ -648,7 +648,8 @@ "preparingAudio": "Valmistellaan ääniraitaasi", "processing": "Käsitellään", "waitingForUpload": "Odotetaan latausta", - "restoringStems": "Palautetaan erillisiä ääniraitoja (stems)" + "restoringStems": "Palautetaan erillisiä ääniraitoja (stems)", + "preparingReview": "Valmistellaan esikatselua" }, "jobCard": { "actionNeeded": "Toimenpiteitä tarvitaan", diff --git a/frontend/messages/fr.json b/frontend/messages/fr.json index 221317f2..70ade39e 100644 --- a/frontend/messages/fr.json +++ b/frontend/messages/fr.json @@ -648,7 +648,8 @@ "preparingAudio": "Préparation de ton audio", "processing": "Traitement en cours", "waitingForUpload": "En attente de téléversement", - "restoringStems": "Restauration des stems audio" + "restoringStems": "Restauration des stems audio", + "preparingReview": "Préparation de l'aperçu" }, "jobCard": { "actionNeeded": "Action requise", diff --git a/frontend/messages/he.json b/frontend/messages/he.json index 57856611..ae4be814 100644 --- a/frontend/messages/he.json +++ b/frontend/messages/he.json @@ -648,7 +648,8 @@ "preparingAudio": "מכינים את האודיו שלך", "processing": "בעיבוד", "waitingForUpload": "ממתין להעלאה", - "restoringStems": "משחזר ערוצי שמע (stems)" + "restoringStems": "משחזר ערוצי שמע (stems)", + "preparingReview": "מכין לבדיקה" }, "jobCard": { "actionNeeded": "נדרשת פעולה", diff --git a/frontend/messages/hi.json b/frontend/messages/hi.json index 26c6e54c..621a8ac1 100644 --- a/frontend/messages/hi.json +++ b/frontend/messages/hi.json @@ -648,7 +648,8 @@ "preparingAudio": "तुम्हारा ऑडियो तैयार किया जा रहा है", "processing": "प्रोसेस हो रहा है", "waitingForUpload": "अपलोड का इंतज़ार है", - "restoringStems": "ऑडियो स्टेम्स रिस्टोर किए जा रहे हैं" + "restoringStems": "ऑडियो स्टेम्स रिस्टोर किए जा रहे हैं", + "preparingReview": "समीक्षा तैयार की जा रही है" }, "jobCard": { "actionNeeded": "एक्शन की ज़रूरत है", diff --git a/frontend/messages/hr.json b/frontend/messages/hr.json index dee60636..02a0c014 100644 --- a/frontend/messages/hr.json +++ b/frontend/messages/hr.json @@ -648,7 +648,8 @@ "preparingAudio": "Priprema tvog audiozapisa", "processing": "Obrada", "waitingForUpload": "Čeka se prijenos", - "restoringStems": "Vraćanje audio stemova" + "restoringStems": "Vraćanje audio stemova", + "preparingReview": "Priprema pregleda" }, "jobCard": { "actionNeeded": "Potrebna akcija", diff --git a/frontend/messages/hu.json b/frontend/messages/hu.json index 1771ecbc..e9131c5c 100644 --- a/frontend/messages/hu.json +++ b/frontend/messages/hu.json @@ -648,7 +648,8 @@ "preparingAudio": "Hanganyagod előkészítése", "processing": "Feldolgozás", "waitingForUpload": "Várakozás a feltöltésre", - "restoringStems": "Hangsávok (stemek) visszaállítása" + "restoringStems": "Hangsávok (stemek) visszaállítása", + "preparingReview": "Áttekintés előkészítése" }, "jobCard": { "actionNeeded": "Művelet szükséges", diff --git a/frontend/messages/id.json b/frontend/messages/id.json index 28010743..4d49bac5 100644 --- a/frontend/messages/id.json +++ b/frontend/messages/id.json @@ -648,7 +648,8 @@ "preparingAudio": "Menyiapkan audio Anda", "processing": "Memproses", "waitingForUpload": "Menunggu pengunggahan", - "restoringStems": "Memulihkan stem audio" + "restoringStems": "Memulihkan stem audio", + "preparingReview": "Menyiapkan pratinjau" }, "jobCard": { "actionNeeded": "Perlu tindakan", diff --git a/frontend/messages/it.json b/frontend/messages/it.json index 718d2865..6701bc6c 100644 --- a/frontend/messages/it.json +++ b/frontend/messages/it.json @@ -648,7 +648,8 @@ "preparingAudio": "Preparazione del tuo audio", "processing": "Elaborazione", "waitingForUpload": "In attesa del caricamento", - "restoringStems": "Ripristino delle tracce audio (stem)" + "restoringStems": "Ripristino delle tracce audio (stem)", + "preparingReview": "Preparazione della revisione" }, "jobCard": { "actionNeeded": "Azione richiesta", diff --git a/frontend/messages/ja.json b/frontend/messages/ja.json index 8d9c9975..1b900930 100644 --- a/frontend/messages/ja.json +++ b/frontend/messages/ja.json @@ -648,7 +648,8 @@ "preparingAudio": "音源を準備中", "processing": "処理中", "waitingForUpload": "アップロード待機中", - "restoringStems": "オーディオステムを復元中" + "restoringStems": "オーディオステムを復元中", + "preparingReview": "確認画面を準備中" }, "jobCard": { "actionNeeded": "アクションが必要です", diff --git a/frontend/messages/ko.json b/frontend/messages/ko.json index 596266f7..9e17db07 100644 --- a/frontend/messages/ko.json +++ b/frontend/messages/ko.json @@ -648,7 +648,8 @@ "preparingAudio": "오디오 준비 중", "processing": "처리 중", "waitingForUpload": "업로드 대기 중", - "restoringStems": "오디오 스템 복원 중" + "restoringStems": "오디오 스템 복원 중", + "preparingReview": "검토 준비 중" }, "jobCard": { "actionNeeded": "조치 필요", diff --git a/frontend/messages/ms.json b/frontend/messages/ms.json index 426b06f7..d41a62a9 100644 --- a/frontend/messages/ms.json +++ b/frontend/messages/ms.json @@ -648,7 +648,8 @@ "preparingAudio": "Menyediakan audio anda", "processing": "Memproses", "waitingForUpload": "Menunggu muat naik", - "restoringStems": "Memulihkan stem audio" + "restoringStems": "Memulihkan stem audio", + "preparingReview": "Menyediakan semakan" }, "jobCard": { "actionNeeded": "Tindakan diperlukan", diff --git a/frontend/messages/nb.json b/frontend/messages/nb.json index aab17a3d..37f2a5f6 100644 --- a/frontend/messages/nb.json +++ b/frontend/messages/nb.json @@ -648,7 +648,8 @@ "preparingAudio": "Forbereder lyden din", "processing": "Behandler", "waitingForUpload": "Venter på opplasting", - "restoringStems": "Gjenoppretter lydspor" + "restoringStems": "Gjenoppretter lydspor", + "preparingReview": "Klargjør gjennomgang" }, "jobCard": { "actionNeeded": "Handling kreves", diff --git a/frontend/messages/nl.json b/frontend/messages/nl.json index 5d88581b..94a6061a 100644 --- a/frontend/messages/nl.json +++ b/frontend/messages/nl.json @@ -648,7 +648,8 @@ "preparingAudio": "Je audio voorbereiden", "processing": "Verwerken", "waitingForUpload": "Wachten op upload", - "restoringStems": "Audiostems herstellen" + "restoringStems": "Audiostems herstellen", + "preparingReview": "Review voorbereiden" }, "jobCard": { "actionNeeded": "Actie vereist", diff --git a/frontend/messages/pl.json b/frontend/messages/pl.json index d8588ee1..0a08c5c7 100644 --- a/frontend/messages/pl.json +++ b/frontend/messages/pl.json @@ -648,7 +648,8 @@ "preparingAudio": "Przygotowywanie Twojego audio", "processing": "Przetwarzanie", "waitingForUpload": "Oczekiwanie na przesłanie", - "restoringStems": "Przywracanie ścieżek audio" + "restoringStems": "Przywracanie ścieżek audio", + "preparingReview": "Przygotowywanie podglądu" }, "jobCard": { "actionNeeded": "Wymagane działanie", diff --git a/frontend/messages/pt.json b/frontend/messages/pt.json index 96c6c9d0..910901bd 100644 --- a/frontend/messages/pt.json +++ b/frontend/messages/pt.json @@ -648,7 +648,8 @@ "preparingAudio": "Preparando seu áudio", "processing": "Processando", "waitingForUpload": "Aguardando upload", - "restoringStems": "Restaurando stems de áudio" + "restoringStems": "Restaurando stems de áudio", + "preparingReview": "Preparando a revisão" }, "jobCard": { "actionNeeded": "Ação necessária", diff --git a/frontend/messages/ro.json b/frontend/messages/ro.json index 69e02de2..30a3105f 100644 --- a/frontend/messages/ro.json +++ b/frontend/messages/ro.json @@ -648,7 +648,8 @@ "preparingAudio": "Îți pregătim fișierul audio", "processing": "Se procesează", "waitingForUpload": "În așteptarea încărcării", - "restoringStems": "Se restaurează stem-urile audio" + "restoringStems": "Se restaurează stem-urile audio", + "preparingReview": "Se pregătește previzualizarea" }, "jobCard": { "actionNeeded": "Acțiune necesară", diff --git a/frontend/messages/ru.json b/frontend/messages/ru.json index 1b5344d6..c627a0fb 100644 --- a/frontend/messages/ru.json +++ b/frontend/messages/ru.json @@ -648,7 +648,8 @@ "preparingAudio": "Подготовка твоего аудио", "processing": "Обработка", "waitingForUpload": "Ожидание загрузки", - "restoringStems": "Восстановление аудиодорожек (стэмов)" + "restoringStems": "Восстановление аудиодорожек (стэмов)", + "preparingReview": "Подготовка к просмотру" }, "jobCard": { "actionNeeded": "Требуется действие", diff --git a/frontend/messages/sk.json b/frontend/messages/sk.json index 10dbbda7..a1c1bd16 100644 --- a/frontend/messages/sk.json +++ b/frontend/messages/sk.json @@ -648,7 +648,8 @@ "preparingAudio": "Pripravuje sa tvoje audio", "processing": "Spracováva sa", "waitingForUpload": "Čaká sa na nahranie", - "restoringStems": "Obnovujú sa zvukové stopy" + "restoringStems": "Obnovujú sa zvukové stopy", + "preparingReview": "Pripravuje sa kontrola" }, "jobCard": { "actionNeeded": "Vyžaduje sa akcia", diff --git a/frontend/messages/sv.json b/frontend/messages/sv.json index 93c206bc..5dfa1711 100644 --- a/frontend/messages/sv.json +++ b/frontend/messages/sv.json @@ -648,7 +648,8 @@ "preparingAudio": "Förbereder ditt ljud", "processing": "Bearbetar", "waitingForUpload": "Väntar på uppladdning", - "restoringStems": "Återställer ljudspår" + "restoringStems": "Återställer ljudspår", + "preparingReview": "Förbereder granskning" }, "jobCard": { "actionNeeded": "Åtgärd krävs", diff --git a/frontend/messages/th.json b/frontend/messages/th.json index 82c75215..acef83a4 100644 --- a/frontend/messages/th.json +++ b/frontend/messages/th.json @@ -648,7 +648,8 @@ "preparingAudio": "กำลังเตรียมไฟล์เสียงของคุณ", "processing": "กำลังประมวลผล", "waitingForUpload": "รอการอัปโหลด", - "restoringStems": "กำลังกู้คืนแทร็กเสียงแยกชิ้น (audio stems)" + "restoringStems": "กำลังกู้คืนแทร็กเสียงแยกชิ้น (audio stems)", + "preparingReview": "กำลังเตรียมการตรวจสอบ" }, "jobCard": { "actionNeeded": "ต้องการการดำเนินการ", diff --git a/frontend/messages/tl.json b/frontend/messages/tl.json index 31a86c93..a4d63ea0 100644 --- a/frontend/messages/tl.json +++ b/frontend/messages/tl.json @@ -648,7 +648,8 @@ "preparingAudio": "Inihahanda ang iyong audio", "processing": "Pinoproseso", "waitingForUpload": "Naghihintay ng pag-upload", - "restoringStems": "Ipinapanumbalik ang audio stems" + "restoringStems": "Ipinapanumbalik ang audio stems", + "preparingReview": "Inihahanda ang review" }, "jobCard": { "actionNeeded": "Kailangan ng aksyon", diff --git a/frontend/messages/tr.json b/frontend/messages/tr.json index a213f40c..408e069b 100644 --- a/frontend/messages/tr.json +++ b/frontend/messages/tr.json @@ -648,7 +648,8 @@ "preparingAudio": "Ses dosyan hazırlanıyor", "processing": "İşleniyor", "waitingForUpload": "Yükleme bekleniyor", - "restoringStems": "Ses kanalları geri yükleniyor" + "restoringStems": "Ses kanalları geri yükleniyor", + "preparingReview": "İnceleme hazırlanıyor" }, "jobCard": { "actionNeeded": "Eylem gerekiyor", diff --git a/frontend/messages/uk.json b/frontend/messages/uk.json index 3c17ca47..7aaf8af1 100644 --- a/frontend/messages/uk.json +++ b/frontend/messages/uk.json @@ -648,7 +648,8 @@ "preparingAudio": "Готуємо твоє аудіо", "processing": "Обробка", "waitingForUpload": "Очікування завантаження", - "restoringStems": "Відновлення окремих аудіодоріжок" + "restoringStems": "Відновлення окремих аудіодоріжок", + "preparingReview": "Підготовка до перегляду" }, "jobCard": { "actionNeeded": "Потрібна дія", diff --git a/frontend/messages/vi.json b/frontend/messages/vi.json index 228bba26..e425f080 100644 --- a/frontend/messages/vi.json +++ b/frontend/messages/vi.json @@ -648,7 +648,8 @@ "preparingAudio": "Đang chuẩn bị âm thanh của bạn", "processing": "Đang xử lý", "waitingForUpload": "Đang chờ tải lên", - "restoringStems": "Đang khôi phục các stem âm thanh" + "restoringStems": "Đang khôi phục các stem âm thanh", + "preparingReview": "Đang chuẩn bị bản xem lại" }, "jobCard": { "actionNeeded": "Cần hành động", diff --git a/frontend/messages/zh.json b/frontend/messages/zh.json index d57454fc..74cce3dd 100644 --- a/frontend/messages/zh.json +++ b/frontend/messages/zh.json @@ -648,7 +648,8 @@ "preparingAudio": "正在准备您的音频", "processing": "处理中", "waitingForUpload": "等待上传", - "restoringStems": "正在恢复音频分轨" + "restoringStems": "正在恢复音频分轨", + "preparingReview": "正在准备审核" }, "jobCard": { "actionNeeded": "需要操作", diff --git a/pyproject.toml b/pyproject.toml index a02554af..bb66fa8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "karaoke-gen" -version = "0.297.4" +version = "0.298.0" description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens." authors = ["Andrew Beveridge "] license = "MIT"