From 32d963b43dddc0159cb36e091a15f65a8637b558 Mon Sep 17 00:00:00 2001 From: mptyl Date: Sun, 28 Jun 2026 16:22:57 +0200 Subject: [PATCH] feat(frontend): NewSessionDialog reduced to question-only Removes workspace/model/provider/thinking fields. Dialog now posts only { question } to createSession and calls onCreated on success. Co-Authored-By: Claude Opus 4.8 --- frontend/src/shell/NewSessionDialog.test.tsx | 62 +++------ frontend/src/shell/NewSessionDialog.tsx | 130 +------------------ 2 files changed, 17 insertions(+), 175 deletions(-) diff --git a/frontend/src/shell/NewSessionDialog.test.tsx b/frontend/src/shell/NewSessionDialog.test.tsx index 161b1f98..09338401 100644 --- a/frontend/src/shell/NewSessionDialog.test.tsx +++ b/frontend/src/shell/NewSessionDialog.test.tsx @@ -17,52 +17,19 @@ function renderDialog() { return { onCreated }; } -beforeEach(() => { - server.use( - http.get("http://localhost:8787/workspaces", () => - HttpResponse.json([{ name: "default", file: "default.db" }]), - ), - http.post("http://localhost:8787/sessions", () => - HttpResponse.json({ id: "s1" }), - ), - ); -}); - -test("§9 degradation: empty models -> model field is a FREE-TEXT input, not a select", async () => { - server.use( - http.get("http://localhost:8787/models", () => HttpResponse.json({ models: [] })), - ); +test("the form has only a question field (no workspace/model/provider/thinking)", async () => { renderDialog(); await userEvent.click(screen.getByRole("button", { name: /nuova/i })); - - // Free-text model input present; no model dropdown. - const freetext = await screen.findByTestId("model-freetext"); - expect(freetext.tagName).toBe("INPUT"); - // The only setWorkspace(e.target.value)} - className="w-full border rounded px-2 py-1 text-sm" - > - {workspaces.length === 0 ? ( - - ) : ( - workspaces.map((w) => ( - - )) - )} - - - - {/* Model field — graceful degradation (§9): free text when models list is empty */} -
- - {modelList.length > 0 ? ( - - ) : ( - setModel(e.target.value)} - placeholder="es. claude-sonnet-4-5" - className="w-full border rounded px-2 py-1 text-sm focus:outline-none focus:ring-1" - data-testid="model-freetext" - /> - )} -
- -
- - setThinking(e.target.value)} - placeholder="enabled / disabled" - className="w-full border rounded px-2 py-1 text-sm focus:outline-none focus:ring-1" - /> -
- -
- - setProvider(e.target.value)} - placeholder="es. anthropic" - className="w-full border rounded px-2 py-1 text-sm focus:outline-none focus:ring-1" - /> -
- {error && (

{error}