|
|
|
@@ -6,6 +6,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
|
|
|
import { server } from "../test/msw";
|
|
|
|
|
import { canonicalWorkspaceFixture, workspaceSummaryFixture } from "../test/workspace-fixtures";
|
|
|
|
|
import { useSessionStore } from "../store/sessionStore";
|
|
|
|
|
import { workspacePreferences } from "../workspaces/preferences";
|
|
|
|
|
import { ComposerFooter, ContextGauge, SteerInput } from "./SteerInput";
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
@@ -17,11 +18,11 @@ beforeEach(() => {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("new sessions send the browser-selected workspace, model, provider, and thinking", async () => {
|
|
|
|
|
test("new sessions send the ephemeral workspace, model, provider, and thinking", async () => {
|
|
|
|
|
let body: unknown;
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "high",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
server.use(
|
|
|
|
|
http.get("/api/workspaces", () => HttpResponse.json([{
|
|
|
|
|
...workspaceSummaryFixture("psd-clinical", {
|
|
|
|
@@ -203,9 +204,9 @@ test("footer limits model choices to the selected workspace policy", async () =>
|
|
|
|
|
|
|
|
|
|
test("switching workspaces replaces an out-of-policy model before session creation", async () => {
|
|
|
|
|
let body: unknown;
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const revision = (id: string) => ({
|
|
|
|
|
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
|
|
|
|
});
|
|
|
|
@@ -256,9 +257,9 @@ test("immediate submit waits for a switched workspace policy before creating a s
|
|
|
|
|
let releasePolicy!: () => void;
|
|
|
|
|
let policyRequestStarted = false;
|
|
|
|
|
const policyMayFinish = new Promise<void>((resolve) => { releasePolicy = resolve; });
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const revision = (id: string) => ({
|
|
|
|
|
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
|
|
|
|
});
|
|
|
|
@@ -312,9 +313,9 @@ test("initial restored workspace waits for its delayed policy before creating a
|
|
|
|
|
let releasePolicy!: () => void;
|
|
|
|
|
let policyRequestStarted = false;
|
|
|
|
|
const policyMayFinish = new Promise<void>((resolve) => { releasePolicy = resolve; });
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "psd-clinical", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const revision = (id: string) => ({
|
|
|
|
|
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
|
|
|
|
});
|
|
|
|
@@ -359,9 +360,9 @@ test("initial restored workspace waits for its delayed policy before creating a
|
|
|
|
|
test("initial submit rejects a workspace summary that omits the canonical revision", async () => {
|
|
|
|
|
let body: unknown;
|
|
|
|
|
let failure: string | undefined;
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "broken-workspace", provider: "zai", model: "glm-5.2", thinking: "medium",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
server.use(
|
|
|
|
|
http.get("/api/settings", () => HttpResponse.json({ workspace: "broken-workspace" })),
|
|
|
|
|
http.get("/api/workspaces", () => HttpResponse.json([{
|
|
|
|
@@ -384,7 +385,7 @@ test("initial submit rejects a workspace summary that omits the canonical revisi
|
|
|
|
|
await userEvent.type(screen.getByRole("textbox", { name: /new question/i }), "q");
|
|
|
|
|
await userEvent.click(screen.getByRole("button", { name: /send/i }));
|
|
|
|
|
|
|
|
|
|
await waitFor(() => expect(failure).toBe("Could not load selected workspace policy. Please retry."));
|
|
|
|
|
await waitFor(() => expect(failure).toBe("Could not load workspace registry. Please retry."));
|
|
|
|
|
expect(body).toBeUndefined();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -392,9 +393,9 @@ test("failed workspace summaries block creation and report a safe error", async
|
|
|
|
|
let body: unknown;
|
|
|
|
|
let failure: string | undefined;
|
|
|
|
|
let summaryRequestFailed = false;
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "medium",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
server.use(
|
|
|
|
|
http.get("/api/settings", () => HttpResponse.json({ workspace: "psd-clinical" })),
|
|
|
|
|
http.get("/api/workspaces", () => {
|
|
|
|
@@ -432,9 +433,9 @@ test("submit follows a rapid workspace switch instead of waiting for an abandone
|
|
|
|
|
let bPolicyRequestStarted = false;
|
|
|
|
|
let cPolicyRequestStarted = false;
|
|
|
|
|
const cPolicyMayFinish = new Promise<void>((resolve) => { releaseC = resolve; });
|
|
|
|
|
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
|
|
|
|
workspacePreferences.save({
|
|
|
|
|
workspaceId: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const revision = (id: string) => ({
|
|
|
|
|
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
|
|
|
|
});
|
|
|
|
|