liveBook · Manning

Contract version

As explained in Contract Testing in Action

A unique revision identifier assigned to a contract as it evolves.

A provider may fix an endpoint while consumers are changing their interactions on another branch. A contract version is the unique revision identifier that distinguishes each evolving consumer–provider agreement, so verification can be tied to the exact changes rather than to a vague release label. section 9.1 section 3.3

Consumer and provider versions are associated with a contract, and their pairing produces a verification status. This makes it possible to see whether a particular provider build works with a particular consumer contract version. Unlike a schema alone, a contract captures how consumers use an API and helps expose breaking changes affecting them. section 9.1.1 section 3.3

Use versions as part of the delivery workflow:

  • Update the consumer version whenever the contract content changes; use unique application version numbers. section 9.1.1
  • Assign a GitHub commit SHA on a release or main-branch merge so a published contract traces directly to its code change. section 10.2.1
  • Set the provider version to its GitHub SHA as well, allowing the matrix to record the exact consumer–provider verification pair. section 10.2.1
  • Record deployments or releases and query whether a version can be deployed alongside versions already deployed in an environment. section 10.5

Versioning a consumer publication

Expose GITHUB_SHA in GitHub Actions, then pass it as --consumer-app-version when publishing Pact files. The published contract receives the commit identifier rather than a manually maintained version, making the matrix entry traceable to a specific change. section 10.2.1

Figure 9.5 Pact Broker matrix showing the history of consumer and provider versions with verification status
figure

Use the matrix to inspect the history of consumer contract and provider versions together with their verification statuses. section 9.1.1

Versioning does not require redundant verification for unchanged contract content: Pact Broker can infer the status when the contract file has not changed. For amended contracts, automated webhooks can trigger provider verification; branches and environments help ensure the intended contracts are checked before deployment. section 9.1.1 section 10.5

How Contract Testing in Action covers it

How deep it goes
Explains unique consumer and provider identifiers, matrix status pairing, SHA configuration, and deployment checks without defining version-number schemes.
Examples
Uses a provider endpoint fix, changing consumer UI interactions, WebConsumer–MoviesAPI matrices, and GitHub SHA publishing commands.
What it assumes
Assumes consumer-provider contract testing and introduces SHA-based version configuration through GitHub Actions and Pact settings.
What you can do after
Operate/configure it to trace contract and provider changes to commits and check verified deployment compatibility.
How it connects
Connects contract versions with consumer-driven contracts, provider verification, CI/CD pipelines, branches, environments, and can-i-deploy.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Contract Testing in Action. The section links point to the parts of the book it draws on.