feat(confidence-engine): expose initial reconstruction evidence

This commit is contained in:
2026-09-05 12:39:17 +01:00
parent 7472b6ecb0
commit fb49df87aa
4 changed files with 40 additions and 2 deletions
+29 -1
View File
@@ -33,9 +33,33 @@ describe("app/api/cases/start route", () => {
});
it("returns 200 on success", async () => {
const reconstruction = {
summary: "Validated reconstruction summary",
relationships: [
{
id: "r1",
fromId: "u-intervention",
toId: "u-problem",
relationship: "depends_on",
description: "The intervention depends on the unresolved problem.",
confidence: "high",
},
],
};
mockStartCase.mockResolvedValue({
success: true,
situationGraph: { nodes: [{ id: "n1" }], edges: [] },
reconstruction,
situationGraph: {
nodes: [{ id: "n1" }],
edges: [
{
id: "e-unrelated",
fromNodeId: "n1",
toNodeId: "n1",
relationship: "supports",
},
],
},
selectedQuestion: null,
diagnostics: {},
});
@@ -50,6 +74,10 @@ describe("app/api/cases/start route", () => {
);
expect(response.status).toBe(200);
await expect(response.json()).resolves.toMatchObject({
success: true,
reconstruction,
});
});
it("returns 400 for invalid request input", async () => {
+3 -1
View File
@@ -371,12 +371,14 @@ describe("lib/graph/orchestrator startCase", () => {
});
it("builds a valid graph on successful analysis", async () => {
mockAnalyseScenario.mockResolvedValue(makeAnalysisResult());
const analysis = makeAnalysisResult();
mockAnalyseScenario.mockResolvedValue(analysis);
const { startCase } = await import("@/lib/graph/orchestrator.js");
const result = await startCase({ scenario: "Scenario text" });
expect(result.success).toBe(true);
expect(result.reconstruction).toBe(analysis.reconstruction);
expect(result.situationGraph.centralStatement).toBe("Scenario text");
expect(result.situationGraph.currentSummary).toContain("Nodes:");
expect(result.diagnostics).toMatchObject({