fix(confidence-engine): unwrap synthesis provider response
This commit is contained in:
@@ -56,9 +56,10 @@ const agreedFinding = () => ({
|
||||
/** Fake provider factory for tests */
|
||||
const makeFakeProvider = (defaultResponse) => ({
|
||||
generateReconstruction: vi.fn(async () => {
|
||||
return typeof defaultResponse === "function"
|
||||
? defaultResponse()
|
||||
const response = typeof defaultResponse === "function"
|
||||
? await defaultResponse()
|
||||
: JSON.stringify({ currentUnderstanding: "Synthesized output" });
|
||||
return { response, providerApiPath: "/test-provider" };
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -383,6 +384,14 @@ describe("synthesizeCurrentUnderstanding — full seam", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("unwraps the provider response before validating the synthesis narrative", async () => {
|
||||
const fake = makeFakeProvider(() => ({ currentUnderstanding: "Wrapped narrative" }));
|
||||
await expect(synthesizeCurrentUnderstanding(
|
||||
{ situationGraph: fullScenario, findings: [] },
|
||||
{ provider: fake },
|
||||
)).resolves.toEqual({ currentUnderstanding: "Wrapped narrative" });
|
||||
});
|
||||
|
||||
it("supported node content flows to provider via synthesis prompt", async () => {
|
||||
const fake = makeFakeProvider();
|
||||
await synthesizeCurrentUnderstanding(
|
||||
|
||||
Reference in New Issue
Block a user