fix(confidence-engine): resolve synthesis model configuration
This commit is contained in:
@@ -384,6 +384,50 @@ describe("synthesizeCurrentUnderstanding — full seam", () => {
|
||||
).rejects.toThrow(/OLLAMA_BASE_URL/);
|
||||
});
|
||||
|
||||
|
||||
// ── Configured model resolution ──────────────────────────
|
||||
|
||||
it("default synthesis path resolves configured modelName — provider receives non-null", async () => {
|
||||
const fake = makeFakeProvider();
|
||||
|
||||
// Stub the configured model so test does not depend on dev-machine .env.local
|
||||
const savedModel = process.env.OLLAMA_MODEL;
|
||||
process.env.OLLAMA_MODEL = "configured-model-v0.50";
|
||||
|
||||
try {
|
||||
const result = await synthesizeCurrentUnderstanding(
|
||||
{ situationGraph: canonicalGraph, findings: [] },
|
||||
{ provider: fake }
|
||||
);
|
||||
|
||||
expect(result.currentUnderstanding).toBe("Synthesized output");
|
||||
|
||||
// KEY ASSERTION: configured model must flow to provider
|
||||
const receivedModel = fake.generateReconstruction.mock.calls[0][1];
|
||||
expect(receivedModel).toBeDefined();
|
||||
expect(receivedModel).not.toBeNull();
|
||||
expect(typeof receivedModel).toBe("string");
|
||||
expect(receivedModel.length).toBeGreaterThan(0);
|
||||
} finally {
|
||||
// Restore original env value (may be undefined)
|
||||
if (savedModel == null) {
|
||||
delete process.env.OLLAMA_MODEL;
|
||||
} else {
|
||||
process.env.OLLAMA_MODEL = savedModel;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("explicit modelName dependency overrides default — provider receives injected model", async () => {
|
||||
const fake = makeFakeProvider();
|
||||
await synthesizeCurrentUnderstanding(
|
||||
{ situationGraph: canonicalGraph, findings: [] },
|
||||
{ provider: fake, modelName: "test-model-v0.50" }
|
||||
);
|
||||
|
||||
expect(fake.generateReconstruction.mock.calls[0][1]).toBe("test-model-v0.50");
|
||||
});
|
||||
|
||||
// ── Provider sees full graph, not just centralStatement ───
|
||||
|
||||
it("provider receives full canonical graph content (nodes + edges + centralStatement)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user