refactor: make browser workspace writes bootstrap-only
This commit is contained in:
@@ -4,7 +4,7 @@ import userEvent from "@testing-library/user-event";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { server } from "../test/msw";
|
||||
import { canonicalWorkspaceFixture } from "../test/workspace-fixtures";
|
||||
import { canonicalWorkspaceFixture, workspaceSummaryFixture } from "../test/workspace-fixtures";
|
||||
import { useSessionStore } from "../store/sessionStore";
|
||||
import { ComposerFooter, ContextGauge, SteerInput } from "./SteerInput";
|
||||
|
||||
@@ -24,8 +24,10 @@ test("new sessions send the browser-selected workspace, model, provider, and thi
|
||||
}));
|
||||
server.use(
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
...workspaceSummaryFixture("psd-clinical", {
|
||||
displayName: "PSD Clinical",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
}),
|
||||
}])),
|
||||
http.get("/api/workspaces/psd-clinical", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("psd-clinical"),
|
||||
@@ -136,8 +138,10 @@ test("footer shows cumulative k-token counters after workspace and context gauge
|
||||
workspace: "psd", provider: "zai", model: "glm-5.2", thinking: "medium",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd", name: "psd", file: "psd.yaml", displayName: "PSD", language: "en",
|
||||
revision: { id: "psd", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
...workspaceSummaryFixture("psd", {
|
||||
displayName: "PSD",
|
||||
revision: { id: "psd", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
}),
|
||||
}])),
|
||||
http.get("/api/workspaces/psd", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("psd"),
|
||||
@@ -175,8 +179,10 @@ test("footer limits model choices to the selected workspace policy", async () =>
|
||||
workspace: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "medium",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
...workspaceSummaryFixture("psd-clinical", {
|
||||
displayName: "PSD Clinical",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
}),
|
||||
}])),
|
||||
http.get("/api/workspaces/psd-clinical", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("psd-clinical"),
|
||||
@@ -208,8 +214,8 @@ test("switching workspaces replaces an out-of-policy model before session creati
|
||||
workspace: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", language: "en", revision: revision("research") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en", revision: revision("psd-clinical") },
|
||||
workspaceSummaryFixture("research", { displayName: "Research", revision: revision("research") }),
|
||||
workspaceSummaryFixture("psd-clinical", { displayName: "PSD Clinical", revision: revision("psd-clinical") }),
|
||||
])),
|
||||
http.get("/api/workspaces/research", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("research", ["deepseek/deepseek-v4-pro"]),
|
||||
@@ -259,8 +265,8 @@ test("immediate submit waits for a switched workspace policy before creating a s
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "research" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", language: "en", revision: revision("research") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en", revision: revision("psd-clinical") },
|
||||
workspaceSummaryFixture("research", { displayName: "Research", revision: revision("research") }),
|
||||
workspaceSummaryFixture("psd-clinical", { displayName: "PSD Clinical", revision: revision("psd-clinical") }),
|
||||
])),
|
||||
http.get("/api/workspaces/research", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("research", ["deepseek/deepseek-v4-pro"]), revision: revision("research"),
|
||||
@@ -315,7 +321,7 @@ test("initial restored workspace waits for its delayed policy before creating a
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "psd-clinical" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en", revision: revision("psd-clinical") },
|
||||
workspaceSummaryFixture("psd-clinical", { displayName: "PSD Clinical", revision: revision("psd-clinical") }),
|
||||
])),
|
||||
http.get("/api/workspaces/psd-clinical", async () => {
|
||||
policyRequestStarted = true;
|
||||
@@ -359,7 +365,10 @@ test("initial submit rejects a workspace summary that omits the canonical revisi
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "broken-workspace" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "broken-workspace", name: "broken-workspace", file: "broken-workspace.yaml", displayName: "Broken workspace", language: "en",
|
||||
...workspaceSummaryFixture("broken-workspace", {
|
||||
displayName: "Broken workspace",
|
||||
configurationState: "configuration_required",
|
||||
}),
|
||||
}])),
|
||||
http.get("/api/models", () => HttpResponse.json({ models: [
|
||||
{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true },
|
||||
@@ -432,9 +441,9 @@ test("submit follows a rapid workspace switch instead of waiting for an abandone
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "research" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", language: "en", revision: revision("research") },
|
||||
{ id: "workspace-b", name: "workspace-b", file: "workspace-b.yaml", displayName: "Workspace B", language: "en", revision: revision("workspace-b") },
|
||||
{ id: "workspace-c", name: "workspace-c", file: "workspace-c.yaml", displayName: "Workspace C", language: "en", revision: revision("workspace-c") },
|
||||
workspaceSummaryFixture("research", { displayName: "Research", revision: revision("research") }),
|
||||
workspaceSummaryFixture("workspace-b", { displayName: "Workspace B", revision: revision("workspace-b") }),
|
||||
workspaceSummaryFixture("workspace-c", { displayName: "Workspace C", revision: revision("workspace-c") }),
|
||||
])),
|
||||
http.get("/api/workspaces/research", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("research", ["deepseek/deepseek-v4-pro"]), revision: revision("research"),
|
||||
|
||||
Reference in New Issue
Block a user