Skip to content

Commit 1b20090

Browse files
authored
fix: CI smoke test speaks v2 JSON-RPC (#77)
The macOS Compatibility smoke test still sent raw v1 lines (ping, send) and failed on main after the v1 protocol removal (#75) with a v1_removed error — the one consumer the migration inventory missed because it greps workflows for test paths, not inline socket writes. Ported to system.ping and surface.send_text.
1 parent 7bffe83 commit 1b20090

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

scripts/smoke-test-ci.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,34 @@ if [ "$SOCKET_READY" != "true" ]; then
7575
exit 1
7676
fi
7777

78-
# --- Ping the socket ---
78+
# --- Ping the socket (v2 JSON-RPC) ---
7979
echo "Pinging socket..."
8080
PING_RESPONSE=$(python3 -c "
81-
import socket
81+
import json, socket
8282
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
8383
s.connect('$SOCKET_PATH')
8484
s.settimeout(5.0)
85-
s.sendall(b'ping\n')
86-
data = s.recv(1024).decode().strip()
85+
s.sendall(json.dumps({'id': 1, 'method': 'system.ping'}).encode() + b'\n')
86+
data = s.recv(4096).decode().strip()
8787
s.close()
88-
print(data)
88+
res = json.loads(data)
89+
print('PONG' if res.get('ok') and res.get('result', {}).get('pong') else data)
8990
")
9091
echo "Ping response: $PING_RESPONSE"
9192
if [ "$PING_RESPONSE" != "PONG" ]; then
9293
echo "ERROR: Expected PONG, got: $PING_RESPONSE"
9394
exit 1
9495
fi
9596

96-
# --- Send a command to the terminal ---
97+
# --- Send a command to the terminal (v2 JSON-RPC) ---
9798
echo "Sending 'time' command to terminal..."
9899
SEND_RESPONSE=$(python3 -c "
99-
import socket
100+
import json, socket
100101
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
101102
s.connect('$SOCKET_PATH')
102103
s.settimeout(5.0)
103-
s.sendall(b'send time\\\n\n')
104-
data = s.recv(1024).decode().strip()
104+
s.sendall(json.dumps({'id': 2, 'method': 'surface.send_text', 'params': {'text': 'time\n'}}).encode() + b'\n')
105+
data = s.recv(4096).decode().strip()
105106
s.close()
106107
print(data)
107108
")
@@ -120,16 +121,17 @@ if ! kill -0 "$APP_PID" 2>/dev/null; then
120121
exit 1
121122
fi
122123

123-
# --- Final ping ---
124+
# --- Final ping (v2 JSON-RPC) ---
124125
FINAL_PING=$(python3 -c "
125-
import socket
126+
import json, socket
126127
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
127128
s.connect('$SOCKET_PATH')
128129
s.settimeout(5.0)
129-
s.sendall(b'ping\n')
130-
data = s.recv(1024).decode().strip()
130+
s.sendall(json.dumps({'id': 3, 'method': 'system.ping'}).encode() + b'\n')
131+
data = s.recv(4096).decode().strip()
131132
s.close()
132-
print(data)
133+
res = json.loads(data)
134+
print('PONG' if res.get('ok') and res.get('result', {}).get('pong') else data)
133135
")
134136
echo "Final ping: $FINAL_PING"
135137
if [ "$FINAL_PING" != "PONG" ]; then

0 commit comments

Comments
 (0)