@@ -1089,12 +1089,14 @@ async def scripted_transport() -> AsyncIterator[TransportStreams]:
10891089 assert listings_served == 2 # the clamped-to-zero ttl was never stored: the second call re-fetched
10901090
10911091
1092- async def test_a_negative_discover_ttl_still_connects_modern_in_auto_mode () -> None :
1092+ @pytest .mark .parametrize ("wire_ttl" , [- 5 , - 5.0 ])
1093+ async def test_a_negative_discover_ttl_still_connects_modern_in_auto_mode (wire_ttl : int | float ) -> None :
10931094 """Spec SHOULD (2026-07-28 caching) — silent-downgrade regression: before the
10941095 parse-seam clamp, a negative `ttlMs` on `server/discover` failed `DiscoverResult`
10951096 validation inside the mode='auto' probe, which reads as "not modern evidence" and
10961097 silently fell back to the legacy initialize handshake. Clamped, the probe adopts
1097- the modern era and the result carries `ttl_ms == 0`."""
1098+ the modern era and the result carries `ttl_ms == 0` — for float negatives too,
1099+ the same as the tools/list seam (both call the shared clamp)."""
10981100 methods_seen : list [str ] = []
10991101
11001102 async def scripted_server (streams : MessageStream ) -> None :
@@ -1111,7 +1113,7 @@ async def scripted_server(streams: MessageStream) -> None:
11111113 "capabilities" : {},
11121114 "serverInfo" : {"name" : "negative-ttl" , "version" : "0.0.1" },
11131115 "resultType" : "complete" ,
1114- "ttlMs" : - 5 ,
1116+ "ttlMs" : wire_ttl ,
11151117 }
11161118 await server_write .send (SessionMessage (types .JSONRPCResponse (jsonrpc = "2.0" , id = frame .id , result = result )))
11171119
0 commit comments