System design interview

Data Contracts Between Teams

MediumLocked55 min read

Contracts between producers and consumers: schema, freshness, volume, quality tests, enforcement, versioning.

system-designdata-contractsgovernanceschema-registry

Start here

The problem in plain words

The search team changes a field in its query logs from a number to text. It seems harmless to them. Overnight, the ranking team's model reads that field, fails to parse it, and the next morning search results are noticeably worse. Nobody told the ranking team, and the search team did not know anyone was reading that field.

When one team's data feeds another team's work, there is an invisible agreement: the shape, the meaning and the timeliness of that data. When it is only in people's heads, it gets broken by accident. A data contract writes that agreement down and makes it checkable by machines.

Think of it like an API for data. An API has a version, a documented shape, and a promise that breaking changes will come with notice. Data tables and topics deserve the same treatment.

Words you will meet

Data contract
A written, checkable agreement between the team that produces data and the teams that use it.
Producer and consumer
The producer owns and publishes the data. Consumers depend on it.
Schema
The fields in the data and their types.
Freshness promise
How recent the data will be, for example "never more than 15 minutes old".
Quality tests
Automatic checks the data must pass, such as no null ids or values in an allowed range.
Breaking change
A change that could make existing consumers fail, such as removing a field or changing its type.
Versioning
Labelling releases of the contract, such as v2 and v3, so consumers know what they are using.
Dual-run
Running the old and new versions together for a period while consumers migrate.
End of life (EOL)
The announced date when an old version stops being supported.
Enforcement
Automatic checks, in CI and while running, that stop contract violations.
A silent type change breaks a team that nobody knew was reading
changebad fieldSearch teamnumber becomes textQuery logsnew shapeRanking modelfails to parse
Press Play to watch it move

Each arrow is one thing happening. Play it step by step, or read the list below.

  1. 1.The search team changes the field type and deploys. No check stops them and nobody is told.
  2. 2.The ranking pipeline reads the field as a number, fails overnight, and search quality drops the next day.

The numbers, as things you can picture

  • Several producer teamsEach team owns data others depend on, in a mesh style or a hub-and-spoke style.

What the interviewer wants

Design contracts for data like APIs: what they contain, how they are enforced in CI and at runtime, how versions change, and what to do in an emergency.

Interview room

Design data contracts between teams: schema, freshness, volume, tests, enforcement, versioning. Slack posts are not contracts.

Basics

Contract contents; CI+runtime+process enforcement; semver for breaks; consumer registration.

Prompt

Versioned contracts, producer CI, consumer deps, catalog discovery, breach alerts.

Good

Example contract; advisory→hard rollout; registry of consumers; emergency process.

Clarify/scope

Hard vs advisory; sync vs async products; incentives.

Scoring lens: Data Contracts Between Teams

Interviewers reward incident-first teaching, a clear control loop, and named owners. Tool logos without that loop score poorly.

Weak vs strong answers on Data Contracts Between Teams

Weak: list products. Strong: tell the failure story, define the mechanism, draw the path, state rollout and monitors.

Scope control

Say what is out of scope for v1. Come back only if follow-ups demand it. This is a seniority signal for Data Contracts Between Teams.

Clarifying then committing

Ask a few high-use questions about SLAs, owners, and scale, then sketch. Endless questions without a diagram look evasive.

Contract registry UX

Browse by domain, see version, SLA, consumers, and recent breaches. Click-through to CI and runtime monitors. Discoverability is what makes contracts real.

Dual-run cost control

Major versions dual-run for a bounded window with a dated EOL. Infinite dual-run is how platforms pay forever for fear.

Emergency break ritual

Security/legal Sev-1 may force an incompatible change. Require IC approval, major bump, consumer blast, and postmortem. Do not normalize quiet breaks.

Interview framing detail 1

For lb-sd-30, spend the first minutes making the problem concrete: who gets hurt when this fails, what SLA is implied, and what is explicitly out of scope. Then teach the prerequisite concept before proposing boxes. A candidate who names vendors first usually loses the plot. Write two clarifying questions on the board and answer them with assumptions if the interviewer shrugs. Keep the first diagram small enough to redraw when a follow-up changes a constraint.