fix(ingest): suppress misleading batch-fallback warn for in-cluster rung

Address claude-review round 3 on #922:

- Important: _process_batch emitted "no gateway backend (provider=mistral or
  EMBEDDING_GATEWAY_URL unset)" for the gateway_only in-cluster rung, where the
  gateway IS configured — sending operators chasing a non-existent config
  problem. The real reason is "in-cluster GPU is synchronous-only; batch is the
  upstream path". Guard the warning with `if not self._gateway_only`. Extended
  test_gateway_only_processor_never_uses_batch_mode to drive _process_batch and
  assert _batch_fallback_warned stays False.
- Nits: refresh stale ladder in escalation.py module docstring
  (fast->structured->ocr-incluster->ocr-upstream); fix "minimum='ocr'" ->
  "ocr-incluster" in a test docstring; rename stale tier="ocr" ->
  "ocr-upstream" in test_process_tier_oversize_fails_fast.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-18 00:48:10 +02:00
co-authored by Claude Opus 4.8
parent 6e32bd9561
commit ebbf905dc5
4 changed files with 32 additions and 7 deletions
+4 -2
View File
@@ -479,7 +479,9 @@ async def test_process_tier_oversize_fails_fast(monkeypatch):
reg_mod, "get_settings", lambda: _Settings(max_pdf_size_mb=0.001)
)
r = _registry((_Fake("ocr-upstream", "ocr-upstream"), 5))
res = await r.process_tier(b"x" * 4096, "application/pdf", "big.pdf", "ocr")
res = await r.process_tier(
b"x" * 4096, "application/pdf", "big.pdf", "ocr-upstream"
)
assert res.success is False
assert res.metadata["parse_failed_reason"] == "oversize"
@@ -724,7 +726,7 @@ def test_evaluate_escalation_terminal_when_ocr_unregistered_and_off(monkeypatch)
def test_evaluate_escalation_empty_suppressed_even_when_structured_registered(
monkeypatch,
):
"""empty_text uses minimum='ocr', so it skips structured even when structured
"""empty_text uses minimum='ocr-incluster', so it skips structured even when structured
IS registered: with OCR off it suppresses to ocr, never hops to structured
(a text extractor can't conjure text from a raster scan)."""
monkeypatch.setattr(reg_mod, "record_document_classification", MagicMock())