test: guard reasoning-free telemetry through real client paths

This commit is contained in:
2026-09-09 01:34:36 -04:00
parent d0078c1be5
commit 47488ee4fd
4 changed files with 233 additions and 0 deletions
+28
View File
@@ -405,3 +405,31 @@ class TestLifecycle:
await t.check_health(source=_source())
await t.aclose()
await t.aclose()
@pytest.mark.parametrize("method", ["recognize_text", "parse_layout"])
async def test_ocr_wire_does_not_send_reasoning_configuration(method):
"""真实 multipart 与 ZIP 下载两段均不发送源级推理配置。"""
sent = []
def handler(request):
sent.append(request)
if request.method == "GET":
return httpx.Response(200, content=_zip_bytes())
return httpx.Response(
200, json=_text_body() if method == "recognize_text" else _parse_body()
)
transport = _transport_for(handler)
try:
await getattr(transport, method)(
image=b"image",
source=_source(enable_thinking=True, reasoning_effort="high"),
call_id="wire",
)
assert len(sent) == (1 if method == "recognize_text" else 2)
for request in sent:
for key in (b"reasoning_effort", b"enable_thinking", b"thinking_budget"):
assert key not in request.content
finally:
await transport.aclose()