Contracts & Schema Evolution

Producers and consumers agreeing explicitly. Which schema changes are safe, which break silently, and why a change that passes every schema check can still destroy a metric.

Data Contracts

An explicit, owned, enforced agreement between the team that produces data and the teams that depend on it — covering names, types, nullability, meaning, freshness and how it may change.

Q · What has the producing team actually promised about this dataset, and who finds out first when the promise stops being true?
Schema Evolution

Schemas change constantly. Adding, removing, renaming and retyping a field are four different risks with four different blast radii — and only one of them is routinely safe.

Q · A field is about to change upstream. Which consumers break, which keep working, and which keep working while producing the wrong answer?
Backward Compatibility

The producer ships first: data written under the new schema must still be readable, and still correct, for consumers that have not upgraded. State it as writer-and-reader, because the word itself is used in opposite directions by different communities.

Q · If the producer deploys its schema change today and no consumer changes anything, does every consumer still get a correct answer tomorrow?
Forward Compatibility

The consumer ships first: data written under the old schema must still be readable, and still correctly interpreted, by code running the new one. In analytics this is not an edge case — every query over history is this question.

Q · If the consumer upgrades its schema today, can it still read the years of data that were written before the change — and will it interpret them the way it should?
Schema Registry

A shared, versioned store of schemas with a compatibility gate in front of it. It makes structural evolution mechanical — and it has nothing to say about meaning, ownership or the consumers reading your data by some other path.

Q · Where does a producer's schema live so that a consumer can resolve it, and what can that place actually refuse?
Breaking Schema Changes
▶ lab

A numeric field starts arriving as a string. Some consumers error; the dangerous ones cast, get null, keep every row, and report zero — with completeness, uniqueness and freshness all green.

Q · When a field's type changes upstream, which consumers fail loudly, which fail quietly, and what does the dashboard show while nobody is being paged?
Semantic Changes

The schema is identical, every type checks, every test passes, and the number now means something else. `revenue` went from gross to net. No tool will ever detect this — only documented semantics, an owner and a changelog will.

Q · A field's name, type and nullability are unchanged and its values have shifted. How would anyone find out that its definition changed rather than the business?
Nullability & Defaults

Making a field nullable is a breaking change for everyone who assumed it was not. A default hides missing data behind a plausible value. And "unknown", "not applicable" and "the pipeline dropped it" are three different facts stored identically.

Q · This column contains a null. Does that mean the value is unknown, that it does not apply, or that something in the pipeline lost it — and can anyone downstream tell?
Contract Enforcement

Where the check actually runs — producer CI, the ingestion boundary, the entry to transformation — and the trade every enforcement point makes: a silent wrong number becomes a loud failure, which is correct and will still page someone.

Q · At which point in the pipeline does a contract violation stop the data, who gets woken up when it does, and what happens to the batch that was refused?