fix(confidence-engine): preserve scenario during outage

This commit is contained in:
2026-09-09 19:45:55 +01:00
parent 60c90bdd6a
commit 00d7593ffd
2 changed files with 54 additions and 3 deletions
+22
View File
@@ -14,7 +14,9 @@ import ReasoningWorkspace, {
} from "@/components/reasoning-workspace.jsx";
import {
ScenarioResultPanels,
UnavailableStartPanel,
UpdateErrorPanel,
isUnavailableStartResponse,
submitAnswerForUpdateCase,
submitScenarioForStartCase,
} from "@/components/scenario-form.jsx";
@@ -372,6 +374,26 @@ function makeCommercialUpdateSuccess(overrides = {}) {
}
describe("scenario-form UI helpers", () => {
it("recognises only the established sanitized unavailable start response", () => {
expect(isUnavailableStartResponse(
{ status: 503 },
{ success: false, error: "Reasoning service is temporarily unavailable." },
)).toBe(true);
expect(isUnavailableStartResponse(
{ status: 500 },
{ success: false, error: "Reasoning service is temporarily unavailable." },
)).toBe(false);
});
it("presents generic recovery without provider details", () => {
const html = renderToStaticMarkup(<UnavailableStartPanel onRetry={vi.fn()} />);
expect(html).toContain("Confidence Engine is temporarily unavailable.");
expect(html).toContain("Your scenario is still here and you can try again.");
expect(html).toContain(">Retry<");
expect(html).not.toMatch(/ollama|provider|local model|server|infrastructure/i);
});
it("submits to /api/cases/start", async () => {
const fetchImpl = vi.fn().mockResolvedValue({ ok: true });