fix(confidence-engine): permit empty plausibleInterpretations for honest zero state

- Zod validator: plausibleInterpretations accepts empty string (zero interpretations) while remaining required and string-typed
- Prompt instruction: SECTION B now explicitly requests "" instead of absence prose when no plausible inputs exist
- Report generation/update paths derive hasPlausibleInterpretations from actual synthesized data rather than hard-coding true
- Tests: updated validation contract, added hasPlausibleInterpretations derivation assertions, updated seam tests to use derived values
This commit is contained in:
2026-10-02 06:48:24 +01:00
parent 8dc6e58d43
commit 0cc9d087c3
4 changed files with 67 additions and 14 deletions
+2 -2
View File
@@ -145,7 +145,7 @@ describe("Report page identity and lifecycle — v0.60h-a (seam-level)", () => {
const resp = await fetch("/api/cases/overview", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ situationGraph: loaded?.situationGraph, findings: loaded?.findings || [] }) });
expect(resp.ok).toBe(true);
await (await import("@/lib/storage/investigation-storage")).saveInvestigation({ ...loaded, investigationReport: { understanding: "Generated.", hasPlausibleInterpretations: false, generatedFromRevision: 4 } });
await (await import("@/lib/storage/investigation-storage")).saveInvestigation({ ...loaded, investigationReport: { understanding: "Generated.", plausibleInterpretations: null, hasPlausibleInterpretations: (null ?? "").trim().length > 0, generatedFromRevision: 4 } });
expect(mockLastSavedSnapshot.id).toBe("inv-report-a");
expect(mockLastSavedSnapshot.investigationReport.generatedFromRevision).toBe(4);
});
@@ -189,7 +189,7 @@ describe("Report page identity and lifecycle — v0.60h-a (seam-level)", () => {
const resp = await fetch("/api/cases/overview", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ situationGraph: loaded?.situationGraph, findings: loaded?.findings }) });
expect(resp.ok).toBe(true);
await (await import("@/lib/storage/investigation-storage")).saveInvestigation({ ...loaded, investigationReport: { understanding: "R2.", hasPlausibleInterpretations: false, generatedFromRevision: 5 } });
await (await import("@/lib/storage/investigation-storage")).saveInvestigation({ ...loaded, investigationReport: { understanding: "R2.", plausibleInterpretations: null, hasPlausibleInterpretations: (null ?? "").trim().length > 0, generatedFromRevision: 5 } });
expect(mockLastSavedSnapshot.id).toBe("inv-report-a");
expect(mockLastSavedSnapshot.investigationReport.generatedFromRevision).toBe(5);
});