Skip to content

Commit 6d8b394

Browse files
committed
fix(smoke): Phase 15 probes the UI a fresh profile can actually serve
Every ui-variant smoke job failed on every platform in dry run 30226483380 — and it turns out a ui-variant Phase 15 had never legitimately passed anywhere: the old probe (a) never passed --ui=true, but the HTTP UI is a persisted DEFAULT-OFF setting, so a fresh profile (every runner, every smoke HOME) can never serve; (b) fed stdin an empty file, but the UI does not pin the process — stdio EOF ends it cleanly (rc=0) before any poll sees it serve; (c) gave a 10s window to a server measured to bind ~6s after launch on a FAST host; (d) POSTed an MCP initialize at /rpc, which speaks the UI's own narrow query protocol, not MCP. The rebuilt probe mirrors the drive-listing guard's proven invocation (--ui=true --port=N equals-form, held-open stdin), waits 30s, and verifies the API surface with the stateless GET /api/ui-config. Validated red->green against the release-shaped artifact: the full darwin ui artifact lane now passes 15a/15b legitimately. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 6655b85 commit 6d8b394

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

‎scripts/smoke-test.sh‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,17 +3362,26 @@ echo "=== Phase 15: UI HTTP server ==="
33623362
# port made the whole phase read as SKIP. The tiny TOCTOU window between
33633363
# probe and bind is the residual risk, not the common case.
33643364
UI_PORT=$(python3 -c 'import socket; s = socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1]); s.close()')
3365-
UI_INPUT=$(smoke_mktemp_file)
3366-
"$BINARY" --port "$UI_PORT" < "$UI_INPUT" > /dev/null 2>&1 &
3365+
# --ui=true is REQUIRED: the HTTP UI is a persisted, default-off setting, so
3366+
# on any fresh profile (every CI runner, every smoke HOME) a bare --port
3367+
# invocation can never serve — the probe then misread "UI disabled" as "no
3368+
# embedded assets" on binaries that carry them (first exposed when the
3369+
# ui-variant no-skip guard made Phase 15 mandatory). Stdin must be HELD OPEN:
3370+
# the UI does not pin the process, so stdio EOF ends it cleanly (rc=0) before
3371+
# the poll can see it serve — the drive-listing guard holds a pipe for the
3372+
# same reason. Equals-form flags match that guard's proven invocation.
3373+
sleep 300 | "$BINARY" --ui=true --port="$UI_PORT" > /dev/null 2>&1 &
33673374
UI_PID=$!
33683375
# Readiness poll instead of a fixed sleep: SKIP is legitimate ONLY when the
33693376
# process exited (the documented no-embedded-assets case); a slow start on a
3370-
# loaded runner must not masquerade as it.
3377+
# loaded runner must not masquerade as it. The UI binds ~6s after launch even
3378+
# on a fast host (measured against the release artifact), so the window
3379+
# matches the drive-listing guard's 25s, not a 10s sprint.
33713380
UI_READY=0
3372-
for _ in $(seq 1 100); do
3381+
for _ in $(seq 1 150); do
33733382
if ! kill -0 "$UI_PID" 2>/dev/null; then break; fi
33743383
if curl -sf "http://127.0.0.1:$UI_PORT/" -o /dev/null 2>/dev/null; then UI_READY=1; break; fi
3375-
sleep 0.1
3384+
sleep 0.2
33763385
done
33773386

33783387
if [ "$UI_READY" -eq 1 ] || kill -0 "$UI_PID" 2>/dev/null; then
@@ -3388,17 +3397,18 @@ if [ "$UI_READY" -eq 1 ] || kill -0 "$UI_PID" 2>/dev/null; then
33883397
exit 1
33893398
fi
33903399

3391-
# 15b: POST /rpc accepts JSON-RPC and returns JSON
3392-
RPC_BODY=$(curl -sf -X POST \
3393-
-H "Content-Type: application/json" \
3394-
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
3395-
"http://127.0.0.1:$UI_PORT/rpc" 2>/dev/null || echo "")
3396-
if echo "$RPC_BODY" | grep -q "jsonrpc"; then
3397-
echo "OK 15b: /rpc returns JSON-RPC response"
3400+
# 15b: the API surface answers — GET /api/ui-config is stateless and
3401+
# session-free, so it proves API reachability on any fresh profile. (The
3402+
# old probe POSTed an MCP initialize at /rpc, but the UI's /rpc speaks the
3403+
# UI's own narrow query protocol, not MCP — the probe asserted a request
3404+
# the endpoint never answered; protocol depth belongs to the UI guards.)
3405+
RPC_BODY=$(curl -sf "http://127.0.0.1:$UI_PORT/api/ui-config" 2>/dev/null || echo "")
3406+
if echo "$RPC_BODY" | grep -q "{"; then
3407+
echo "OK 15b: /api/ui-config returns JSON"
33983408
elif [ -z "$RPC_BODY" ]; then
3399-
smoke_ui_missing "15b" "/rpc not reachable"
3409+
smoke_ui_missing "15b" "/api/ui-config not reachable"
34003410
else
3401-
echo "FAIL 15b: /rpc did not return JSON-RPC"
3411+
echo "FAIL 15b: /api/ui-config did not return JSON"
34023412
kill "$UI_PID" 2>/dev/null || true
34033413
exit 1
34043414
fi
@@ -3408,7 +3418,6 @@ if [ "$UI_READY" -eq 1 ] || kill -0 "$UI_PID" 2>/dev/null; then
34083418
else
34093419
smoke_ui_missing "Phase 15" "binary exited immediately (no UI assets embedded)"
34103420
fi
3411-
rm -f "$UI_INPUT"
34123421

34133422
echo ""
34143423
echo "=== Phase 16: stdio server leaves no orphan after shutdown ==="

0 commit comments

Comments
 (0)