Data Contracts for AI Pipelines, Schema Drift Is a Quality Bug

Pull-quote: “A dashboard with a broken schema shows a blank chart, and someone files a ticket. A model with a broken schema keeps answering, and nobody files anything.”
Why this matters
Schema drift does not throw an exception in an AI system; it lowers the quality of answers while everything reports healthy. A renamed column turns a feature to null and the model imputes around it. A unit change from cents to dollars shifts a distribution a hundredfold and every downstream threshold quietly misfires. An enum gains a value the prompt has never seen. A free-text field starts arriving with embedded HTML and retrieval quality sags. Dashboards break loudly. Models degrade politely, and that asymmetry is why schema drift is an AI quality problem, and why the fix is contractual, not heroic.
What the contract pins
| Clause | What it pins | AI failure it prevents |
|---|---|---|
| Schema | Column names, types, nullability | Silent nulls and imputation drift |
| Semantics | Units, grain, enum domains, timezones | Distribution shifts, wrong joins, unseen categories |
| Freshness | Maximum staleness, delivery schedule | Stale context and training-serving skew |
| Volume | Expected row counts and distribution envelopes | Partial loads read as the whole truth |
| Change process | Versioning, deprecation window, named owner | Breaking changes that arrive as surprises |
A contract is a producer’s promise with a consumer’s tests attached. The named owner matters more than any clause: when the contract breaks, the page goes to the producer who changed the data, not to the AI team that discovered it three layers downstream.
Enforcement lives in the pipeline
A contract that lives in a wiki is a wish. On Databricks, the clauses compile into the pipeline itself. Delta Lake schema enforcement rejects incompatible writes at the boundary. Lakeflow and DLT expectations encode the semantic and volume clauses: fail the update on critical violations, drop and quarantine rows on tolerable ones, and record violation counts either way. Unity Catalog carries the social half of the contract: ownership, documentation, and lineage, which is how a producer discovers who consumes a table before changing it rather than after. The medallion boundary is the natural gate. Nothing promotes from bronze to silver without passing its contract, so consumers keep reading the last good version while the violation is worked. In CI, producer changes validate against the registered contract before merge, which converts “the data changed” from an outage into a review comment.
producer service · source system
│
▼
contract gate: schema enforcement ·
DLT expectations · volume checks
│ │
pass ▼ └─ violation
bronze ──► silver ──► gold │
│ │ ▼
▼ ▼ quarantine + page
feature store RAG index · the producer
(train / serve) agent tools
(consumers hold last good version)
SPC for pipelines
The mental model is older than the lakehouse: statistical process control. Monitor the process, not just the output; set control limits; stop the line when the process leaves them. Manufacturing quality has run on this discipline for decades, and data production deserves the same treatment: a distribution envelope is a control chart for a column, and a quarantine is a stop-the-line event with a named responder. Data producers rarely think of themselves as running a production line, but every AI consumer downstream is betting that they do. The other half of the rigor comes from the consumer side: an agent that validates every tool argument against a schema before touching data is already enforcing a contract at the point of use, and data contracts extend exactly that discipline upstream, so the data itself is held to the standard the tools already enforce.
Closing
AI pipelines inherit every upstream carelessness and amplify it silently, which is why the contract has to be explicit, versioned, owned, and enforced in the pipeline rather than in the wiki. Pin schema, semantics, freshness, volume, and the change process. Compile the clauses into expectations at the medallion boundary. Page the producer, protect the consumer, and let CI catch the breaking change while it is still a diff. Silence is the failure mode. Contracts are how the data starts speaking up.
