Description
tests/terminal_exit_regression.rs fails on macOS: wait_for_shell_prompt() always exhausts its 15-second deadline because the test never performs the snapshot_request handshake that the real client performs on connect.
Linux CI does not catch this because ci.yml runs cargo test --lib, which excludes the tests/ directory entirely. Only windows-ci.yml runs cargo test --workspace --all-targets.
Steps to reproduce
On macOS, from a clean checkout of dev:
cargo test --test terminal_exit_regression
The test hangs for 15 seconds and then fails, having collected no output frames.
Cause
After opening the WebSocket, the test calls wait_for_shell_prompt() (line 357) and waits for a message of type: "output". But the first and only ws.send in the test happens at line 359 — after that wait — and sends input, not a handshake:
wait_for_shell_prompt(&mut ws).await?; // 357: waits for output
ws.send(Message::Text( // 359: first ws.send, too late
serde_json::json!({ "type": "input", "data": "exit\r" }).to_string(),
)).await?;
The real client sends snapshot_request on connect — the protocol type is declared in frontend/src/types/protocol.ts:20, useTerminal.ts:891 explicitly tracks that the client "owes the server a snapshot_request", and the server handles it in src/ws/mod.rs. Without it the server emits nothing, so the test's 15-second deadline expires.
Suggested fix
Send the handshake before waiting for the prompt:
ws.send(Message::Text(
serde_json::json!({ "type": "snapshot_request", "cols": 80, "rows": 24 }).to_string(),
))
.await?;
wait_for_shell_prompt(&mut ws).await?;
Verified locally on a clean worktree at 156c9973: without the handshake the test fails after the full 15-second timeout; with it the test passes in about 1.5 seconds.
Related: CI coverage gap
ci.yml line 74 runs cargo test --lib, so no integration test under tests/ runs on Linux CI. If that is unintentional, cargo test --all-targets there would surface this class of failure. Filing that observation here rather than as a separate issue since the two are connected — happy to split it out if you'd prefer.
Environment
- Branch
dev @ 156c9973, verified on an unmodified worktree
- macOS
Description
tests/terminal_exit_regression.rsfails on macOS:wait_for_shell_prompt()always exhausts its 15-second deadline because the test never performs thesnapshot_requesthandshake that the real client performs on connect.Linux CI does not catch this because
ci.ymlrunscargo test --lib, which excludes thetests/directory entirely. Onlywindows-ci.ymlrunscargo test --workspace --all-targets.Steps to reproduce
On macOS, from a clean checkout of
dev:The test hangs for 15 seconds and then fails, having collected no
outputframes.Cause
After opening the WebSocket, the test calls
wait_for_shell_prompt()(line 357) and waits for a message oftype: "output". But the first and onlyws.sendin the test happens at line 359 — after that wait — and sendsinput, not a handshake:The real client sends
snapshot_requeston connect — the protocol type is declared infrontend/src/types/protocol.ts:20,useTerminal.ts:891explicitly tracks that the client "owes the server a snapshot_request", and the server handles it insrc/ws/mod.rs. Without it the server emits nothing, so the test's 15-second deadline expires.Suggested fix
Send the handshake before waiting for the prompt:
Verified locally on a clean worktree at
156c9973: without the handshake the test fails after the full 15-second timeout; with it the test passes in about 1.5 seconds.Related: CI coverage gap
ci.ymlline 74 runscargo test --lib, so no integration test undertests/runs on Linux CI. If that is unintentional,cargo test --all-targetsthere would surface this class of failure. Filing that observation here rather than as a separate issue since the two are connected — happy to split it out if you'd prefer.Environment
dev@156c9973, verified on an unmodified worktree