# idempotency: Idempotency-Key, parallel same key via replicas # date: 2026-11-07 19:43:50, commit: 20afc2c + uncommitted changes # command: python.exe student-tests/test_idempotency.py # exit code: 0, 4.0 s first -> 201; same JSON written differently -> 201; plain retry -> 201 PASS: a retry with the same key returns the original 201 and message, no duplicate 20 parallel POSTs with one key: statuses {201: 20}, replicas {'f9e5ac61cde6': 10, '708b4b92f569': 10}, different bodies in answers: 1, messages in history: 1 PASS: parallel requests with one key through different replicas create exactly one message 20 parallel POSTs, one key, two different bodies: {('body A', 201): 10, ('body B', 409): 10}; saved: ['body A'] PASS: the first body wins, the same body gets 201, the other body gets 409 one key: alice in chat 1, bob in chat 1, alice in chat 2 -> 3 messages PASS: the key is scoped to the current user and chat; another body with a used key -> 409 missing, empty, 129 chars, space, '/', non-ASCII, '"', '+' -> 400; 128 chars of A-Z a-z 0-9 . _ : - -> 201 PASS: Idempotency-Key is required and checked: [A-Za-z0-9._:-]{1,128} key used by a 400 and by a 404 first, then valid request -> 201 PASS: rejected requests (400, 404) do not store a result for the key same key and body by an outsider -> 404; by alice after logout -> 401 PASS: a retry checks the session and chat access again, the saved answer is not leaked POST sent, connection closed without reading the answer; retry -> 201; messages: 1 PASS: an unconfirmed POST can be safely retried with the same key 8 passed, 0 failed