← Code review and governance guides

How to require spec updates in code review

How-To Code review and governance Intermediate 1141001HOWTO-1141001

HOWTO-1141001Code review and governanceIntermediate

This guide shows you how to decide when code review should require a SpecDD spec update in a spec-driven development workflow.

SpecDD works because specs stay close to the code they govern. If implementation changes behavior but the .sdd file does not change, the next human or agent will work from stale authority.

Short answer

Require a spec update when a pull request changes durable behavior, ownership, write authority, dependencies, public contracts, inputs, outputs, errors, scenarios, tasks, or completion criteria. Do not require a spec update for pure formatting, mechanical cleanup, or internal implementation changes when the existing spec still describes the result accurately.

When to use this guide

Use this guide when:

Steps

1. Decide whether the contract changed

Require a spec update when the pull request changes:

If the code changes what future contributors should rely on, the spec should change.

2. Do not require updates for unchanged contracts

SpecDD review should stay practical.

You usually do not need a spec update for:

The test is simple: would the existing spec still guide the next change correctly? If yes, do not add churn.

3. Identify the owning spec

Put the update in the spec that owns the behavior or boundary.

For a file-level rule, the owning spec is often the same-directory same-basename spec:

itinerary.js
itinerary.sdd

For a module-wide boundary, update the parent or directory-level spec that owns that boundary. Do not copy a parent rule into every child spec just because several children are affected.

4. Require durable rules, not only completed tasks

A completed task records work. It does not replace the durable contract.

Weak update:

Tasks:
  [x] Add missing-place validation.

Better update:

Must:
  Reject itinerary items without a place name.

Tasks:
  [x] Add missing-place validation.

If the behavior should remain true after this pull request, put it in Must, Must not, a contract section, Scenario, Example, or Done when, not only in Tasks.

5. Review task status carefully

Task markers are reviewable.

Use:

Require evidence before accepting [x]. If checks were not run, the pull request should say why.

6. Keep the update in the same changeset

Spec updates should usually land with the code they govern.

Separate pull requests are useful when:

For normal implementation, avoid “update the spec later.” Later creates stale authority.

7. Write a clear review request

Useful review comment:

This changes itinerary validation behavior, but the Itinerary spec still describes the old accepted input. Please update the owning spec in this pull request.

For task status:

The task is marked done, but the Done when check is not shown. Please add the check or leave the task open.

The comment should name the contract gap and the action needed.

Review rule of thumb

Require a spec update when the pull request changes what future work should assume.

Do not require one when the pull request only changes how the same contract is implemented.

Common mistakes

How to verify the result

Your review rule is working when:

← Code review and governance guides