Archive the carry over of the lab 2 fixes change

Lab 3 now stands on the finished lab 2. The deltas are synced to
openspec/specs: the zones meet only in the schema and Valkey is needed
only to confirm a logout; an outsider does not wait for a chat lock;
an empty cursor is 400 on history and on the chat list; a stuck request
at SIGTERM gets 500 from the server itself within the 6 s budget, which
still leaves 3 s after the drain window for the database timeouts; a
chunked body is limited by the bytes received; a logout rejected by
PostgreSQL withdraws its revocation mark. The event publication purpose
follows lab 2.

On a stand rebuilt from empty volumes: make test passes, failover
recovers the first write in 3.1 s with 0 failed attempts, persistence
passes, test-faults 12 passed including the full restart with logout
and the shortened session after an API restart, detection passes all
four scenarios with SIGTERM detected in 0.82 s and the stop done in
2.44 s, and the cache evidence finds a tombstone and a key that does
not outlive its session.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-30 02:38:45 +03:00
co-authored by Claude Opus 5.5
parent a59e3a39a8
commit ac15b2ff62
14 changed files with 76 additions and 24 deletions
+11 -1
View File
@@ -58,9 +58,14 @@
- **WHEN** `chat_id` в пути не является UUID
- **THEN** ответ `400` с кодом `invalid_request`
#### Scenario: Посторонний не ждёт блокировок чужого чата
- **WHEN** участник держит открытую транзакцию отправки сообщения в чат, а посторонний в это время отправляет `POST /api/v1/chats/{chat_id}/messages` с `Idempotency-Key` в тот же чат
- **THEN** посторонний сразу получает `404` с кодом `not_found`, не дожидаясь завершения транзакции участника
### Requirement: Список чатов пользователя
Сервис SHALL отдавать по `GET /api/v1/chats` страницу `{"items":[...],"next_cursor":...}` с чатами, в которых состоит вызывающий, упорядоченными по `(created_at, id)` по возрастанию. Параметр `limit` SHALL быть целым в диапазоне 1–100 со значением по умолчанию 50. Список SHALL NOT содержать чатов, недоступных вызывающему.
Сервис SHALL отдавать по `GET /api/v1/chats` страницу `{"items":[...],"next_cursor":...}` с чатами, в которых состоит вызывающий, упорядоченными по `(created_at, id)` по возрастанию. Параметр `limit` SHALL быть целым в диапазоне 1–100 со значением по умолчанию 50. Список SHALL NOT содержать чатов, недоступных вызывающему. Переданный `cursor` SHALL быть непустым ранее выданным сервером курсором списка, иначе ответ SHALL быть `400`.
#### Scenario: Участник видит свой чат
@@ -83,3 +88,8 @@
- **THEN** страницы идут в порядке `(created_at, id)` по возрастанию, ни один чат не повторяется и не пропускается
- **AND** `next_cursor` последней страницы равен `null`
#### Scenario: Испорченный или пустой курсор списка
- **WHEN** запрос `GET /api/v1/chats` содержит `cursor=` с пустым значением или строку, которую сервер не выдавал
- **THEN** ответ `400` с кодом `invalid_request`