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
@@ -13,6 +13,7 @@ function renderShell() {
}
beforeEach(() => {
localStorage.clear();
FakeEventSource.instances = [];
(globalThis as any).EventSource = FakeEventSource;
useSessionStore.getState().resetSession();
@@ -121,8 +122,7 @@ test("a DWH-unreachable precheck shows a specific alert and preserves the questi
expect(FakeEventSource.instances).toHaveLength(0);
});
test("model selector shows the three Pi-enabled models and persists the selected provider", async () => {
let saved: unknown;
test("model selector shows the three Pi-enabled models and stores the selected provider locally", async () => {
server.use(
http.get("http://localhost:8787/settings", () => HttpResponse.json({
workspace: "default", provider: "zai", model: "glm-5.2", thinking: "low",
@@ -132,11 +132,6 @@ test("model selector shows the three Pi-enabled models and persists the selected
{ provider: "deepseek", id: "deepseek-v4-flash", name: "DeepSeek V4 Flash", reasoning: true },
{ provider: "local-qwen", id: "qwen3.6-35b-a3b", name: "Qwen3.6 35B A3B Local", reasoning: false },
] })),
http.put("http://localhost:8787/settings", async ({ request }) => {
const body = await request.json() as Record<string, string>;
saved = body;
return HttpResponse.json(body);
}),
);
renderShell();
@@ -147,9 +142,10 @@ test("model selector shows the three Pi-enabled models and persists the selected
]);
});
await userEvent.selectOptions(select, "qwen3.6-35b-a3b");
await waitFor(() => expect(saved).toMatchObject({
provider: "local-qwen", model: "qwen3.6-35b-a3b",
}));
await waitFor(() => expect(JSON.parse(localStorage.getItem("thothii.workspace-registry.v1.preferences")!))
.toEqual({
workspaceId: "default", provider: "local-qwen", model: "qwen3.6-35b-a3b", thinking: "low",
}));
});