advanced 2 min answer

An organisation with hundreds of services adopts contract testing. What breaks at that scale, and what must be added?

contract-testingscaleversioningbrokerexpediadesign
Show the full answer Hide the answer

What breaks at scale

1. Which consumer versions must pass. With many consumers deploying independently, a provider's build must know which contracts to verify: the deployed versions, the versions about to deploy, or all of them. Verifying all historical versions makes every build slower and blocks changes for consumers nobody runs any more.

2. Provider build duration. A provider with fifty consumers verifies fifty contract sets on every build. Without parallelism and selection, contract verification becomes the pipeline bottleneck.

3. Contract drift. Consumers write contracts against behaviour they observed rather than behaviour they need, so contracts encode incidental detail and break on legitimate provider changes.

4. Scope creep into business logic. Teams put behavioural assertions into contracts, producing a brittle suite. This is the most common technical cause of failure, and it leads teams to conclude the technique does not work.

5. Nobody owning the broker, so it becomes unreliable and the whole scheme is bypassed.

What must be added

  • Deployment-aware verification. The broker records which consumer versions are deployed where, so a provider verifies against what actually exists plus what is pending — and can safely ignore the rest.
  • A "can I deploy" check in the deployment pipeline, answering whether this provider version is compatible with everything currently deployed. This is the capability that turns contracts from a test into a release gate.
  • Contract review discipline, keeping them to the interface. A contract asserting a specific calculated value rather than a field's presence and type is a business-logic test in the wrong place.
  • Parallel verification and selection, so provider builds stay fast.
  • Ownership of the broker, with SLOs, because it is now on the critical path of every deployment.

The benefit that grows with scale

The contract set documents actual usage, which is exactly what is needed for safe deprecation. At a hundred services, "which fields does anyone actually use" is otherwise unanswerable — and it converts "we cannot change this because we do not know who depends on it" into a list.

That is frequently the argument that persuades provider teams to invest in the practice at all.