levelup.gitconnected.com 15 min read Original Source

Spec-Driven Development — Breaking Changes Start in the Spec: Requirements Semver, Blast-Radius…

Swapping “may” for “must” in a single sentence of a spec looks like an editorial fix. Once the code is regenerated, though, it can break three integrations, two of which no documentation describes. This applies to teams where an agent regenerates code from the spec, because regeneration makes the spec the carrier of intent, while the knowledge of who reads which field stays outside it. By the end, you’ll be able to classify such a change with requirements semver, work out its blast radius and set a compatibility window, and you’ll leave with a SPEC_CHANGELOG.md template and a spec diff review checklist.

Let’s take a scene composed of typical cases rather than one incident. In a user profile, the requirement read: “The customer may send the marketing consent status.” Someone changes one word, the diff is one line long, the review takes a minute. The agent regenerates the code along with the tests, the tests pass, and the deploy goes to production.

An hour later the first integration goes silent: the old mobile app sends a profile without that field and gets a validation error. The other two were not documented anywhere. They are a partner’s nightly import and a script that support uses every morning to fix contact details through the same API. The agent never saw them, because they weren’t in anything it had read.

That is a breaking change. It started in the spec, not in the code.

Quick Win — Core Insight

Every spec diff deserves three questions before an agent touches the code. What compatibility class the change has: requirements semver answers that. Who it breaks: blast-radius analysis answers that. How long the old behavior must survive: the compatibility window answers that.

These are three separate questions, and a version number answers only the first. In practice, it comes down to four habits:

  • Classify a change by its effect on the consumer, not by the size of the diff. A new consumer obligation is MAJOR, a new optional requirement is MINOR, a clarification that doesn’t change behavior is PATCH.
  • Count the consumers before regeneration: the known ones from contracts and the unknown ones from telemetry (a lower bound, not a full inventory).
  • Roll out in the order set by the compatibility direction and keep the old behavior alive for as long as the slowest supported consumer needs it, up to the announced end-of-support date.
  • Record the decision in SPEC_CHANGELOG.md and tie it to the release.

A spec is a contract with everyone who relies on it. There is one difference from a public API: in the setup described here, the contract is carried out by an executor that starts from zero at every regeneration. It remembers nothing its predecessor quietly added.

Let’s start with why regeneration raises the stakes of every fix to a spec.

With Regeneration, Only the Spec Carries the Intent

A breaking change in a spec is a change after which something a consumer did yesterday in line with the contract stops working today. Replacing “may” with “must” narrows the set of requests a consumer is allowed to send. A request without the field was valid, and now it’s an error.

Previously, a person read such a diff and knew that the old mobile app omits the field and that the partner imports profiles at night. With regeneration, that knowledge stays in people’s heads, and only the spec crosses the boundary. That’s my conclusion, not a research result.

The second difference is nondeterminism, meaning that the same prompt can produce different code. In the study by Ouyang et al. (ACM TOSEM, 2025), ChatGPT solved 829 programming tasks, five times each.

At the default temperature of 1, depending on the dataset, between 47.56% and 75.76% of tasks had no two answers with identical test results. Temperature 0 limited the nondeterminism but didn’t guarantee repeatability. It’s an old model, so I treat these numbers as a direction, not a measurement for today’s agents.

A Gap in the Spec Comes Back in a Different Disguise

At the spec level, nondeterminism has an unpleasant consequence: a gap in the spec that hasn’t been closed can return in different forms across successive regenerations. That’s how Hari Krishnan describes it in InfoQ (February 2026). Not the same bug but the same gap in a different disguise, so patching the generated code doesn’t close it. A correct spec with a non-conforming implementation is a separate class of defects.

Spec-anchored is an approach in which the spec stays after the task is done and keeps serving the development and maintenance of the feature (that’s what one of the 2025 SDD taxonomies calls it). In such a setup, every word of the description works like source code. The honest limit of the thesis is this: fixing a typo breaks no one, but every change to the words of an obligation goes to review like an API change.

The absence of a behavior change is checked on the generated code, not assumed. A PR that swaps “may” for “must”, optional for required, or “at least” for “exactly” gets the label “contract change”.

Since this is a contract change, it needs a name: MAJOR, MINOR or PATCH.

“Must” Instead of “May” Is MAJOR, Even When the Diff Is One Line

A version number is the number of an amendment to a contract: it tells the parties whether the old arrangements still hold after an update. Requirements semver carries that discipline over from public APIs to specifications and classifies a change by its effect on the consumer, not by the size of the diff. The idea isn’t exotic, because Semantic Versioning has always allowed the public API to be declared in documentation alone.

The sharpest test I know comes from Rich Hickey’s talk “Spec-ulation” (2016). You can grow in two ways: by providing more or by requiring less. You break in the two opposite ways: by requiring more or by providing less. A new mandatory field is “require more”, and a new optional field is “provide more”.

A Correction I Had to Make to My Own Rule

I started with a simpler rule myself: MAJOR is a change of behavior, MINOR is a new requirement, PATCH is a clarification. That rule has a hole, because a new requirement is sometimes a new obligation for the consumer. The corrected version reads: MINOR covers only an additive requirement whose absence doesn’t change behavior, while MAJOR is a new consumer obligation or the removal of a provider guarantee; a new provider guarantee is usually MINOR. Here are six typical cases:

  • “may” → “must” on an input field: MAJOR, because old requests become invalid
  • a new optional field: usually MINOR, if the field’s absence changes nothing
  • a fix to an example in the description: PATCH
  • removal of a guaranteed field in a response: MAJOR
  • narrowing the allowed values of an enum in a request: MAJOR (responses are a separate case)
  • marking a requirement as deprecated: MINOR

Compatibility Direction Says Who Updates First

Behind this list stands the compatibility direction. BACKWARD compatibility means a new reader can read old data, and FORWARD that an old reader can read new data. A change from optional to required is compatible in one direction only. The Confluent Schema Registry allows adding a required field (using Avro as the example) only under FORWARD compatibility, and old records without that field won’t deserialize without a default value.

So a single edit touches validation, consumers, historical data and fixtures all at once. The sources on schemas confirm the first three effects; the fourth is my conclusion: fixtures from before the change no longer pass the regenerated validators. Protobuf in its third syntax version dropped required fields altogether, because a “required” field can outlive the business requirement that justified it by years.

One caveat is mandatory here. No SDD tool or paper known to me defines requirements semver. Tessl versions specification packages with semver, but not individual requirements.

The closest precedent is Sentry’s SDK specification lifecycle: MAJOR for a change that breaks existing requirements, MINOR for new backward-compatible requirements, PATCH for clarifications. That’s a transfer of discipline with one living example, not a standard.

One disputed case remains: the spec corrects the documentation so that it matches behavior that has worked for years. Whether it’s PATCH or MAJOR depends on what consumers took as the contract: the document or the running system. I covered how deltas and the specification lifecycle bring order to such changes in a separate piece. Add a “change class” field with a one-sentence justification to the template of a PR that changes a spec.

The change class doesn’t tell you who will break, though. Blast-radius analysis answers that question.

The Diff Shows a Word, Blast-Radius Analysis Shows the Consumers

Reviewing a spec diff means reviewing a dependency chain, not prose. One sentence passes through the schema, the generated types and validators, fixtures and handlers. Next come the web and mobile clients, events, historical data and rollback. The diff shows only the first link, while an amendment to a contract also affects parties the contract is silent about.

Known Consumers Have Contracts, Unknown Ones Only Leave Traces in Telemetry

Known consumers show up in consumer-driven contracts: the consumer writes down what it needs, and the provider has to satisfy it. The pattern was described by Ian Robinson on martinfowler.com in 2006. Its limit is easy to see: a contract reveals only the consumers who wrote it down.

The rest is covered by Hyrum’s law, formulated by Google engineer Hyrum Wright. With enough users, somebody relies on every observable behavior of a system, whatever the contract promises. A consumer absent from the code is not the same as no consumer. Contracts alone will show a field as “unused” only if every consumer has a contract, and even then they may omit some paths.

A publicly described case from 2026 shows this well, a post by a single author on DEV Community. A new optional field was always present in responses, so consumers quietly treated it as required. When it stopped appearing for one category of accounts, four integrations went down within an hour. The behavior became the contract, not the document.

Hence my conclusion, labeled as a conclusion because no study has measured it. An agent will propose the dependencies it finds in the documentation and the repository, but it won’t find undocumented integrations or unknown clients, because they aren’t in anything it reads. A diff review must therefore reach for data from outside the repository.

Evidence from another world shows that reach depends on usage, not on the version number. In a replication study on Maven data, meaning Java libraries and their clients, breaking changes affected 7.9% of clients. Most of those changes touched code that no client used. That’s an analogy to specifications, not a measurement for them, but the direction fits: who uses it decides the reach.

Four Questions Before the Agent Starts

  • Known consumers: which repositories, app versions and contracts send or read this field.
  • Unknown consumers: what the field-usage telemetry and the access logs from recent weeks say.
  • Generated artifacts: whether SDK signatures, validators and fixtures that omit the field will change.
  • Events and historical data: whether old records get a default value or a migration.

A default value protects execution only where a component actually substitutes it; it doesn’t change the declared contract or a generated SDK, which after regeneration may turn the field into a required argument. I wrote about the data schema as an executable specification separately. Before approving the diff, ask for the field’s telemetry and the list of contracts. No answer is also an answer.

We now know who a change affects. What remains is to show what happens when one feature lives in three repositories.

One Requirement Change, Three Repositories and an App You Can’t Swap Out

Let’s go back to the user profile, this time with a plan. The feature is delivered by a backend, a web client that a page refresh swaps to new code, and an old mobile app whose binary you can’t replace. The new terms of the contract become the only ones in force only when the last party stops using the old ones. The state “all repositories merged” is therefore only the beginning.

In a simplified model, a partial rollout has six states, not two, and each requires a separate answer; production adds backend instances and the state of the data. Two are the most dangerous. New backend, new web and old mobile app: whether the web will write a state the old app can’t read. A rolled-back old backend and data already written the new way: whether the old code can parse it.

Expand, Migrate, Contract, With the Window Set by the Slowest Consumer

The safe sequence is expand → migrate → contract, the Parallel Change pattern, described on martinfowler.com in 2014 and documented as a refactoring strategy as early as 2006: first add the new path, then move the consumers, and finally remove the old one. The order follows from the compatibility direction. The reader of requests here is the backend, so it goes first and accepts both variants.

  • Spec 1.4.0 (MINOR): the field stays optional; when a profile is created, absence means “unknown” (an internal state); in a partial update, omission keeps the existing value; and omitting the field is marked deprecated.
  • Backend reads both variants, web sends the field after regeneration, mobile gets a release that does the same.
  • Historical data gets “unknown”, because a default value doesn’t prove that the customer gave consent.
  • Spec 2.0.0 (MAJOR) makes the field required only after the window closes.

The compatibility window is set by the slowest consumer; in this example the likely candidate is the long tail of mobile updates, as long as the partner and support migrate sooner. On one marketplace in 2018, more than 80% of actions two weeks after a release still came from older versions of the app. That’s a post by one company about one release, based on active customer sessions, not a market study. So the length of the window is set by the telemetry of your own customers, for example those active in the last 30 days, counted by version.

A Requirement Version Manifest Ties the Three Repositories Together

I propose tying it all together with a requirement version manifest that sits next to the spec (example values):

requirement: profile.marketing-consent
spec_version: 2.0.0            # MAJOR: field required
spec_commit: 9f3c2ab           # the spec revision the code was built from
repos:
  backend: { pr: "#812", release: "5.0.0" }
  web:     { pr: "#377", release: "2026.11.2" }
  mobile:  { pr: "#145", release: "7.3.0" }
other_consumers: [partner-import, support-script]   # owner and migration deadline to be filled in
compatibility_window: { from: 2026-11-04, until: 2027-02-04 }
requirement: profile.marketing-consent
spec_version: 2.0.0            # MAJOR: field required
spec_commit: 9f3c2ab           # the spec revision the code was built from
repos:
  backend: { pr: "#812", release: "5.0.0" }
  web:     { pr: "#377", release: "2026.11.2" }
  mobile:  { pr: "#145", release: "7.3.0" }
other_consumers: [partner-import, support-script]   # owner and migration deadline to be filled in
compatibility_window: { from: 2026-11-04, until: 2027-02-04 }

This is my artifact, not a standard: no SDD tool known to me links a spec version to releases across several repositories. The closest is OpenSpec Stores, a beta feature, meaning a separate repository for specifications shared by several repositories, for example a frontend and a backend, or Android, iOS and web clients. It gives one plan for many repositories, and “No sync, by design” means OpenSpec itself clones, pulls and pushes nothing. The documentation doesn’t provide for a rollout order or a window either.

The same materials note that for most projects a spec kept in the code repository is enough. My judgment, since no source gives a threshold: a separate specification repository pays off only when changes crossing repository boundaries happen often.

The window has to close eventually, and the requirement that opened it has to die in a controlled way.

A Requirement Dies in Stages, and the Spec Changelog Records Every Stage

Requirement deprecation is a notice period: the old behavior remains normative and has an owner, a reason, a successor and an end date. It runs in three stages: deprecation in a MINOR release, a transition period in which the old behavior works and is tested, and removal in a MAJOR release. The semver FAQ recommends at least one MINOR release with the deprecation before removal in a MAJOR. That’s a good minimum rule for a spec too.

During this period, a test isn’t just green or red:

  • current and blocking: a failure stops the release
  • deprecated and blocking: the old behavior is still guaranteed
  • pending: the mismatch is visible but temporarily doesn’t block the release (applies only to new expectations, not to existing guarantees)
  • removed: after the window closes, the test of the former guarantee leaves the active matrix, and a test of the new behavior takes its place, for example rejecting the request

Pact users know the pending state; Pact introduced pending pacts in 2020 (feature description). A pending state with no expiry date can hang on indefinitely, though, so the deadline has to be written on the same line as the marker.

Platforms suggest window lengths, though these are reference points, not a benchmark. Kubernetes doesn’t remove GA API versions within a major version, and it stops serving a beta version 9 months or 3 releases after deprecation, whichever is longer. The GitHub REST API supports the previous version for at least 24 months.

The takeaway is simple: the slowest consumer sets the window length, not the provider’s convenience. You announce the end-of-support date up front, together with what will happen to the remaining installations: a forced update or a controlled refusal.

The Delta Format Records Removal, but Not the Window

A delta spec describes a change relative to the current spec in ADDED, MODIFIED, REMOVED and RENAMED sections. In OpenSpec, the REMOVED section labels the removed behavior “deprecated” but removes it right away. So the format doesn’t carry a window; you have to add it through process and tests.

Keep the spec changelog in the categories from Keep a Changelog: Added, Changed, Deprecated, Removed, Fixed and Security, with the Breaking marker that version 2.0 recommends for breaking changes. An entry with a date, a version and a summary is created at every version bump. Record a deprecation like a tracked task with a reason, a successor and a milestone, not like a sentence in the release notes.

That leaves a dispute I don’t intend to sweep under the rug: Hickey says “don’t break, accrete”, while platforms break with a window. The window is an operational compromise: the old behavior works until it ends, but the later removal is still a breaking change and has to be marked as one.

The changelog records the decision. What remains is to tie it to what actually reached production.

A Spec Tag in the Release Says What Was Actually Built

A spec version starts to mean something only when a release points to the exact spec revision the code was built from. No SDD tool known to me assigns semver automatically, and there is no accepted standard for the provenance of generated code relative to a spec (Agent Trace describes code authorship and is a working draft). A general model of artifact provenance exists (SLSA Provenance ties an output to the inputs of the process and their hashes), but it doesn’t prove that the code conforms to the spec.

So this link is built from git and CI. The spec revision tag goes into the release of each of the three repositories, and its identifier goes into the manifest, like a signature and date on an amendment.

At a minimum, one row of regeneration metadata is enough: the generator and model, the spec hash and the commit of the generated code. The archive of spec changes becomes the history that release notes are built from, because the delta categories map onto changelog sections.

A single semver number won’t tell you whether backend 4.9 works with mobile app 7.2. A version compatibility matrix answers that, for example the [can-i-deploy](https://docs.pact.io/pact_broker/can_i_deploy) query in Pact: it checks whether the candidate works with the versions already in production. For mobile apps, you record releases and their end of support rather than the replacement of the previous version by a single deployment.

The last conclusion is mine, but it’s easy to check: a lasting rollback starts in the spec. In the short term, you restore a safe artifact and a compatible data state, because reverting the spec doesn’t undo migrations. A revert of the generated code alone is usually lost at the next regeneration, because the agent recreates the behavior from the unchanged spec. Add a “spec revision” field to the release definition and let CI reject a release without it.

Two files remain that you can copy into your repository today.

Two Files Close the Loop: SPEC_CHANGELOG.md and a Diff Review Checklist

The discipline of public APIs carries over to specifications in two files. With them, every requirement change gets a class, a blast radius, a window and an entry.

The SPEC_CHANGELOG.md Template

<button data-code="# SPEC_CHANGELOG — profile
## [2.0.0] — 2027-02-04 — MAJOR
### Changed
– **Breaking:** profile.marketing-consent is required (was: may)
### Removed
– Support for requests without marketing-consent (deprecated since 1.4.0)
Affected consumers: mobile

# SPEC_CHANGELOG — profile
## [2.0.0] — 2027-02-04 — MAJOR
### Changed
- **Breaking:** profile.marketing-consent is required (was: may)
### Removed
- Support for requests without marketing-consent (deprecated since 1.4.0)
Affected consumers: mobile < 7.3.0, partner-import, support-script
Releases: backend 5.0.0, web 2026.11.2, mobile 7.3.0
Manifest: manifests/profile.marketing-consent.yaml
## [1.4.0] — 2026-11-04 — MINOR
### Deprecated
- Omitting profile.marketing-consent, removal: 2027-02-04
### Added
- An "unknown" value for missing consent
Releases: backend 4.9.0
# SPEC_CHANGELOG — profile
## [2.0.0] — 2027-02-04 — MAJOR
### Changed
- **Breaking:** profile.marketing-consent is required (was: may)
### Removed
- Support for requests without marketing-consent (deprecated since 1.4.0)
Affected consumers: mobile < 7.3.0, partner-import, support-script
Releases: backend 5.0.0, web 2026.11.2, mobile 7.3.0
Manifest: manifests/profile.marketing-consent.yaml
## [1.4.0] — 2026-11-04 — MINOR
### Deprecated
- Omitting profile.marketing-consent, removal: 2027-02-04
### Added
- An "unknown" value for missing consent
Releases: backend 4.9.0

The “Spec Diff Review” Checklist

[ ] Behavior: does the change narrow or widen what may be sent and what comes back
[ ] Known consumers: repositories, app versions, contracts
[ ] Unknown consumers: field usage telemetry, access logs
[ ] Artifacts: generated types, validators, SDKs, fixtures
[ ] Contract tests: independent of regeneration
[ ] Events and historical data: default value or migration
[ ] Partial rollout: states from the matrix (six in the simplified model), order from the compatibility direction
[ ] Rollback: will the old backend read data written the new way
[ ] Window and release: change class, removal date, spec revision in the release matching the manifest
[ ] Behavior: does the change narrow or widen what may be sent and what comes back
[ ] Known consumers: repositories, app versions, contracts
[ ] Unknown consumers: field usage telemetry, access logs
[ ] Artifacts: generated types, validators, SDKs, fixtures
[ ] Contract tests: independent of regeneration
[ ] Events and historical data: default value or migration
[ ] Partial rollout: states from the matrix (six in the simplified model), order from the compatibility direction
[ ] Rollback: will the old backend read data written the new way
[ ] Window and release: change class, removal date, spec revision in the release matching the manifest

Which Class, Whom and for How Long

Requirements semver tells you the compatibility class of a change, not how big the damage is. Blast-radius analysis tells you whom it hits, and the compatibility window tells you for how long. All three answers go into the spec changelog before the agent generates the first line of code. Start with the next PR that changes a spec and add the change class and the list of consumers to its description.

Thank you for the time you spent on one word that turned out to be a change of contract. Describe in a comment how your team marks a breaking change in a spec today, or a case where a one-sentence fix to a requirement broke an integration nobody knew about. If this text changed how you read a spec diff, send it to the person on your team who approves requirement changes. If you want to go deeper into who should own a specification before you start versioning it, I wrote about that separately.