AC-026 Conformance caught CS-RUN-006

The server drifts away from its spec

The spec and the server disagree about what exists

How to run this card's commands yourself

1. The problem

In one sentence

Over time the server stops matching its spec in new places, and nobody notices because the old differences are already there.

A story

A team inherits an API with a spec that does not match the server in three places. Fixing all three will take months. They decide to live with them for now. Weeks later, a change makes GET /drift/report return "total": "3" (text) instead of 3 (a number). The run was already red, so a fourth failure in the list looks like the other three. It ships.

Why it hurts

Known differences hide new ones. Without a way to say “these three are known, tell me about anything new”, teams either turn the check off or stop reading it.

  • For developers: a long list of old failures makes a new one easy to miss. Record the list once, and let the check fail only on what is new.
  • For managers: the number of known differences should go down over time. A baseline makes that visible: it shows “known, new, fixed” on every run.
  • For DevOps: commit the baseline file and review changes to it in pull requests. A change that adds an entry means a team accepted a new difference.

Example

The spec says GET /drift/report returns an integer total. The sandbox serves it correctly at drift level 0, and with a text total at drift level 1 (the level is set when the server starts):

{"total": "3"}

The other three problems are old, known differences: GET /ghost answers 404, DELETE /orphan answers 405, PATCH /wrong-method answers 405 (AC-020, AC-021).

How to detect it without clrsig

  • Keep the output of a full run in the repository and compare it with the next run by hand (diff). It works, but only a tool makes it routine.

How to fix it

Two steps:

  1. Record the current state once as the baseline, so the known differences are accepted for now.
  2. Fail the build on anything new, and work the known list down. Each fix shows up as “fixed”, and the baseline can be written again.

The new difference itself has the usual two causes: the code is wrong (more likely) or the spec is out of date. Never record a new violation in the baseline just to make the build pass without looking at it.

AC-006 A field has the wrong type, AC-057 You do not know what your tests never reached, AC-054 A spec change breaks existing clients. See also the site’s OpenAPI Specification and Implementation Drift.

Words used on this page are explained once in the glossary.

2. How clrsig helps

Check

CS-RUN-006 New violation against a baseline. State: caught. With --baseline, a violation that is not in the recorded file fails the run (exit code 1). Recorded ones are accepted, and fixed ones are reported.

Command

Safety. Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.

First reset the sandbox, then record the baseline from the server at drift level 0. Recording needs a full run, with every operation, writes included: clrsig refuses --write-baseline with --paths, --tags or --changed-against, because a baseline from a limited run would drop the other entries. This run includes slow operations, so it takes a while. tail -n 2 keeps only its last two lines:

clrsig conform specs/conform-fail.yaml \
  -b http://localhost:8080/conform-fail \
  --env clrsig/environments/conform-fail.yaml \
  --write-baseline known.yaml 2>&1 | tail -n 2

Then run against the baseline. These runs may be limited with --paths; here they cover the four operations of the story. Run the command against the same server, then against a server that has drifted (level 1, on port 8081):

clrsig conform specs/conform-fail.yaml \
  -b http://localhost:8081/conform-fail \
  --env clrsig/environments/conform-fail.yaml \
  --paths /ghost,/orphan,/wrong-method,/drift/report \
  --baseline known.yaml

For the same server, use port 8080 in -b.

Exit code: 0 when nothing is new (the known failures are accepted), 1 when a new violation appears, 2 when the baseline file cannot be read.

What you see

Output from clrsig v0.21.0, recorded on 2026-11-30. Recording the baseline: the last two lines of the full run, kept by tail -n 2; no line is edited. The headline says FAILED because operations fail, and the exit code of clrsig is 0 because their violations were recorded:

FAILED  76 operations  ·  54 passed  ·  22 failed  ·  0 skipped  45472ms
Baseline written: 22 violations recorded in known.yaml

The baseline file records each violation the full run found. Some depend on timing, so the total can differ on your machine. These are the entries for the three old problems of the story:

schemaVersion: "2"
violations:
    - operation: DELETE /orphan
      check: CS-RESP-001
      where: "405"
      summary: Status 405 is not declared for DELETE /orphan
    - operation: GET /ghost
      check: CS-RESP-001
      where: "404"
      summary: Status 404 is not declared for GET /ghost
    - operation: PATCH /wrong-method
      check: CS-RESP-001
      where: "405"
      summary: Status 405 is not declared for PATCH /wrong-method

Output from clrsig v0.21.0, recorded on 2026-11-30. Against the same server (exit code 0, the last line is the baseline summary). In this output and the next, the lines for the 72 operations that --paths skipped are left out by grep -v '^ SKIP'; no line is edited:

conform-fail API  1.0.0
Base URL: http://localhost:8080/conform-fail
Limited by --paths /ghost,/orphan,/wrong-method,/drift/report

  PASS  GET     /drift/report  200  17ms
  FAIL  GET     /ghost  404  4ms
         ✗ GET /ghost answered 404, but the spec declares only 200
  FAIL  DELETE  /orphan  405  2ms
         ✗ DELETE /orphan answered 405, but the spec declares only 204
  FAIL  PATCH   /wrong-method  405  2ms
         ✗ PATCH /wrong-method answered 405, but the spec declares only 200

PASSED with 3 known violations  76 operations  ·  1 passed  ·  3 failed  ·  72 skipped  32ms
Baseline: 3 known, 0 new, 0 fixed

Output from clrsig v0.21.0, recorded on 2026-11-30. Against the drifted server (exit code 1):

conform-fail API  1.0.0
Base URL: http://localhost:8081/conform-fail
Limited by --paths /ghost,/orphan,/wrong-method,/drift/report

  FAIL  GET     /drift/report  200  18ms
         ✗ Error at "/total": value must be an integer
Value:
  "3"
  FAIL  GET     /ghost  404  2ms
         ✗ GET /ghost answered 404, but the spec declares only 200
  FAIL  DELETE  /orphan  405  3ms
         ✗ DELETE /orphan answered 405, but the spec declares only 204
  FAIL  PATCH   /wrong-method  405  2ms
         ✗ PATCH /wrong-method answered 405, but the spec declares only 200

FAILED  76 operations  ·  0 passed  ·  4 failed  ·  72 skipped  32ms
Baseline: 3 known, 1 new, 0 fixed
  NEW    GET /drift/report  CS-RESP-006  total  "total" is text, the spec says integer

How to read it: with a baseline, a run whose only failures are known ones says PASSED with 3 known violations and exits 0. With one new violation the headline says FAILED, the Baseline: line says 3 known, 1 new, 0 fixed, a NEW line names the operation, and the exit code is 1.

Where to look

  • Desktop app: Check Conformance runs the same check. Baseline use is a command-line option here (--baseline, --write-baseline).
  • GitHub Action: it has baseline and write-baseline inputs.
  • Reports: a new violation fails the run; the exit code is what the pipeline reads.

How clrsig helps you fix it

It separates old from new, and tells you when a known problem is fixed. It does not rank the old ones.

Limits

  • A baseline recorded before a clrsig upgrade can change meaning when the tool’s checks change (a backlog item in the clrsig project says so). Review the baseline after an upgrade.
  • A baseline accepts a problem; it does not fix it. It is a way to adopt the check, not a way to ignore it.
  • A baseline file written by an older version of clrsig could quote a failing response in full. If a committed one may hold a secret, record it again and rotate the secret: removing it from the current file does not remove it from Git history.
  • The drift level in the sandbox is fixed at server start. In your own system, drift comes from changes to the code or the spec.

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-026 · The server drifts away from its spec
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: when an API already has known differences, record them once as a baseline, and fail the build only on what is new.
Open with this story: A team inherits an API with a spec that does not match the server in three places. Fixing all three will take months, so they live with them for now. Weeks later a change makes a total come back as text instead of a number. The run was already red, so a fourth failure looks like the other three, and it ships.
Say these facts, in this order:
1. Known differences hide new ones; teams turn the check off or stop reading it.
2. Step one: record the current state once with write-baseline, from a full run. The file holds every violation that run found, including the three old ones of the story. clrsig refuses to record from a run limited by paths, tags or changed operations.
3. Step two: run with baseline. Against the same server the summary says three known, zero new, zero fixed, and the exit code is zero.
4. Against a server that has drifted, the summary says three known, one new; the NEW line names the operation, and the exit code is one.
5. When a known problem is fixed, the run says so, and the baseline can be written again.
6. A baseline accepts a problem; it does not fix it. Never record a new violation just to make the build pass without looking at it.
7. For managers: known, new and fixed make progress visible.
8. For DevOps: commit the baseline file and review changes to it in pull requests; review it after a clrsig upgrade.
Show on screen: the three baseline entries, the two commands, and the first and last output blocks, copied exactly from the card.
Name the check: CS-RUN-006, New violation against a baseline. Say the clrsig version: v0.21.0.
Explain these words once: drift (the server and the spec slowly moving apart); baseline (a recorded list of known problems you accept for now); violation (one place where the answer breaks the spec); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: a baseline does not fix anything; recorded baselines can change meaning when clrsig's checks change; it does not rank the old problems.
Safety line (if a write is shown): Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.
Finish with three recap questions:
1. What does a baseline record? (The known violations, accepted for now.)
2. When does the run exit with 1? (When there is a new violation.)
3. Should you add a new violation to the baseline to make the build green? (No, look at it first.)
Tease the next video: AC-027 · The next call needs a value the previous response did not give.
Do not: say "contract testing" alone; say clrsig "catches everything"; invent flags, IDs or numbers; read tables aloud; use any fact that is not in the card.