fix(jobs): main is failing: resolve duplicate start-review guards (0.290.3) (#1249)

#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

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andrew Beveridge ☄️andClaude Opus 5.5 authored and GitHub committed 2026-11-03 23:35:29 +00:00
1 parent 5ae9d407b2
commit dd09aab941
2 files changed
-6

No files matched your search

-5
View File
@@ -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(
-1
View File
@@ -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()