diff --git a/backend/api/routes/jobs.py b/backend/api/routes/jobs.py index 01001865..02d091c2 100644 --- a/backend/api/routes/jobs.py +++ b/backend/api/routes/jobs.py @@ -1117,6 +1117,11 @@ def start_review( # Idempotent: concurrent/duplicate opens (React double-mount, double-tap, two # tabs) must not fail with "in_review -> in_review". Already in review == success, # and the one-time side effects (record_review_started) are not repeated. + # A job past review (e.g. a stale "review lyrics" push tapped on a finished song) + # is the client's to handle: 409, no transition attempted, nothing logged at ERROR. + if job.status not in [JobStatus.AWAITING_REVIEW, JobStatus.IN_REVIEW]: + raise _job_not_in_review_conflict(locale, job.status) + was_awaiting = job.status == JobStatus.AWAITING_REVIEW try: result = ensure_in_review( diff --git a/backend/tests/test_jobs_api.py b/backend/tests/test_jobs_api.py index 98ae8f6d..d06ff8cb 100644 --- a/backend/tests/test_jobs_api.py +++ b/backend/tests/test_jobs_api.py @@ -468,6 +468,7 @@ class TestStartReview: mock_job.status = status response = client.post("/api/jobs/test123/start-review", json={}, headers=auth_headers) assert response.status_code == 409 + assert status.value in response.json()["detail"] assert "JobStatus." not in response.json()["detail"] mock_job_manager.transition_to_state.assert_not_called() mock_job_manager.record_review_started.assert_not_called() diff --git a/pyproject.toml b/pyproject.toml index 7c01cf88..2bbf2346 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "karaoke-gen" -version = "0.290.3" +version = "0.290.4" 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"