1. The problem
In one sentence
The server answers 200 OK to a write and does not save the change.
A story
A user switches the app’s theme to dark. The client sends PUT /config with {"theme":"dark","language":"en"}. The server answers 200 OK. The next time the app reads the settings, the theme is light. The handler decoded the request and returned success without writing to the store.
Why it hurts
A success status on a write is a promise that the data is saved. If it is not, the client and the user are told that it is, and find out later, when the data is gone.
- For developers: the fault is in the write path (a missing commit, a swallowed error, a write to a cache that is later discarded). The handler’s own tests often check only the answer.
- For managers: this is silent data loss. Users re-enter data, trust drops, and the evidence is gone because nothing was logged as an error.
- For DevOps: a write-then-read check is the simplest, most valuable check after a deploy. It exercises the whole path: handler, storage and read.
Example
PUT /config {"theme":"dark","language":"en"} -> 200 OK
GET /config -> {"theme":"light", ...} (the write was discarded)
How to detect it without clrsig
- Do the write with
curl, then read the same record back and compare. - Look for success responses sent before the storage call, or errors from the storage call that are ignored.
How to fix it
There are two usual causes:
- The code is wrong (more likely). Save first, then answer. Make storage errors visible. If a write is queued for later, answer
202 Accepted, not200. - The spec is wrong. The write really is asynchronous. Then declare
202and say how to check the result (AC-040 covers rules; asynchronous work needs its own contract).
To tell which: ask when the data becomes visible. If it should be at once, the code is wrong. Never answer 200 before the data is safe.
Related problems
AC-040 A business rule is broken though every response looks fine, AC-039 HTTP method semantics are broken, AC-043 A stale update overwrites a newer one. See also the site’s Eventual Consistency and Read-After-Write Failures.
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
No built-in check, and the state is not caught: the PUT answer is valid. A scenario that writes and then reads back finds it.
Command
This demo is a runnable server in the failure catalog. The scenario sends a PUT to its own local toy server, so it writes 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-038-01-write-not-persisted
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 both steps pass and the exit code is 0.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: fm-038-01 — Write Returns 200 But Doesn't Persist
PASS PUT /config to change theme to dark — must return 200 200 18ms
✓ status eq 200
FAIL GET /config — theme must now be dark (broken server discards the write) 200 0ms
✗ jsonpath $.theme eq dark: expected "dark"; got "light"
FAILED 1 passed, 1 failed, 0 skipped (1/2 assertions passed) 18ms
How to read it: the write passes, and the read-back fails. The order of the two steps is the whole check.
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 demo checks with its 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 that the write was answered with success and the read-back disagrees, which is the evidence to look in the storage path. It cannot see inside the server.
Limits
- Only the writes you list are read back. Add one read-back per write operation that matters.
- A read-back sees the data the server shows. A server that keeps the data in a cache but not in storage would pass.
More ways
Nothing yet.
3. Video brief for Google NotebookLM
VIDEO BRIEF — AC-041 · A write returns success but is not saved
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: a success status on a write is a promise that the data is saved; the only way to check the promise is to read the data back.
Open with this story: A user switches the app's theme to dark. The client sends a PUT with the new settings. The server answers 200 OK. The next time the app reads the settings, the theme is light. The handler decoded the request and returned success without writing to the store.
Say these facts, in this order:
1. The scenario has two steps: a PUT that must return 200, and a GET that must show the theme dark.
2. On the broken server the PUT passes with 200 and the GET fails: expected dark, got light.
3. The fixed server saves the change and both steps pass.
4. The PUT answer is valid, so only a write followed by a read-back finds this.
5. Two usual causes: the code is wrong (save first, then answer; make storage errors visible), or the write is really asynchronous and should answer 202 Accepted.
6. For managers: silent data loss; users re-enter data and trust drops.
7. For DevOps: a write-then-read check is the simplest, most valuable check after a deploy.
Show on screen: the two example lines, the commands (go run broken/main.go and clrsig run scenarios/detect.yaml --env environments/local.yaml), and the output block, copied exactly from the card.
Name the check: none built in; found by a write and a read-back in a scenario. Say the clrsig version: v0.21.0.
Explain these words once: persist (save so that it is still there later); read-back (reading the data again after a write to check it); 202 (accepted, but not done yet); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: only the writes you list are read back; a server that keeps data in a cache but not in storage would pass.
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 two steps does the scenario have? (A write and a read-back.)
2. Why does the PUT step pass? (The answer is valid.)
3. Which status fits a write that is queued for later? (202 Accepted.)
Tease the next video: AC-042 · A repeated write creates duplicates.
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.