fix(confidence-engine): expose reconstruction failure evidence
This commit is contained in:
@@ -23,6 +23,7 @@ export async function POST(request) {
|
|||||||
validationErrors: result.validationErrors,
|
validationErrors: result.validationErrors,
|
||||||
diagnostics: result.diagnostics,
|
diagnostics: result.diagnostics,
|
||||||
analysisErrors: result.analysisErrors,
|
analysisErrors: result.analysisErrors,
|
||||||
|
rawResponse: result.rawResponse ?? undefined,
|
||||||
},
|
},
|
||||||
{ status },
|
{ status },
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ describe("app/api/cases/start route", () => {
|
|||||||
error: "Provider unavailable",
|
error: "Provider unavailable",
|
||||||
diagnostics: { modelName: "llama3" },
|
diagnostics: { modelName: "llama3" },
|
||||||
statusCode: 502,
|
statusCode: 502,
|
||||||
|
rawResponse: '{"reconstruction":{"summary":""}}',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { POST } = await import("@/app/api/cases/start/route.js");
|
const { POST } = await import("@/app/api/cases/start/route.js");
|
||||||
@@ -94,7 +95,9 @@ describe("app/api/cases/start route", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(response.status).toBe(502);
|
expect(response.status).toBe(502);
|
||||||
await expect(response.json()).resolves.not.toHaveProperty("stack");
|
const body = await response.json();
|
||||||
|
expect(body).toHaveProperty("rawResponse");
|
||||||
|
expect(body.rawResponse).toBe('{"reconstruction":{"summary":""}}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns structured 500 on malformed JSON", async () => {
|
it("returns structured 500 on malformed JSON", async () => {
|
||||||
|
|||||||
@@ -531,6 +531,7 @@ describe("lib/graph/orchestrator startCase", () => {
|
|||||||
analysisErrors: ["socket hang up"],
|
analysisErrors: ["socket hang up"],
|
||||||
statusCode: 502,
|
statusCode: 502,
|
||||||
});
|
});
|
||||||
|
expect(result).toHaveProperty("rawResponse");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns null selectedQuestion when neither analysis nor graph path yields a question", async () => {
|
it("returns null selectedQuestion when neither analysis nor graph path yields a question", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user