1. The problem
In one sentence
The server does the write, and then answers so late that the client gives up, so the client believes the write failed when it did not.
A story
A client creates a record with a POST. The server saves the record at once, and then spends a while on slow follow-up work before it answers. The client waits 1.5 seconds, hits its timeout and reports “failed”. The record exists. The user presses the button again. If the server cannot recognise a repeat, there are now two records (AC-042).
Why it hurts
A timeout does not mean “it did not happen”. It means “I do not know”. For reads, that does not matter. For writes, the client is left not knowing whether the data is saved.
- For developers: the client cannot tell failure from slowness. The server should either answer faster (do the slow work later), or support safe repeats so that the client may retry without harm.
- For managers: this is the root of many double charges and duplicate orders: the money was taken, the screen said “failed”, and the customer paid again.
- For DevOps: timeouts at a gateway or load balancer cut the answer but not the work. Make the timeouts, the server’s work time and the retry policy agree.
Example
In the sandbox, POST /timeout/after-write saves a record and then waits before it answers. The client sets a timeout of 1500 ms:
POST /timeout/after-write -> (no answer within 1500 ms: the client gives up)
GET /timeout/after-write/records -> total: 1 (the record exists)
How to detect it without clrsig
curl --max-time 1 -X POST URLfails with a timeout, thencurl URL/recordsshows the record.- In the logs, look for requests that ended with a client timeout and a successful write at the same time.
How to fix it
There are two usual causes:
- The server answers too late (more likely). Move slow work out of the request: answer as soon as the data is saved, or accept the work with
202 Acceptedand let the client check the result. - The client has no safe retry. Make the write idempotent (AC-042) so a retry after a timeout does no harm, and let the client read the state before it retries.
To tell which: measure how long the server takes after the data is saved. Never treat a timeout on a write as a failure without checking.
Related problems
AC-042 A repeated write creates duplicates, AC-017 The body is cut off, or the connection drops, AC-043 A stale update overwrites a newer one.
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
No built-in check for the effect, and the state is not caught. A request with no answer is reported as such (CS-RUN-003), but that does not tell you the write happened. A scenario that times out the write and then reads the records shows it.
Command
Save this scenario as timed-out-write.yaml. It sends a POST to the sandbox, so it writes data:
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.
schemaVersion: "1"
title: a write that took effect before the timeout
steps:
- label: reset
request: { method: POST, url: "{{baseUrl}}/__admin/reset" }
assertions:
- { type: status, operator: eq, expected: 204 }
failPolicy: stop
- label: timed-out write
timeoutMs: 1500
request: { method: POST, url: "{{baseUrl}}/timeout/after-write" }
assertions:
- { type: status, operator: eq, expected: 201 }
failPolicy: continue
- label: the write took effect anyway
request: { method: GET, url: "{{baseUrl}}/timeout/after-write/records" }
assertions:
- { type: jsonpath, path: "$.total", operator: eq, expected: "1" }
failPolicy: continue
clrsig run timed-out-write.yaml \
--env clrsig/environments/conform-fail.yaml \
--spec specs/conform-fail.yaml
Exit code: 0 all steps pass, 1 a step failed, 2 the scenario or the setup is broken. Here it is 1.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: a write that took effect before the timeout
PASS reset 204 15ms
✓ status eq 204
FAIL timed-out write
error: executing request: Post "http://localhost:8080/conform-fail/timeout/after-write": context deadline exceeded
→ No complete response arrived within the time limit. The server may still have received the request and acted on it. Do not assume nothing happened: for a request that changes data, check before sending it again. Check: Check the server's logs to see whether the request arrived and how long it took. If a slow answer is expected, allow more time (the request's timeout, or the default timeout). [CS-NET-004]
PASS the write took effect anyway 200 3ms
✓ jsonpath $.total eq 1
Spec: 2 of 3 responses were not compared with the spec (no matching operation in the spec: 1; the step did not complete: 1)
FAILED 2 passed, 1 failed, 0 skipped (2/2 assertions passed) 1522ms
How to read it: the write step fails (context deadline exceeded: the client gave up), and the next step shows that the record exists. The run failed, and the data is saved: both are true.
Where to look
- Desktop app: open the scenario and run it; the step with the timeout shows the error, and the read-back shows the record.
- Reports:
--format jsonandjunitonclrsig run. - GitHub Action: use
command: runwith thescenario,envandspecinputs;specreplaces the scenario’sspecFile. Older releases of the Action ignoredspecwithrun; if you use one, addspecFile: specs/conform-fail.yamlto the scenario instead (the path is relative to the scenario file) (setup and upgrading).
How clrsig helps you fix it
It lets you prove that “failed” and “done” are both true for the same write, which is the evidence for fixing the server’s response time or adding idempotency.
Limits
- The timeout is a value you set per step (
timeoutMs). Choose the one your real clients use. - The scenario shows one write. It does not show what a client does after a timeout.
More ways
Nothing yet.
3. Video brief for Google NotebookLM
VIDEO BRIEF — AC-044 · A write times out, yet it was done
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: a timeout does not mean it did not happen; it means I do not know; for a write, that is dangerous.
Open with this story: A client creates a record with a POST. The server saves the record at once and then spends a while on slow follow-up work before it answers. The client waits one and a half seconds, hits its timeout and reports failed. The record exists. The user presses the button again.
Say these facts, in this order:
1. The scenario sets a timeout of 1500 milliseconds on a write. The write step fails with context deadline exceeded.
2. The next step reads the records and finds one: the write took effect anyway.
3. The run failed and the data is saved: both are true.
4. For a read, a timeout does not matter. For a write, the client does not know whether the data is saved.
5. Two usual causes: the server answers too late (answer as soon as the data is saved, or answer 202 Accepted and let the client check), or the client has no safe retry (make the write idempotent and read the state before retrying).
6. For managers: this is the root of many double charges and duplicate orders.
7. For DevOps: gateway and load-balancer timeouts cut the answer but not the work; make timeouts, server work time and retry policy agree.
Show on screen: the two example lines, the scenario YAML, the command (clrsig run timed-out-write.yaml --env clrsig/environments/conform-fail.yaml --spec specs/conform-fail.yaml), and the output block, copied exactly from the card.
Name the check: none built in; found by timing out a write and reading the records. Say the clrsig version: v0.21.0.
Explain these words once: timeout (the time a client waits before it gives up); 202 (accepted, but not done yet); idempotent (doing it twice has the same effect as doing it once); scenario (a script of steps with your own checks, called assertions); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: the timeout is a value you set per step; the scenario shows one write, not what a client does after a timeout.
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 timeout on a write really tell you? (That you do not know whether it happened.)
2. How can a server avoid the problem? (Answer faster, or answer 202 and let the client check.)
3. How does a client retry safely? (With an idempotent write, after reading the state.)
Tease the next video: AC-045 · A stale read after a write.
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.