From 90da976395a7c8fdcf2c50106207b813e6dec571 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 05:45:50 +0000 Subject: [PATCH] Assert structured validation errors in websocket smoke flow Co-authored-by: Theo Browne --- apps/t3/scripts/smoke-test.mjs | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/apps/t3/scripts/smoke-test.mjs b/apps/t3/scripts/smoke-test.mjs index b7a1dffbb4..69ef380249 100644 --- a/apps/t3/scripts/smoke-test.mjs +++ b/apps/t3/scripts/smoke-test.mjs @@ -1856,6 +1856,45 @@ async function main() { ); }); + const invalidShellEditorResponse = await sendWsRequest(ws, { + id: "smoke-shell-invalid-editor", + method: "shell.openInEditor", + params: { + cwd: appRoot, + editor: "unknown-editor", + }, + }); + if ( + invalidShellEditorResponse.ok !== false || + invalidShellEditorResponse.error?.code !== "request_failed" || + typeof invalidShellEditorResponse.error?.message !== "string" || + (!invalidShellEditorResponse.error.message.includes("Unknown editor") && + !invalidShellEditorResponse.error.message.includes("Invalid enum value")) + ) { + throw new Error( + `Smoke test failed: expected structured invalid-editor error response, got ${JSON.stringify( + invalidShellEditorResponse, + )}.`, + ); + } + + const invalidTerminalCwdResponse = await sendWsRequest(ws, { + id: "smoke-terminal-invalid-cwd", + method: "terminal.run", + params: { + command: "echo should-not-run", + cwd: path.join(appRoot, "__missing_smoke_dir__"), + }, + }); + if ( + invalidTerminalCwdResponse.ok !== false || + invalidTerminalCwdResponse.error?.code !== "request_failed" || + typeof invalidTerminalCwdResponse.error?.message !== "string" || + !invalidTerminalCwdResponse.error.message.includes("Working directory does not exist") + ) { + throw new Error("Smoke test failed: expected structured invalid-cwd terminal.run error."); + } + const replacedClientClosed = waitForCloseCode(ws, 4000, "replaced-client"); const replacementWs = new WebSocket(wsUrl); await new Promise((resolve, reject) => {