The pattern is familiar. A revenue dashboard is wrong on Monday. Two days of investigation later, the cause turns out to be a column renamed in a service three teams away, by an engineer who had no idea anything downstream depended on it. The pipeline did exactly what it was told. Nobody had told it the right thing.
Most teams respond by making the pipeline more defensive. That treats the symptom. The underlying problem is that the team producing the data and the teams consuming it never agreed what the data is.
Why defensive pipelines do not fix it
Schema inference, permissive parsing and nullable-everything columns feel robust. In practice they move the failure later and make it quieter. A renamed field arrives as a new column plus a column of nulls; the load succeeds; the aggregate is wrong. A unit changes from rupees to paise and every check that only looks at types still passes.
A pipeline cannot defend against a change in meaning, because meaning is not in the data. It is in someone's head on the producing team. The durable fix is to get it out of there and into something that can be checked.
What a data contract actually is
A data contract is a short, versioned agreement between the team that produces a dataset and the teams that consume it. It is not a forty-page specification. For most datasets it fits on one screen:
| Section | What it records | Example |
|---|---|---|
| Schema | Field names, types, nullability, keys | order_id: string, not null, unique |
| Semantics | Units, currency, time zone, allowed values | Amount in INR to two decimals; status is placed, paid or cancelled |
| Service levels | Freshness and expected volume | Complete by 06:00 IST; volume within an agreed daily range |
| Ownership | Who answers when it breaks | The payments team, through a named channel |
| Change policy | How breaking changes are introduced | New major version, with an agreed overlap period |
The format matters less than where it lives. A small YAML file in the producer's repository, next to the code that emits the data, is usually enough.
Check it where the change is made
A contract that is only read by people will drift the way documentation does. What makes it work is enforcement in the producing team's CI: when a pull request changes the emitted schema, a check compares it with the contract and fails if the change is breaking without a version bump.
That moves the conversation to the right moment, before the merge and with the person who made the change, instead of after the dashboard is wrong. It also forces a useful distinction:
- Non-breaking: adding an optional field, widening an allowed range, adding a value that consumers have been told to expect.
- Breaking: renaming or removing a field, changing a type or unit, tightening nullability, changing the grain of the table.
Breaking changes are still allowed. They ship as a new version alongside the old one, with an agreed overlap, so consumers migrate on a schedule rather than in an incident.
Start with the datasets that cost you money
Contracting every table in the warehouse on day one is how these programmes stall. Start with the handful of sources that feed revenue reporting, regulatory returns or customer-facing numbers, where a silent error has a real cost. Track incidents on those before and after. If the checks are catching in pull requests what would previously have surfaced in a dashboard, extend the practice. If they are not, find out why before scaling it.
What it asks of the producing team
Be honest about the cost: contracts add some friction for the teams that produce data, and they are rarely the teams that benefit most. Two things make that acceptable. The check is automated, so the friction is a failing build with a clear message rather than a meeting. And producers learn, often for the first time, who depends on their data and why. That visibility tends to change how teams design their events more than any policy does.
Signs it is working
- Breaking changes are caught in pull requests, not in dashboards.
- "Why did this number change?" has a findable answer: a version, a date and an owner.
- Deprecations are planned and announced rather than discovered.
- Consumers stop writing defensive code for problems that can no longer reach them.
The one-paragraph version
Schema drift is not a pipeline bug; it is a missing agreement. Write down what each critical dataset means (schema, semantics, freshness, owner and change policy), keep it next to the code that produces it, and check it in that team's CI so breaking changes need a new version. Start with the few datasets where a silent error costs money, measure incidents, and extend once it demonstrably works.
Written by the Bytescope Tech engineering team from live engagement work. If you want to argue with any of it, or you have a case where the opposite held, tell us. Those are our favourite emails.