fix(ocr): round-5 review nits — empty-pages failure, comments, test cleanup

Round 5 review (PR #910), all nits, no blockers:
- _result_from_success: a succeeded job with `pages=[]` (empty list, not just a
  missing key) is now a per-document failure ("no pages returned") instead of a
  silent 0-chunk success. Test added.
- Comment the deadline-expiry path: the gateway-side job isn't cancelled (no
  cancel endpoint at this layer) — it's reaped by the gateway file purge; we just
  stop polling it.
- Drop the vestigial status="pending" from the BatchOcrJob test fakes (the column
  was removed in round 4; BatchPollResult.status fakes are untouched).

1653 unit tests pass; ruff + ty green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-15 11:12:42 +02:00
co-authored by Claude Opus 4.8
parent 232684e881
commit bb08245c91
4 changed files with 25 additions and 8 deletions
@@ -479,6 +479,9 @@ class OcrProcessor(DocumentProcessor):
await store.delete(
user_id=user_id, doc_id=doc_id, doc_type=doc_type, etag=etag
)
# We don't cancel the gateway-side job (there's no cancel endpoint
# at this layer) — it keeps running and is reaped by the gateway's
# own file purge. Dropping the row just stops us polling it.
logger.warning(
"batch OCR job %s exceeded max wait (%ss); marking failed",
job.job_id,