Coverage-exclusion evidence on the lab 6 stand (db3340d), failure checks, isolated and LB test runs, clean clone and secrets check; fill REPORT.md from the skeleton template, drop PLAN.md (last versiondb3340d). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.5 KiB
4.5 KiB
Повтор отправки после рестарта API
- Шаги: синтетический пользователь (регистрация, вход по Basic) и чат;
POST /api/v1/chats/<chat>/messagesсIdempotency-Key;docker compose up -d --force-recreate api; ожидание/health/ready200 через LB; тот жеPOSTс тем же ключом и токеном; другое тело с тем же ключом;GETистории. Шаги выполнил разовый скрипт на stdlib вне репозитория (те же запросы, чтоdriver.py --port 8080 req … --key <ключ>скилла), шаги выше повторяются руками - Дата: 2026-11-15, 06:39:32–06:39:38 UTC; код выхода 0
- Commit:
db3340d(веткаfeat/lab6-final), рабочее дерево без правок кода (изменены толькоQUESTIONS.mdи файлыevidence/) - Стенд: проект compose
mtusi-lab6, две реплики за HAProxy, телеметрия включена, собранmake run_dockerизHEAD; пользователь и чат синтетические - Спек:
idempotency, «Повтор после рестарта API» (исключение сверки покрытия: тесты сервер не трогают) - Вывод обезличен: ключ заменён на
<key>; токена и пароля в выводе нет
Итог: новые контейнеры обеих реплик (другие id и StartedAt), повтор — тот же 201 и тот же Message от реплики, которой при первой отправке не было (e6c96453fc1b → d34fc9b86aa4). В истории одно сообщение; другое тело с тем же ключом — 409. Сессия и ключ лежат в PostgreSQL, поэтому пересоздание реплик на них не влияет. Compose пересоздал только реплики, зависимости (migrate, s3-bootstrap) лишь повторно запустил; PostgreSQL не перезапускался.
--- before: api containers (name, id, StartedAt)
/mtusi-lab6-api-13 8112fa687696 2026-11-15T06:33:44.100363013Z
/mtusi-lab6-api-14 e6c96453fc1b 2026-11-15T06:39:07.790523426Z
--- first send
idempotency-key: <key>
201 x-request-id: 2186a97e48604705a47121996a371299 x-instance-id: e6c96453fc1b
{
"id": "a23371cd-c05f-4d9c-b5a5-5fad6612ae9d",
"chat_id": "9a476e8c-87fe-4ea8-985b-24880bd533b3",
"sender_id": "c964e2db-d181-4e27-8d42-4d72e68fe2a4",
"text": "replay after restart",
"created_at": "2026-11-15T06:39:32.610039Z",
"attachment_ids": []
}
--- docker compose up -d --force-recreate api
Container mtusi-lab6-api-13 Recreate
Container mtusi-lab6-api-14 Recreate
Container mtusi-lab6-api-13 Recreated
Container mtusi-lab6-api-14 Recreated
Container mtusi-lab6-s3-bootstrap-1 Starting
Container mtusi-lab6-migrate-1 Starting
Container mtusi-lab6-s3-bootstrap-1 Started
Container mtusi-lab6-migrate-1 Started
Container mtusi-lab6-migrate-1 Waiting
Container mtusi-lab6-s3-bootstrap-1 Waiting
Container mtusi-lab6-migrate-1 Exited
Container mtusi-lab6-s3-bootstrap-1 Exited
Container mtusi-lab6-api-14 Starting
Container mtusi-lab6-api-14 Started
Container mtusi-lab6-api-13 Starting
Container mtusi-lab6-api-13 Started
exit 0
LB ready: 200
--- after: api containers (name, id, StartedAt)
/mtusi-lab6-api-13 d34fc9b86aa4 2026-11-15T06:39:37.107929926Z
/mtusi-lab6-api-14 35f606496f73 2026-11-15T06:39:37.041578759Z
--- repeat with the same key, the same session
idempotency-key: <key>
201 x-request-id: ecdfd487a0de46f7b6f97665adf584d2 x-instance-id: d34fc9b86aa4
{
"id": "a23371cd-c05f-4d9c-b5a5-5fad6612ae9d",
"chat_id": "9a476e8c-87fe-4ea8-985b-24880bd533b3",
"sender_id": "c964e2db-d181-4e27-8d42-4d72e68fe2a4",
"text": "replay after restart",
"created_at": "2026-11-15T06:39:32.610039Z",
"attachment_ids": []
}
--- other body with the same key
idempotency-key: <key>
409 x-request-id: 12ed1beb0aa5443a9181b2869e62336f x-instance-id: 35f606496f73
{
"error": {
"code": "conflict",
"message": "Idempotency key was already used with another request",
"request_id": "12ed1beb0aa5443a9181b2869e62336f"
}
}
--- history
{"count": 1, "ids": ["a23371cd-c05f-4d9c-b5a5-5fad6612ae9d"]}
--- compare
Message of the repeat = Message of the first send: yes
other instance answered the repeat: yes
PASS