feat(remote)!: make remote serve WebSocket-only and refuse older clients with CLIENT_OUTDATED

This commit is contained in:
imSp4rky
2026-12-05 09:47:22 -07:00
parent 641623590d
commit 00ad15527c
62 changed files with 657 additions and 2098 deletions
+17 -9
View File
@@ -87,7 +87,15 @@ async def test_a_socket_that_cannot_send_is_closed_and_detached() -> None:
assert not entry.channel.attached
async def test_a_detached_channel_hands_its_waiting_asks_back_to_the_prompt_routes() -> None:
async def sent_cdm_calls(socket: FakeSocket) -> list[dict[str, Any]]:
for _ in range(200):
if calls := [m for m in socket.sent if m["type"] == "cdm_call"]:
return calls
await asyncio.sleep(0.01)
return []
async def test_a_detached_channel_keeps_its_waiting_asks_for_the_next_attach() -> None:
entry = entry_with_logs(0)
bridge = entry.input_bridge
assert bridge is not None
@@ -97,17 +105,17 @@ async def test_a_detached_channel_hands_its_waiting_asks_back_to_the_prompt_rout
answers: list[Any] = []
worker = threading.Thread(target=lambda: answers.append(bridge.request_cdm({"op": "close"}, timeout=5)))
worker.start()
for _ in range(200):
if any(m["type"] == "cdm_call" for m in socket.sent):
break
await asyncio.sleep(0.01)
assert bridge.get_pending_cdm_call() is None, "the channel carries the call, so polling must not see it"
(call,) = await sent_cdm_calls(socket)
await socket.close()
await serving
assert bridge.get_pending_cdm_call() == {"op": "close"}
assert bridge.submit_response('{"op": "close"}')
worker.join(5)
again = FakeSocket()
serving = asyncio.create_task(entry.channel.serve(again, entry, 0, False)) # type: ignore[arg-type]
assert await sent_cdm_calls(again) == [call]
assert bridge.answer(call["id"], '{"op": "close"}')
await asyncio.to_thread(worker.join, 5)
assert answers == [{"op": "close"}]
await again.close()
await serving
def test_a_prompt_the_client_refuses_stops_the_service_at_once() -> None: