PRODUCTION SCENARIO
A strict schema returns an invoice with subtotal 100, tax 8 and total 150. Each field carries its declared numeric type, the currency code matches the schema's enum exactly, and the response finished with stop_reason end_turn well inside max_tokens. The tax rate is legal in the jurisdiction and the total sits inside every range the business allows. Only the three numbers taken together are impossible.
Which check does the application still have to run?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Recompute subtotal plus tax and compare the sum against the returned total
A grammar constrains shape, not meaning: it will produce three numbers of the declared type and has nothing to say about whether 100 plus 8 is 150, so a relationship between fields is checked by recomputing it in application code. Watching stop_reason for max_tokens is the guard for responses that can be cut off mid-object, and this one finished inside the ceiling. A case-insensitive enum comparison catches the documented case where Claude returns a capital letter the schema did not carry, and the code here already matches. Bounding the tax rate is right when one field can fall out of range; every field here is plausible on its own and only the arithmetic is wrong.