Data and Knowledge SystemsVersioning and migrationPrincipal
How can an Avro reader default invent historical approval, and how should the data contract recover?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A new reader adds approved:boolean with default true. Old request events lack the field but now appear approved in an AI report. Explain writer/reader resolution, distinguish missing, false and schema-valid null, and design truthful approval provenance, backfill and fail-closed execution without labeling missing history as rejection.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
A compatibility check can establish that a reader decodes older records without establishing that the decoded values represent historical decisions. Under Avro schema resolution, a reader uses its field default when the writer's record has no matching field. The old events did not contain approved. The new reader supplied true. A newer writer explicitly encoding false is different. An explicit null is valid only under an appropriate nullable writer/reader schema. It is not repaired by the Boolean field’s default. Confluent's schema evolution guide explains the compatibility mechanism, but the business meaning of a default belongs to the product.
For a small fixture, the old writer stores only request identity R1. The new reader synthesizes approved=true because the field is absent. A writer that stores approved=false retains that explicit decision. Supplying null to a Boolean-only field is a schema error, not a request to substitute true. If a later union permits null, the application still must decide whether null means unknown, pending or something else. A decoder default cannot make that business decision retroactively.
I would inspect raw events with their writer schema IDs and the exact reader version the report used. Count how many approvals came from explicit values versus a default substituted while decoding. Compare against the authority that actually records an approval decision. A field named approved is especially risky because an old request with no decision is not equivalent to an approved request. Nor is it automatically equivalent to a rejection. It might be unknown or pending.
The repair is a data contract with an explicit state model and provenance, not merely a different Boolean default. One option is a separate approval decision event keyed to request ID, with actor, time and policy version. Another is an enum with UNKNOWN, PENDING, APPROVED and REJECTED, if the lifecycle really fits those states. The old events should map to UNKNOWN unless a separate authoritative decision can be joined. Run a bounded backfill from that source, version the report and disclose any restatement. Downstream authorization must never infer permission from a compatibility default. Gate it on an explicit current approval record.
What if someone proposes default false because it is safe? It may be a safe execution fallback when a decision is missing. It is not a truthful historical label saying all old requests were rejected. Keep operational fail-closed behavior separate from reporting semantics. Test each reader version against old records, explicit false, explicit true and explicit null. The CDC field is still called amount. When did its units change? asks what happens when a field called amount silently changes units. This page is about a newly added field whose valid decoding invents a business decision.
Related questions
Keep practising data and knowledge systems
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux