Runbook: OpenAPI Contract-Test Failing
Trigger
make contract-testfails.make verifyfails on thecontract-teststage.- CI reports OpenAPI snapshot drift vs baseline.
Fast triage
- Run
make contract-testto see the diff summary. - Identify whether changes are intentional or accidental.
- If accidental, revert/fix API contract changes in code.
- If intentional, validate compatibility and docs, then accept baseline update.
Most common causes
- Field type changed in request/response schema.
- Error code/key mapping changed unintentionally.
- Response status set changed (for example removed
422or404). - A field or parameter flipped between required and optional.
- OpenAPI examples or router response declarations diverged from implementation.
Recovery paths
Unintentional contract drift
- Fix schema/router/validation code to restore expected contract.
- Re-run
make openapi-checkandmake contract-test. - Run
make verifybefore commit.
Intentional contract change
- Confirm the change is safe for the current API major version.
- Update tests, examples, and related docs/ADR notes.
- Accept new baseline:
make openapi-accept-changes. - Re-run
make contract-testandmake verify.
Final recovery sequence
make openapi-checkmake contract-testmake verify
Exit criteria
make contract-testpasses.make verifypasses end-to-end.- If you updated the baseline, the commit message or PR explains why.
Follow-up
- If compatibility rules changed, update an ADR and developer docs.
- If this keeps happening, tighten checks in
scripts/openapi_governance.py.
Page history
| Date | Change | Author |
|---|---|---|
| Added Page history section (repository baseline). | Ivan Boyarkin |