fix: close adversarial review findings on document parsing

Malformed download URLs are rejected before the second request, error bodies are read only up to a bound, the telemetry summary keeps structural dispatch for duck-typed results, and the BMP magic now requires a valid DIB header. Docs and design are aligned with the implementation, and new test wording is neutral.
This commit is contained in:
2026-10-22 02:09:06 -04:00
parent bb621cad4d
commit cb1e08f1f3
10 changed files with 180 additions and 25 deletions
@@ -2,7 +2,7 @@
**成败取决于外部服务当下状态**,按 CLAUDE.md §4.6 一律标 `slow`: 默认套件不收集,发布清单
第 4 步按 diff 交集选跑(`pytest tests/integration/test_monkey_ocr_document_live.py -m slow`)。
服务与医院线共用——所以每条用例只发**单份极小文档**、串行、不压测。
服务与其它业务线共用——所以每条用例只发**单份极小文档**、串行、不压测。
文档字节由本文件手写构造(最小合法 PDF,无第三方内容、无新依赖)。
不依赖 `data/soak` 图片语料,故**不**并入带语料 `skipif` 的 `test_monkey_ocr_live.py`。
@@ -65,7 +65,7 @@ def _env(**extra: str) -> dict[str, str]:
"OCR__MONKEY__1__API_KEY": "none",
"OCR__MONKEY__1__MODEL": "monkey-ocr",
"OCR__MONKEY__1__TIMEOUT_S": "300",
"OCR__MONKEY__1__MAX_CONCURRENCY": "1", # 与医院线共用,串行
"OCR__MONKEY__1__MAX_CONCURRENCY": "1", # 与其它业务线共用,串行
# 服务在 LAN,开发机的系统代理会对内网地址回 403
"OCR__MONKEY__1__TRUST_ENV": "false",
}