feat: pin sessions to workspace revisions

This commit is contained in:
2026-08-04 05:05:20 +02:00
parent 90894176b6
commit 301db4bd85
14 changed files with 288 additions and 54 deletions
+11 -2
View File
@@ -6,16 +6,25 @@ import {
deleteSession, getSessionDocuments,
} from "./sessions";
test("createSession POSTs only {question} and returns the id", async () => {
test("createSession migrates legacy selections and POSTs browser preferences", async () => {
localStorage.clear();
let body: unknown = null;
server.use(
http.get("http://localhost:8787/settings", () => HttpResponse.json({
workspace: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "low",
})),
http.post("http://localhost:8787/sessions", async ({ request }) => {
body = await request.json();
return HttpResponse.json({ id: "s1" });
}),
);
expect(await createSession({ question: "q" })).toEqual({ id: "s1" });
expect(body).toEqual({ question: "q" });
expect(body).toEqual({
question: "q", workspaceId: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "low",
});
expect(JSON.parse(localStorage.getItem("thothii.workspace-registry.v1.preferences")!)).toEqual({
workspaceId: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "low",
});
});
test.each([202, 204])("prewarmRuntime accepts a body-less %s response", async (status) => {