feat(confidence-engine): constrain reconstruction chat output

This commit is contained in:
2026-09-05 18:44:47 +01:00
parent 8c5b47bcf5
commit c7a0a79d0f
3 changed files with 20 additions and 3 deletions
+3 -1
View File
@@ -82,7 +82,9 @@
- Zod upgraded from 3.25.76 to 4.5.4. Reconstruction and direct Zod-owner suites pass, and native `z.toJSONSchema()` converts the production reconstruction schema with required closed enum constraints.
- Zod-3-specific error-message assertions are version-independent while retaining semantic validation evidence. Production schema semantics are unchanged and no third-party JSON-schema conversion dependency was added.
- Next unknown: whether Ollama/Qwen accepts and obeys the generated schema through `/api/chat` format.
- Reconstruction `/api/chat` now sends `z.toJSONSchema(reconstructionV2Schema)` rather than generic `format: "json"`; the same canonical Zod contract constrains generation and remains the post-hoc validator.
- The deterministic provider-boundary test passes 2/2 under Node. A direct configured Ollama/Qwen `/api/chat` call accepted and obeyed the full schema in one call; `/api/generate`, chat detection, fallback, prompt, temperature, retries, and schema semantics are unchanged.
- Production repeatability remains untested after this change. Next restart point: a small repeated `/api/cases/start` stability observation using the fixed manufacturing scenario.
## Current product architecture