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
@@ -0,0 +1,21 @@
## 1. Код
- [x] 1.1 Платформа: предел тела по принятым байтам в `RequestPipeline`; `EventBus` без проекций; без неиспользуемого `shutdown_timeout_seconds`
- [x] 1.2 Identity: порт `SessionRevocations`, `revoke`/`restore` в `CachedSessionDirectory`, `NoRevocations`, снятие отметки при сбое транзакции выхода
- [x] 1.3 Messaging: пустой `cursor` → `400` в истории и списке; `POST_MESSAGE` лабы 3 остаётся
- [x] 1.4 Процесс: `timeout_graceful_shutdown = SHUTDOWN − DRAIN − 1`, `SHUTDOWN_TIMEOUT_SECONDS` 6 с в образе, compose и `gunicorn_conf.py`, `STOP_TIMEOUT` 7 с в хуках
- [x] 1.5 Проверка группы: `make lint`, `make check`, `make validate`
## 2. Тесты
- [x] 2.1 Перенос тестов лабы 2 с `Idempotency-Key`: `chunked`, посторонний и блокировка, сбой БД при выходе, запись без кэша, пустой курсор, `docker rm -fv`
- [x] 2.2 `test_timeouts.py`: дообработка за вычетом запаса ≥ таймаутов БД; `test_drain.py`: зависший запрос получает `500`, выход с кодом 0 раньше срока
- [x] 2.3 Стенд: полный рестарт с выходом, срок сессии после рестарта без `api-shortttl`
- [x] 2.4 Проверка группы: `make student-test`
## 3. Обвязка
- [x] 3.1 `Makefile`: `validate` из `.venv`, `PYTEST_ARGS`, `faults-evidence`, `down` с профилем `bench`; `pyproject.toml`/`uv.lock`: `openapi-spec-validator`, без `-q`
- [x] 3.2 `compose.yaml`: тег образа по проекту compose, `start_interval` 200 мс
- [x] 3.3 `scripts/evidence-cache.sh` с проверкой срока ключа, `kdf.txt` с заглушкой seed; `AGENTS.md`, `openspec/config.yaml`
- [x] 3.4 Проверка группы: стенд из чистого состояния, `make test`, `make test-failover`, `make test-persistence`, `make test-faults`, `make cache-evidence` (вывод — во временный файл)