forked from mtusi2026/mtusi2026lab2
The deltas are synced to openspec/specs: the order of checks on posting
a message (401, then 400 for the request shape without touching the
chat, then 404 for access, then 400 for the text); three detection runs
with a 0.25 s measurement slack and the replica states after each stop
in failover-each; the upper bound of the track 1 grid with a ceiling on
the first grid point stated as a lower bound; control runs of the pool,
the LB queue and the placement.
Before archiving, on the running stand: make test passes, failover
recovers the first write in 2.78 s with 0 failed attempts, persistence
passes; make check, make lint and 243 own tests pass. All level 3 and 4
records were taken on b1c80ee, after the lab 2 carry over.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
1.7 KiB
1.7 KiB
ADDED Requirements
Requirement: Порядок проверок отправки сообщения
POST /api/v1/chats/{chat_id}/messages SHALL проверять запрос в таком порядке: сессия (401), форма запроса — заголовок Idempotency-Key, malformed JSON, лишние поля и типы (400 invalid_request), доступ к чату (404 not_found), затем текст сообщения (400 invalid_request). Ответ постороннему SHALL NOT раскрывать, существует ли чат: 400 по форме запроса отдаётся без обращения к чату и одинаков для существующего и несуществующего чата, а ошибка текста постороннему SHALL быть 404.
Scenario: Посторонний без ключа
- WHEN аутентифицированный посторонний отправляет в существующий чат запрос без
Idempotency-Key - THEN ответ
400с кодомinvalid_request, такой же, как для несуществующего чата
Scenario: Посторонний с невалидным текстом
- WHEN посторонний отправляет с корректным ключом текст из пробелов
- THEN ответ
404с кодомnot_found, а не400
Scenario: Участник с невалидным текстом
- WHEN участник отправляет с корректным ключом текст из пробелов
- THEN ответ
400с кодомinvalid_request, ключ не занят