From dd09aab9414dc6abf27b47b0b2c6a0ea1e49dedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrew=20Beveridge=20=E2=98=84=EF=B8=8F?= Date: Tue, 3 Nov 2026 18:35:29 -0500 Subject: [PATCH] fix(jobs): main is failing: resolve duplicate start-review guards (0.290.3) (#1249) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #1243 and #1246 both added a 409 guard to `start_review` and merged minutes apart. #1243's test expects its own message, but #1246's guard now runs first, so main's Backend Unit Tests fail (3 cases) and no deploy can finish. Keeps #1246's guard, because #1243's would refuse statuses that have a valid transition to `in_review`. The race handler is unchanged. The test still checks 409, no transition, and no enum text in the message. `backend/tests/test_jobs_api.py` passes locally. No local CodeRabbit review on this small unblocking fix, so the bot may review it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012RYLVTvqXyL4QyA2EjzQMG ## Summary by CodeRabbit * **Bug Fixes** * Review requests for jobs that cannot enter review continue to receive a conflict response. Eligible jobs can proceed into review, with review-start actions recorded only when a job transitions from awaiting review. * Updated the conflict-response test to check that internal status naming is not exposed. Co-authored-by: Claude Opus 5.5 --- backend/api/routes/jobs.py | 5 ----- backend/tests/test_jobs_api.py | 1 - 2 files changed, 6 deletions(-) diff --git a/backend/api/routes/jobs.py b/backend/api/routes/jobs.py index 02d091c2..01001865 100644 --- a/backend/api/routes/jobs.py +++ b/backend/api/routes/jobs.py @@ -1117,11 +1117,6 @@ 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 d06ff8cb..98ae8f6d 100644 --- a/backend/tests/test_jobs_api.py +++ b/backend/tests/test_jobs_api.py @@ -468,7 +468,6 @@ 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()