1. The problem
In one sentence
A method does not do what its name promises: a GET changes data, a PATCH replaces the whole record, or a create returns 200 instead of 201.
A story
A support tool reads a ticket with GET /tickets/1 and the status is unread. It reads it again, and now the status is read. The first GET changed the ticket. A link checker, a prefetching browser and a retrying proxy all send GET requests freely, because GET is promised to be safe. Each of them now silently marks tickets as read.
Another team sends PATCH /users/1 with {"email": "alice@new.example.com"}. The server treats it as a full replacement. The user’s name and role are wiped out.
Why it hurts
HTTP gives each method a meaning, and a lot of infrastructure relies on it. GET is safe and idempotent, so it can be repeated, cached and prefetched. PUT and DELETE are idempotent. PATCH changes part of a record.
- For developers: a
GETthat changes state breaks caches and retries. APATCHthat replaces data turns a small edit into data loss. - For managers: side effects of
GEThappen without anyone choosing them; a “partial update” that erases fields is silent data loss. - For DevOps: retries, caches, crawlers and health checks all assume the meaning of methods. A route that breaks it will be hit by them.
Example
Three demos from the failure catalog:
GET /tickets/1 -> status "unread", then on the second call "read" (a GET changed data)
PATCH /users/1 {"email":"alice@new.example.com"} -> 200, and afterwards name "" and role "" (PATCH replaced the record)
POST /articles -> 200 (the spec declares 201)
How to detect it without clrsig
- Call a
GETtwice and compare the answers and the data. They must be the same. - After a
PATCHof one field,GETthe record and check that the other fields are unchanged.
How to fix it
There are two usual causes:
- The code is wrong (more likely). Remove the side effect from the
GETand move it to aPOSTorPUT. Merge the fields in thePATCHinstead of replacing the record. Return201for a create and204for a delete. - The spec is wrong. It declares a method that does not match what the operation does. Rename the operation or change its method.
To tell which: ask what a retry or a prefetch would do. Never let a GET change data.
Related problems
AC-034 The wrong HTTP status for a business error, AC-042 A repeated write creates duplicates, AC-041 A write returns success but is not saved. More failure-catalog demos: FM-034-05 (a soft delete becomes a hard delete) and FM-034-06 (a bulk delete does nothing). See also the site’s HTTP Method and Operation Semantics Failures.
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
No built-in check for the behaviour, and the state is not caught. A scenario finds it by calling the operation and then reading the data back. (The declared status, for example 201 for a create, is a case clrsig reports by itself when a spec declares only 201: see AC-001.)
Command
Each demo is a runnable server in the failure catalog. The scenarios send PATCH and POST requests to a local toy server, so they write data there:
Safety. Run this against a test server, never production.
clrsig conformsendsPOST,PUTandDELETErequests built from the spec: start with--read-only, and take secrets from the environment (${NAME}), never from files in the repository.
cd failures/fm-034-04-patch-semantics
go run broken/main.go &
clrsig run scenarios/detect.yaml --env environments/local.yaml
Exit code: 0 all steps pass, 1 a step failed, 2 the scenario or the setup is broken. Here it is 1. Against fixed/main.go all steps pass and the exit code is 0.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30. The PATCH demo, fm-034-04-patch-semantics:
Scenario: fm-034-04 — PATCH Semantics Failure
PASS confirm initial state — user 1 has name Alice and role admin 200 17ms
✓ jsonpath $.name eq Alice
✓ jsonpath $.role eq admin
PASS PATCH email only — must not affect name or role 200 0ms
✓ status eq 200
FAIL after PATCH — name must still be Alice, role must still be admin 200 0ms
✗ jsonpath $.name eq Alice: expected "Alice"; got ""
✗ jsonpath $.role eq admin: expected "admin"; got ""
FAILED 2 passed, 1 failed, 0 skipped (3/5 assertions passed) 17ms
The non-idempotent GET demo, fm-034-03-nonidempotent-get:
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: fm-034-03 — Non-Idempotent GET
PASS first GET /tickets/1 — must return status unread 200 13ms
✓ jsonpath $.status eq unread
FAIL second GET /tickets/1 — must still return unread (GET must not mutate state) 200 0ms
✗ jsonpath $.status eq unread: expected "unread"; got "read"
FAILED 1 passed, 1 failed, 0 skipped (1/2 assertions passed) 14ms
The create and delete statuses demo, fm-034-01-method-semantics:
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: fm-034-01 — HTTP Method and Operation Semantics Failures
FAIL POST /articles must return 201 Created (spec declares 201, broken returns 200) 200 18ms
✗ status eq 201: expected "201"; got "200"
SKIP DELETE /articles/1 must return 204 No Content (spec declares 204, broken returns 200)
skipped: step 1 (POST /articles must return 201 Created (spec declares 201, broken returns 200)) failed and its failPolicy is stop; set failPolicy: continue to run the steps after a failure
FAILED 0 passed, 1 failed, 1 skipped (0/1 assertions passed) 18ms
How to read it: the PATCH itself answers 200 and looks right. The failure is in the next read, where name and role are empty. The GET demo fails on the second call, not the first.
Where to look
- Desktop app: open the scenario and run it; each step shows its assertion result.
- Reports:
--format jsonandjunitonclrsig run. - GitHub Action: use
command: runwith thescenarioandenvinputs. The demos check with their own assertions. To compare your own responses with your spec, name it withspecFilein the scenario, or give thespecinput, which replaces it; older releases of the Action ignored that input withrun(setup and upgrading).
How clrsig helps you fix it
It shows which step first sees the wrong data. The step order (change, then read back) is what makes the hidden effect visible.
Limits
- The scenario must call the operation twice or read back. A single request cannot show a hidden side effect.
- Only the methods and fields you write are tested.
More ways
Nothing yet.
3. Video brief for Google NotebookLM
VIDEO BRIEF — AC-039 · HTTP method semantics are broken
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: each HTTP method has a meaning that infrastructure relies on; a GET that changes data or a PATCH that replaces a record breaks things nobody can see.
Open with this story: A support tool reads a ticket and the status is unread. It reads it again, and now the status is read. The first GET changed the ticket. A link checker, a prefetching browser and a retrying proxy all send GET requests freely, because GET is promised to be safe. Each of them now silently marks tickets as read. Another team sends a PATCH with only an email. The server treats it as a full replacement, and the name and role are wiped out.
Say these facts, in this order:
1. GET is safe and can be repeated, cached and prefetched. PUT and DELETE are idempotent. PATCH changes part of a record.
2. Demo one: a second GET of the same ticket returns read instead of unread. The scenario fails on the second call.
3. Demo two: the PATCH answers 200 and looks right; the failure is in the next read, where name and role are empty.
4. Demo three: a create answers 200 where the spec declares 201.
5. Two usual causes: the code is wrong (move the side effect to a POST or PUT, merge fields in a PATCH, return 201 for a create and 204 for a delete), or the spec declares a method that does not match what the operation does.
6. A single request cannot show a hidden side effect; the scenario must call twice or read back.
7. For managers: silent data loss, and side effects that nobody chose.
8. For DevOps: retries, caches, crawlers and health checks all assume the meaning of methods.
Show on screen: the three example lines, the commands (go run broken/main.go and clrsig run scenarios/detect.yaml --env environments/local.yaml), and the three output blocks, copied exactly from the card.
Name the check: none built in; found by reading the data back in a scenario. Say the clrsig version: v0.21.0.
Explain these words once: idempotent (doing it twice has the same effect as doing it once); safe (it does not change data); PATCH (change part of a record); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: a single request cannot show a hidden side effect; only the methods and fields you write are tested.
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. Which methods may a GET never do? (Change data.)
2. Why does the PATCH demo fail on the next read? (The PATCH replaced the record, so the other fields are empty.)
3. Which status should a create return? (201.)
Tease the next video: AC-040 · A business rule is broken though every response looks fine.
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.