fix: fail safe on missing workspace revisions
This commit is contained in:
@@ -389,6 +389,35 @@ test("initial submit rejects a migration-required workspace after summaries load
|
||||
expect(body).toBeUndefined();
|
||||
});
|
||||
|
||||
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({
|
||||
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([{
|
||||
id: "broken-workspace", name: "broken-workspace", file: "broken-workspace.yaml", displayName: "Broken workspace",
|
||||
}])),
|
||||
http.get("/api/models", () => HttpResponse.json({ models: [
|
||||
{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true },
|
||||
] })),
|
||||
http.post("/api/sessions", async ({ request }) => {
|
||||
body = await request.json();
|
||||
return HttpResponse.json({ id: "s1" });
|
||||
}),
|
||||
);
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
render(<QueryClientProvider client={client}><ComposerFooter /><SteerInput sessionId={null} onSessionCreateFailed={(message) => { failure = message; }} /></QueryClientProvider>);
|
||||
|
||||
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."));
|
||||
expect(body).toBeUndefined();
|
||||
});
|
||||
|
||||
test("failed workspace summaries block creation and report a safe error", async () => {
|
||||
let body: unknown;
|
||||
let failure: string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user