test: apply evidence-based live checks without hiding regressions
This commit is contained in:
@@ -1340,3 +1340,25 @@ async def test_managed_conflict_returns_half_open_probe_and_permit():
|
||||
await gate.release_probe(next_entry)
|
||||
finally:
|
||||
await client._transport.aclose()
|
||||
|
||||
|
||||
async def test_synthetic_runtime_protocol_and_legacy_call_signatures():
|
||||
"""合成 Protocol 仅证明本库兼容契约,不冒充缺失下游实际验收。"""
|
||||
import inspect
|
||||
from typing import Protocol, runtime_checkable
|
||||
|
||||
@runtime_checkable
|
||||
class Caller(Protocol):
|
||||
"""旧调用点只依赖 chat 协议。"""
|
||||
|
||||
async def chat(self, messages, **kwargs): ...
|
||||
|
||||
client = GatewayClient.from_env("LLM", env=_ENV)
|
||||
try:
|
||||
assert isinstance(client, Caller)
|
||||
signature = inspect.signature(client.chat)
|
||||
signature.bind([], session_id="session", parent_call_id="step")
|
||||
signature.bind([], session_id="session", cache_salt="epoch-1")
|
||||
assert client._transport._clients == {}
|
||||
finally:
|
||||
await client.aclose()
|
||||
|
||||
Reference in New Issue
Block a user