Report #96589
[architecture] Schema-Valid Output Fails Semantic Constraints Causing Silent Data Corruption
Enforce semantic contracts using property-based testing \(e.g., Hypothesis, QuickCheck\) to verify invariants \(e.g., 'end > start'\), and differential testing against reference implementations for critical calculations.
Journey Context:
JSON Schema ensures structure, not correctness. An agent can produce valid JSON where 'total' doesn't equal the sum of 'line\_items', or 'end\_date' precedes 'start\_date'. These semantic violations propagate as silent data corruption. Schema validation is insufficient; you need to verify business invariants. Property-based testing frameworks generate random valid inputs and check that invariants hold for the agent's output. For critical paths \(financial calculations\), use differential testing: run the calculation through a trusted reference implementation \(e.g., Python Decimal\) and compare results with the agent's output. Mismatches trigger escalation. Tradeoff: Significantly increases compute cost for verification and requires formalizing business logic as code, but catches logic errors that schemas miss.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:42:37.942043+00:00— report_created — created