Skip to content

Interface evolution and compatibility

Every published version of a reusable capability block is immutable, and a project pins the exact release it uses. A project on acme.billing 1.2 keeps running 1.2 when 1.3 is published, and moves to 1.3 only when its import changes. See Version pinning.

The interface evolution rules are a safety check on top of that model. They compare two versions of one block's interface and answer one question: what does the change from the older version to the newer one mean for a caller written against the older one? Pinning works without them; they matter only where a newer version could be used in place of an older one.

What the check decides

Adding a method is the one safe change. A caller of the older version never calls the new method, so the newer version still serves it, and a minor version bump, 1.2 to 1.3, is honest.

Every other change breaks callers of the older version, and calls for a major version bump, 1.3 to 2.0:

  1. removing, renaming or changing the parameters or result of a method;
  2. changing a method's effect or retry declaration; see Effect and retry declarations;
  3. adding or removing one of a method's errors;
  4. adding, removing or retyping a record field, or reusing a retired field or method number.

Record changes are the most dangerous. Values are encoded by field position, so an older caller reading a newer record reads the fields after the change in the wrong place and gets values that look valid.

A newer version serves a caller written against an older one when the interface id and the major version are the same, and the newer minor version is at least the caller's:

block 1.3, caller expects 1.0   served
block 1.3, caller expects 1.4   refused, the caller may use a method 1.3 lacks
block 1.3, caller expects 2.0   refused, a different major is a different contract

Where a safety check applies

Two places would use it, and both sit on top of immutable, pinned versions:

  1. At publish, refusing a new version that breaks the previous one while bumping only the minor version, so version numbers tell callers the truth.
  2. For opt-in minor tracking, set with track: latest-minor, where a project takes the newest minor version of a block instead of one pinned release. That is exactly the substitution these rules judge. The run still records the exact version it resolved.

The rules are defined in the kernel's interface model. Where they are applied, at publish or when a tracked minor version is resolved, is an open decision in the design.