From 3b35294660a7ff8c0f7410a7991da905bda3ae76 Mon Sep 17 00:00:00 2001 From: QQ Date: Sat, 14 Nov 2026 14:43:07 +0800 Subject: [PATCH] Import fixtures/protocol/v1/control/hello.json --- fixtures/protocol/v1/control/hello.json | 211 ++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 fixtures/protocol/v1/control/hello.json diff --git a/fixtures/protocol/v1/control/hello.json b/fixtures/protocol/v1/control/hello.json new file mode 100644 index 0000000..71c7292 --- /dev/null +++ b/fixtures/protocol/v1/control/hello.json @@ -0,0 +1,211 @@ +{ + "name": "control-hello", + "cases": [ + { + "name": "accept-valid-client-hello", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-1", + "type": "hello", + "timestamp": 1700000000000, + "payload": { + "role": "client", + "deviceId": "fixture-client-1", + "accessToken": "fixture-access-token", + "protocols": [1], + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": true + } + }, + { + "name": "accept-valid-host-hello", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-2", + "type": "hello", + "timestamp": 1700000000000, + "payload": { + "role": "host", + "deviceId": "fixture-host-1", + "accessToken": "fixture-access-token", + "protocols": [1], + "capabilities": ["transport.relay", "harness.api.v1"], + "clientVersion": "0.4.2", + "harnessVersion": "0.1.1-rc.2" + } + }, + "expect": { + "accepted": true + } + }, + { + "name": "reject-hello-with-missing-device-id", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-3", + "type": "hello", + "timestamp": 1700000000000, + "payload": { + "role": "client", + "accessToken": "fixture-access-token", + "protocols": [1], + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": false + } + }, + { + "name": "reject-hello-with-empty-access-token", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-4", + "type": "hello", + "timestamp": 1700000000000, + "payload": { + "role": "client", + "deviceId": "fixture-client-1", + "accessToken": "", + "protocols": [1], + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": false + } + }, + { + "name": "reject-hello-with-duplicate-protocols", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-5", + "type": "hello", + "timestamp": 1700000000000, + "payload": { + "role": "client", + "deviceId": "fixture-client-1", + "accessToken": "fixture-access-token", + "protocols": [1, 1], + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": false + } + }, + { + "name": "reject-hello-with-duplicate-capabilities", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-6", + "type": "hello", + "timestamp": 1700000000000, + "payload": { + "role": "client", + "deviceId": "fixture-client-1", + "accessToken": "fixture-access-token", + "protocols": [1], + "capabilities": ["transport.relay", "transport.relay"] + } + }, + "expect": { + "accepted": false + } + }, + { + "name": "accept-valid-hello-ack", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-ack-1", + "type": "hello.ack", + "timestamp": 1700000000000, + "payload": { + "protocol": 1, + "serverVersion": "0.4.2", + "connectionSessionId": "fixture-control-session-1", + "heartbeatIntervalMs": 25000, + "maxControlFrameBytes": 65536, + "maxRelayFrameBytes": 1048576, + "capabilities": ["transport.relay", "harness.api.v1"] + } + }, + "expect": { + "accepted": true + } + }, + { + "name": "reject-hello-ack-with-unsupported-version", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-ack-2", + "type": "hello.ack", + "timestamp": 1700000000000, + "payload": { + "protocol": 2, + "serverVersion": "0.4.2", + "connectionSessionId": "fixture-control-session-2", + "heartbeatIntervalMs": 25000, + "maxControlFrameBytes": 65536, + "maxRelayFrameBytes": 1048576, + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": false + } + }, + { + "name": "reject-hello-ack-with-missing-session-id", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-ack-3", + "type": "hello.ack", + "timestamp": 1700000000000, + "payload": { + "protocol": 1, + "serverVersion": "0.4.2", + "heartbeatIntervalMs": 25000, + "maxControlFrameBytes": 65536, + "maxRelayFrameBytes": 1048576, + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": false + } + }, + { + "name": "reject-hello-ack-with-missing-frame-limits", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "fixture-frame-hello-ack-4", + "type": "hello.ack", + "timestamp": 1700000000000, + "payload": { + "protocol": 1, + "serverVersion": "0.4.2", + "connectionSessionId": "fixture-control-session-4", + "heartbeatIntervalMs": 25000, + "capabilities": ["transport.relay"] + } + }, + "expect": { + "accepted": false + } + } + ] +}