chore(deps): repin worldtree-sdk 1.1.2 → 1.2.0 + catch ResponseTooLarge

1.2.0 adds response-side allocation caps + a new exported `ResponseTooLarge`
(a ProtocolError, NOT a ConnectionDropped — retrying an oversized response is
futile; caps: 2xx body 108,004,096 B, SSE frame 540,000 B, both calibrated to
a 2.5.0 server, which worldtree-dev runs, so safe on legal traffic). Absorbed
WT spec 2.4.0/2.5.0 (zero-schema, no generated-type change).

We catalogue SDK errors explicitly, so ResponseTooLarge needs a home: added
`SseResponseTooLarge` (sse_client), mapped from `wtsdk.ResponseTooLarge` in
`wt.stream_turn` + `wt.stream_admin_events` (above the ApiError default — it's a
ProtocolError, not an ApiError), and caught in the two stream endpoints so an
oversized SSE frame surfaces as a labeled error, never an uncaught 500 or a
futile reconnect. The 108MB read-body cap is unreachable on legal traffic (a
108-megabyte transcript page is absurd), so reads inherit the SDK refusal
unwrapped. +2 adapter-mapping tests; 548 green. Done during the DCC-fix wait.
This commit is contained in:
vh
2026-08-02 18:22:19 -07:00
parent 006daf31ac
commit ae49dcf615
7 changed files with 59 additions and 11 deletions
+21
View File
@@ -47,6 +47,7 @@ from ratatoskr.sse_client import (
MalformedSseId,
SseConnectFailed,
SseConnectionDropped,
SseResponseTooLarge,
TurnIdFlip,
TurnLaunchUnavailable,
)
@@ -431,6 +432,16 @@ class TestStreamTurn:
await _drain(stream_turn(_wt(fake), "s", "hi"))
assert (ei.value.established, ei.value.got) == (5, 7)
async def test_response_too_large_maps_to_sse_response_too_large(self) -> None:
# 1.2.0: an oversized SSE frame (ProtocolError, NOT ConnectionDropped) → a terminal
# SseResponseTooLarge, never a resumable drop. Carries limit_bytes + scope.
fake = _FakeSessions(
stream_error=wtsdk.ResponseTooLarge(limit_bytes=540000, scope="sse_frame")
)
with pytest.raises(SseResponseTooLarge) as ei:
await _drain(stream_turn(_wt(fake), "s", "hi"))
assert ei.value.limit_bytes == 540000 and ei.value.scope == "sse_frame"
async def test_undiscriminated_api_error_maps_to_session_api_failed(self) -> None:
# INV-CUT-2 default: an undiscriminated ApiError surfacing from the stream
# (not a discriminated stream error) → SessionApiFailed.
@@ -1243,6 +1254,16 @@ class TestStreamAdminEventsWt:
await _drain(stream_admin_events(_wtad(fake)))
assert ei.value.last_seen_sse_id == "42"
async def test_response_too_large_maps_to_sse_response_too_large(self) -> None:
# 1.2.0: an oversized admin SSE frame (ProtocolError) → terminal SseResponseTooLarge,
# mirroring stream_turn (never a resumable drop).
fake = _FakeAdmin(
stream_error=wtsdk.ResponseTooLarge(limit_bytes=540000, scope="sse_frame")
)
with pytest.raises(SseResponseTooLarge) as ei:
await _drain(stream_admin_events(_wtad(fake)))
assert ei.value.limit_bytes == 540000
async def test_connection_dropped_none_cursor_connect_time(self) -> None:
# A connect-time transport failure surfaces as ConnectionDropped(None) →
# SseConnectionDropped(last_seen_sse_id=None) (the map's other cursor shape;