fix(confidence-engine): expose failed provider path

This commit is contained in:
2026-09-05 17:00:33 +01:00
parent 677f5e5757
commit dabd9e2245
9 changed files with 81 additions and 6 deletions
@@ -112,6 +112,22 @@ describe("normaliseAnalysisResponse", () => {
});
describe("analyseScenario compatibility", () => {
it("preserves an attempted provider API path on provider failure", async () => {
const providerError = new Error("Provider failed");
providerError.providerApiPath = "/api/chat";
mockGenerateReconstruction.mockRejectedValue(providerError);
const { analyseScenario } = await import("@/lib/analysis.js");
const result = await analyseScenario("Scenario text", {
promptVersion: "v0.3",
});
expect(result).toMatchObject({
success: false,
providerApiPath: "/api/chat",
});
});
it("succeeds when the only mismatch is null evidence source", async () => {
mockGenerateReconstruction.mockResolvedValue({
inputClassification: {