todo2code

Ticket 006: Canonical structured-output conformance

Goal and scope

Make structured LLM responses fail with precise, auditable contract diagnostics and remove drift between the response schema sent to a provider, the published JSON Schema and runtime validation. Start with the experimental semantic reranker because ticket-005 measured three different provider violations on a tracked repository.

Executable implementation belongs in src/, regression coverage in test/ and optional live reproducers in scripts/research/. This ticket directory is limited to governance, decisions, logs and captured evidence.

Acceptance criteria

Non-goals

Participants

Evidence

Approval

The agent deliberately does not materialize that decision as a human-authored participant file. A human or trusted intake boundary must do so.

Conclusion

The conformance hardening is retained; semantic production enablement remains rejected. The provider schema, runtime validator and TypeScript shape now share one internal definition, while full verification checks it against the published result schema. Diagnostics identify the exact property plus provider, resolved model and response ID without retaining the raw response.

Neither tested route met the contract. qwen/qwen3.7-plus produced three different envelope/type violations in ticket-005. qwen/qwen3.7-flash added the forbidden property response.decisions[0].decision. Both failed before graph mutation. No reranker was exported or enabled.