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
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
