Archive pool recovery and record current grade 3 evidence

This commit is contained in:
Artyom
2026-11-05 22:08:14 +03:00
parent 0a1f48bd73
commit ef0b9a385e
38 changed files with 1171 additions and 521 deletions
+53 -28
View File
@@ -1,35 +1,60 @@
# Доказательства
Обезличенные результаты прогонов лабы 3. Пользователи, чаты и тексты синтетические; паролей, токенов, `.env`,
содержимого `secrets/` и дампов здесь нет. В первой строке каждого отчёта `*.txt` в `evidence/` и `track1/` — дата
(UTC) и коммит прогона. У `lb-check.json`, `retry.json` и у сырья в каталогах прогонов (`detection/`, `failover-each/`, `rolling*/`,
`track1/<серия>/`: JSON, CSV, `action.txt`, `k6/k6.txt`) даты и коммита внутри нет: коммит — в столбце «Коммит»
таблиц ниже, время — в `started` строк `summary.csv` трека и в метках времени `action.txt`. Проверки через
балансировщик шли на порт 18083 (`LB_HTTP_PORT`; 8080 на машине был занят стендами других лаб): цели `make` берут `BASE_URL` из
`docker compose port lb 8080`. Hostname реплики = `X-Instance-Id`; ID контейнеров меняются между прогонами.
Обезличенные реальные прогоны; пользователи, сообщения и пароли тестов синтетические. Токены,
содержимое secrets и дампы не сохраняются. В первой строке текстовых логов — UTC и SHA;
`grade3-*.txt` также содержат команду, окружение, код завершения и длительность.
В сохранённом текстовом выводе удалены только пробелы на концах строк Docker/psql; локальный путь заменён на `<repo>`.
## Уровень «3» и перенос лабы 2
## Уровень «3» после SQLAlchemy — 2026-11-05
| Файл | Что доказывает | Команда | Коммит |
| --- | --- | --- | --- |
| `clean-clone.txt` | запуск из свежего clone на пустых volumes: секреты, `config`, `make up` с миграциями `0001`/`0002` и ожиданием всех реплик в LB, smoke, `lb-check`, `retry-check`, failover обеих реплик, persistence (всё без явного `BASE_URL` при `LB_HTTP_PORT=18083`), повтор миграций, `storage-evidence` в клоне, `make down` (volumes остаются), `make reset-data` (volumes удалены) | команды блока «Запуск из чистого clone» `REPORT.md` дословно, между ними — наблюдения (`docker compose ps`, статистика LB, `docker volume ls`) | `e049c26` |
| `checks.txt` | реальный вывод `make check`, `make validate` (`openapi-spec-validator` из dev-группы `.venv`) и `make lint`; `git diff --stat upstream/main` контракта, публичных тестов и задания (пусто) и `.github` (только свой CI job) | команды внутри файла | `e049c26` |
| `smoke.txt` | публичный smoke через LB | `make test` | `e049c26` |
| `stack.txt` | сервисы, только `lb` публикует порты, `container_name` 0, `docker port` реплик пуст, hostname ↔ `X-Instance-Id`, лимиты, сети, uid, взгляд LB | `make stack-evidence` | `e049c26` |
| `environment.txt` | host, Docker, образы по digest, версии пакетов, uid процессов | `make stack-evidence` | `e049c26` |
| `lb-check.json` | 40 `GET /users/me` одним токеном — 20 + 20 по двум репликам; 20 раундов × 8 параллельных POST с одним ключом — 160 × `201`, одна копия, `409` на другой body | `make lb-check` | `e049c26` |
| `retry.json` | потерянный ответ: запись ждёт блокировку строки чата дольше таймаута клиента, повтор с тем же ключом через LB — на живой реплике и после `docker kill` реплики, чей запрос ждёт; `201`, одна копия с тем же `id`, кто записал сообщение, ответила ли реплика без клиента | `make retry-check` | `e049c26` |
| `failover-fe75c6c37e5a.txt`, `failover-ff81f93e8b0d.txt` | `make test-failover ACTION_SCRIPT=scripts/stop-one.sh` для каждой реплики: `docker inspect` до/после, остановлен именно target, лог его остановки, `restore` | `make failover-evidence`, затем `make failover-evidence SHIFT=1` | `e049c26` |
| `hooks.txt` | `stop-one.sh`: длительность, код, остановлен только target; неизвестный ID → 3; без переменной → 1; все реплики остановлены → `503` LB в формате контракта | команды внутри файла | `e049c26` |
| `persistence.txt` | `make test-persistence ACTION_SCRIPT=scripts/restart.sh` и `StartedAt` всех контейнеров до и после | `make persistence-evidence` | `e049c26` |
| `faults.txt` | тесты стенда лабы 2 через LB: гонка регистрации, остановка Valkey и PostgreSQL, рестарт API, полный рестарт с выходом, срок сессии после рестарта | `make faults-evidence` | `e049c26` |
| `student-tests.txt` | все собственные тесты по именам (идемпотентность, `X-Instance-Id`, сессии, конвейер) и вывод теста `SIGTERM`-окна и цепочки таймаутов | `PYTEST_ADDOPTS=-vv make student-test`; `pytest -s` двух файлов | `e049c26` |
| `schema.txt` | `\d+` всех таблиц и применённые миграции | `make storage-evidence` | `e049c26` |
| `migrations.txt` | повторный `migrate` → `up to date`, счётчики строк до и после равны | `make storage-evidence` | `e049c26` |
| `kdf.txt` | Argon2id у всех пользователей, в `sessions` только 32-байтовые SHA-256 | `make storage-evidence` | `e049c26` |
| `secrets.txt` | секреты, `.env`, дампы и volumes не в Git и игнорируются | `make storage-evidence` | `e049c26` |
Код всех итоговых прогонов: **`0a1f48bd73e5780c732356880c23fdb476bcff98`**.
Compose-проект `mtusi2026lab3-grade3-final-20261105`, `LB_HTTP_PORT=18083`, `LB_STATS_PORT=23083`,
`API_REPLICAS=2`; BASE_URL автоматически определяется по порту LB. Обе реплики:
api-1 `8ffe0c70f4ea`, api-2 `1b4a73f61b07`. После прогонов контейнеры остановлены,
volumes сохранены. Код приложения после этого SHA не менялся; далее — документация и архив OpenSpec.
## Уровень «4»
| Файл | Команда | Результат |
| --- | --- | --- |
| `grade3-start.txt` | `make up`, `docker compose ps -a`, чтение `alembic_version` | Новый проект без прежних volumes, сборка успешна, 2 healthy API, one-shot Alembic вышел с 0, head `0002_idempotency_keys` |
| `checks.txt` | `make check`, `make validate`, `make lint`, `uv lock --check`, `openspec validate --all --strict`, diff против upstream | Все успешно; нормативные файлы не менялись |
| `smoke.txt` | `make test` | Публичный smoke PASS |
| `stack.txt`, `environment.txt`, `grade3-stack.txt` | `make stack-evidence` | Порты только у LB, реальные контейнеры и hostname, 2 UP, общие PostgreSQL/Valkey, uid, версии библиотек |
| `lb-check.json`, `grade3-lb-check.txt` | `make lb-check` | Один токен 20 + 20 GET; 20 × 8 POST, 160 ответов 201, по одной копии, 20 конфликтов другого body; pass |
| `retry.json`, `grade3-retry.txt` | `make retry-check` | Потерянный ответ при живой/убитой реплике, повтор через соседа 201, одна копия; pass |
| `failover-current-1.txt`, `failover-current-2.txt` | `make test-failover ACTION_SCRIPT=scripts/stop-one.sh` и `docker compose ps -a` | По очереди api-1 и api-2 Exited (0); 129/128 записей, 0/0 ошибок, восстановление 2.762/2.817 с |
| `grade3-restore-1.txt`, `grade3-restore-2.txt` | `make restore` | Остановленные реплики возвращены в ротацию |
| `persistence.txt`, `grade3-persistence.txt` | `make persistence-evidence` → публичный `make test-persistence ACTION_SCRIPT=scripts/restart.sh` | PASS, IDs прежние, StartedAt всех сервисов обновились, токен и история сохранились |
| `faults.txt` | `make test-faults` | 12 passed; после PostgreSQL 40 регистраций через 2 реплики без рестарта API |
| `student-tests.txt` | `make student-test PYTEST_ARGS=-vv` | 271 passed, 12 deselected; стендовые 12 запущены отдельно |
| `schema.txt`, `migrations.txt`, `grade3-storage.txt` | `make storage-evidence` | Схема Alembic, повтор без изменения 70 users / 24 sessions / 6 chats / 12 members / 284 messages / 284 keys / 1 version |
| `kdf.txt`, `secrets.txt` | `make storage-evidence` | Argon2id, хеши токенов 32 байта; секреты/.env вне Git |
| `grade3-final-review.txt` | Финальные проверки после обновления отчёта и архива | check/validate/lint/OpenSpec, diff нормативных и исполняемых файлов, отсутствие контейнеров этапа |
| `grade3-stop.txt` | `make down`, `docker compose ps -a`, volumes проектов | Контейнеров нет, volumes обоих прогонов сохранены |
Дата и полный SHA JSON-файлов `lb-check.json` и `retry.json` находятся в соответствующих
`grade3-lb-check.txt` и `grade3-retry.txt`, которые содержат тот же вывод JSON.
## Неуспешные промежуточные прогоны
Они сохранены отдельно, не выдаются за итоговые PASS.
| Файл | Код / состояние | Наблюдение и исправление |
| --- | --- | --- |
| `grade3-faults.txt` | `7fc911c332aefe33285ea9e7811c37abd9bb20a6` | 11 passed / 1 failed: POST users → 503 после PostgreSQL; включён `pool_pre_ping` |
| `grade3-pool-regression-before.txt` | `18de595` + новый тест (приложение прежнее) | Первый POST после `pg_terminate_backend` → 503 вместо 201 |
| `grade3-pool-regression-after.txt` | `18de595` + исправления до коммита `0a1f48b` | 2 passed: закрытое соединение и SIGTERM; затем полный набор проверен на `0a1f48b` |
| `grade3-student-tests-interrupted.txt` | `7fc911c` | 46 passed, затем прерывание: gunicorn теста использовал порт LB 18083; теперь свободный 23000–23999 и дедлайн |
| `grade3-student-tests-startup.txt.gz` | `18de595` + исправления до `0a1f48b` | Полный обезличенный вывод: 70 passed / 201 errors, SQLSTATE 57P03 при старте fixture БД; временный отказ теперь повторяется до дедлайна |
| `grade3-whitespace-before.txt` | `0a1f48b` + evidence/OpenSpec | `git diff --check` нашёл пробелы в конце строк Docker/psql; после нормализации итоговая проверка прошла |
| `grade3-initial-stop.txt` | `18de595` + WIP | Остановка исходного проекта без удаления его volumes перед итоговым прогоном |
`clean-clone.txt`, `hooks.txt`, `failover-fe75c6c37e5a.txt`, `failover-ff81f93e8b0d.txt`
и данные уровня «4»/трека ниже — **история до SQLAlchemy**, с собственными датами и SHA.
Исторические версии перезаписанных файлов доступны через `git show 7fc911c:evidence/<имя>`.
Они не подтверждают актуальную производительность. Уровень «4», затем трек «Цена масштабирования»
перегенерируются следующими последовательными этапами; исходный change остаётся активным.
## Уровень «4» — исторические результаты до SQLAlchemy
| Файл | Что доказывает | Команда | Коммит |
| --- | --- | --- | --- |
@@ -40,7 +65,7 @@
| `rolling-from-8d28d45/` | rolling update с образа уровня «3» (`mtusi-messenger:8d28d45`) на текущий под k6: ёмкость, ошибки, замена всех реплик, `migrate` один раз; в `action.txt` — тег и ID образа каждой заменяемой и новой реплики, размер БД и `docker stats` | `make rolling-update FROM_REV=8d28d45` | `e049c26` |
| `rolling/` | rolling update текущей сборкой под k6 | `make rolling-update` | `e049c26` |
## Трек 1 «Цена масштабирования»
## Трек 1 «Цена масштабирования» — исторические результаты до SQLAlchemy
`track1/` — серии A и B, сравнение до/после, контрольные прогоны, графики и проверки после улучшения; состав и поля CSV —
`track1/README.md`.
+28 -17
View File
@@ -1,23 +1,34 @@
date: 2026-10-30T02:44:16Z commit: e049c26
$ make check
date: 2026-11-05T18:56:09.780488+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ sh -c 'set -e; make check; make validate; make lint; uv lock --check; openspec validate --all --strict; git diff --exit-code upstream/main -- contracts tests README.md COURSE.md lab.json MAINTAINERS.md'
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
exit=0
$ make validate # .venv из make install: openapi-spec-validator в dev-группе
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
exit=0
$ make lint
.venv/bin/ruff check src student-tests scripts/probe.py scripts/limits.py scripts/scaling.py tools
.venv/bin/ruff check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
All checks passed!
.venv/bin/ruff format --check src student-tests scripts/probe.py scripts/limits.py scripts/scaling.py tools
104 files already formatted
.venv/bin/ty check src student-tests
.venv/bin/ruff format --check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
107 files already formatted
.venv/bin/ty check src student-tests alembic
All checks passed!
exit=0
$ git diff --stat upstream/main -- contracts tests README.md COURSE.md lab.json MAINTAINERS.md # контракт, публичные тесты и задание не изменены: вывод пуст
exit=0
$ git diff --stat upstream/main -- .github # шаблон PR не изменён, добавлен только собственный CI job
.github/workflows/application.yml | 82 +++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
exit=0
Resolved 64 packages in 14ms
- Validating...
✓ change/2026-11-05-adopt-sqlalchemy-alembic
✓ change/fix-lab3-postgres-pool-recovery
✓ spec/lab1-event-publication
✓ spec/lab1-messenger-chats
✓ spec/lab1-messenger-history
✓ spec/lab1-messenger-identity
✓ spec/lab1-service-operability
✓ spec/lab2-auth-sessions
✓ spec/lab2-dependency-failures
✓ spec/lab2-history-index
✓ spec/lab2-persistent-storage
✓ spec/lab2-session-cache
✓ spec/lab3-failover-operations
✓ spec/lab3-idempotent-messages
✓ spec/lab3-load-balancing
✓ spec/lab3-scaling-cost
Totals: 16 passed, 0 failed (16 items)
exit_code: 0 elapsed_seconds: 1.458
+3 -1
View File
@@ -1,4 +1,4 @@
date: 2026-10-30T02:45:02Z commit: e049c26
date: 2026-11-05T18:59:00Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
host: Apple M4 Max, 16 CPU, 48 GiB RAM, macOS 15.1
docker: 28.3.2, VM: 16 CPU, 8217190400 bytes
compose: 2.38.2-desktop.1
@@ -18,6 +18,8 @@ packages (uv.lock):
uvicorn 0.54.0
uvicorn-worker 0.4.0
gunicorn 26.2.0
sqlalchemy 2.0.45
alembic 1.16.5
asyncpg 0.32.0
argon2-cffi 25.1.0
pydantic 2.13.5
+23
View File
@@ -0,0 +1,23 @@
date: 2026-11-05T18:58:02.224418+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ sh -c 'docker compose ps -a; make test-failover ACTION_SCRIPT=scripts/stop-one.sh; result=$?; docker compose ps -a; exit "$result"'
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-grade3-final-20261105-api-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 2 minutes ago Up 3 seconds (healthy)
mtusi2026lab3-grade3-final-20261105-api-2 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 2 minutes ago Up About a minute (healthy)
mtusi2026lab3-grade3-final-20261105-lb-1 haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b "docker-entrypoint.s…" lb 2 minutes ago Up About a minute (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
mtusi2026lab3-grade3-final-20261105-migrate-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "alembic upgrade head" migrate 2 minutes ago Exited (0) About a minute ago
mtusi2026lab3-grade3-final-20261105-postgres-1 postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b "docker-entrypoint.s…" postgres 2 minutes ago Up About a minute (healthy)
mtusi2026lab3-grade3-final-20261105-valkey-1 valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a "tini -- docker-entr…" valkey 2 minutes ago Up About a minute (healthy)
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18083"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 129, "failed_attempts": 0, "first_recovery_seconds": 2.762}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-grade3-final-20261105-api-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 2 minutes ago Exited (0) 12 seconds ago
mtusi2026lab3-grade3-final-20261105-api-2 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 2 minutes ago Up 2 minutes (healthy)
mtusi2026lab3-grade3-final-20261105-lb-1 haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b "docker-entrypoint.s…" lb 2 minutes ago Up 2 minutes (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
mtusi2026lab3-grade3-final-20261105-migrate-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "alembic upgrade head" migrate 2 minutes ago Exited (0) 2 minutes ago
mtusi2026lab3-grade3-final-20261105-postgres-1 postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b "docker-entrypoint.s…" postgres 2 minutes ago Up 2 minutes (healthy)
mtusi2026lab3-grade3-final-20261105-valkey-1 valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a "tini -- docker-entr…" valkey 2 minutes ago Up 2 minutes (healthy)
exit_code: 0 elapsed_seconds: 15.820
+23
View File
@@ -0,0 +1,23 @@
date: 2026-11-05T18:58:20.145733+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ sh -c 'curl -fsS -o /dev/null "http://$(docker compose port lb 8080)/health/live"; docker compose ps -a; make test-failover ACTION_SCRIPT=scripts/stop-one.sh; result=$?; docker compose ps -a; exit "$result"'
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-grade3-final-20261105-api-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 2 minutes ago Up 2 seconds (healthy)
mtusi2026lab3-grade3-final-20261105-api-2 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 2 minutes ago Up 2 minutes (healthy)
mtusi2026lab3-grade3-final-20261105-lb-1 haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b "docker-entrypoint.s…" lb 2 minutes ago Up 2 minutes (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
mtusi2026lab3-grade3-final-20261105-migrate-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "alembic upgrade head" migrate 2 minutes ago Exited (0) 2 minutes ago
mtusi2026lab3-grade3-final-20261105-postgres-1 postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b "docker-entrypoint.s…" postgres 2 minutes ago Up 2 minutes (healthy)
mtusi2026lab3-grade3-final-20261105-valkey-1 valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a "tini -- docker-entr…" valkey 2 minutes ago Up 2 minutes (healthy)
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18083"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 2.817}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-grade3-final-20261105-api-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 3 minutes ago Up 17 seconds (healthy)
mtusi2026lab3-grade3-final-20261105-api-2 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 3 minutes ago Exited (0) 12 seconds ago
mtusi2026lab3-grade3-final-20261105-lb-1 haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b "docker-entrypoint.s…" lb 3 minutes ago Up 2 minutes (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
mtusi2026lab3-grade3-final-20261105-migrate-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "alembic upgrade head" migrate 3 minutes ago Exited (0) 2 minutes ago
mtusi2026lab3-grade3-final-20261105-postgres-1 postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b "docker-entrypoint.s…" postgres 3 minutes ago Up 2 minutes (healthy)
mtusi2026lab3-grade3-final-20261105-valkey-1 valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a "tini -- docker-entr…" valkey 3 minutes ago Up 2 minutes (healthy)
exit_code: 0 elapsed_seconds: 15.802
+18 -14
View File
@@ -1,4 +1,5 @@
date: 2026-10-30T02:46:09Z commit: e049c26
date: 2026-11-05T18:55:40.945444+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make test-faults
BASE_URL="http://127.0.0.1:18083" .venv/bin/pytest -m stack -v -s student-tests/stack
============================= test session starts ==============================
@@ -14,19 +15,19 @@ student-tests/stack/test_faults.py::test_registration_race_yields_exactly_one_us
PASSED
student-tests/stack/test_faults.py::test_chat_creation_rolls_back_on_unknown_member чат с несуществующим участником: 400 invalid_request
PASSED
student-tests/stack/test_faults.py::test_wrong_password_and_unknown_user_get_same_basic_challenge неверный пароль: 401 за 0.012 с
неизвестный пользователь: 401 за 0.013 с
student-tests/stack/test_faults.py::test_wrong_password_and_unknown_user_get_same_basic_challenge неверный пароль: 401 за 0.013 с
неизвестный пользователь: 401 за 0.012 с
PASSED
student-tests/stack/test_faults.py::test_logout_then_token_is_dead logout: 204, затем 401, повтор 401
PASSED
student-tests/stack/test_faults.py::test_valkey_serves_repeated_checks 5 проверок токена: keyspace_hits 4 → 9
student-tests/stack/test_faults.py::test_valkey_serves_repeated_checks 5 проверок токена: keyspace_hits 3 → 8
PASSED
student-tests/stack/test_faults.py::test_valkey_stopped_is_bypassed_but_logout_waits valkey остановлен, действующий токен: 200 за 0.004 с
valkey остановлен, неизвестный токен: 401 за 0.003 с
student-tests/stack/test_faults.py::test_valkey_stopped_is_bypassed_but_logout_waits valkey остановлен, действующий токен: 200 за 0.014 с
valkey остановлен, неизвестный токен: 401 за 0.004 с
valkey остановлен: ready 200, вход 201, выход 503
valkey снова запущен: повторный выход 204
PASSED
student-tests/stack/test_faults.py::test_valkey_restart_keeps_cache_and_revocations рестарт valkey: ключей 15 → 15
student-tests/stack/test_faults.py::test_valkey_restart_keeps_cache_and_revocations рестарт valkey: ключей 6 → 6
рестарт valkey: живой 200, отозванный 401
PASSED
student-tests/stack/test_faults.py::test_valkey_flushall_loses_nothing FLUSHALL: живой 200, отозванный 401
@@ -34,18 +35,21 @@ PASSED
student-tests/stack/test_faults.py::test_postgres_stopped_gives_bounded_503_and_recovers postgres остановлен, ready: 503 за 0.004 с
postgres остановлен, me: 503 за 0.003 с
postgres остановлен, stranger: 503 за 0.003 с
postgres остановлен, login: 503 за 0.002 с
postgres остановлен, login: 503 за 0.003 с
postgres остановлен, register: 503 за 0.014 с
live внутри реплики 200; LB исключил все реплики ещё через 1.04 с
live внутри реплики 200; LB исключил все реплики ещё через 0.86 с
live через LB без реплик: 503 за 0.000 с
postgres запущен: готовность через 2.1 с, прежний токен 200
postgres запущен: готовность через 2.0 с, прежний токен 200
postgres запущен: 40 регистраций 201 через 2 реплики без рестарта API
PASSED
student-tests/stack/test_faults.py::test_api_restart_keeps_session_without_extending_it рестарт api: готовность через 2.3 с, токен 200
expires_at при входе 2026-10-30T03:46:23.761174Z, в БД после рестарта 2026-10-30T03:46:23.761174Z
student-tests/stack/test_faults.py::test_api_restart_keeps_session_without_extending_it рестарт api: готовность через 1.5 с, токен 200
expires_at при входе 2026-11-05T19:55:55.410073Z, в БД после рестарта 2026-11-05T19:55:55.410073Z
PASSED
student-tests/stack/test_faults.py::test_full_restart_keeps_session_until_logout restart.sh: готовность через 0.0 с, прежний токен 200, выход 204, затем 401
PASSED
student-tests/stack/test_faults.py::test_session_expires_after_restart_at_original_time срок сессии сокращён до 20 с, рестарт api: готовность через 1.5 с, до срока 200, после срока 401
student-tests/stack/test_faults.py::test_session_expires_after_restart_at_original_time срок сессии сокращён до 20 с, рестарт api: готовность через 2.8 с, до срока 200, после срока 401
PASSED
============================= 12 passed in 48.01s ==============================
============================= 12 passed in 47.62s ==============================
exit_code: 0 elapsed_seconds: 48.183
+35
View File
@@ -0,0 +1,35 @@
date: 2026-11-05T19:06:46.410264+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ sh -c 'set -e; make check; make validate; make lint; openspec validate --all --strict; git diff --check; git diff --exit-code upstream/main -- contracts tests README.md COURSE.md lab.json MAINTAINERS.md; git diff --exit-code 0a1f48bd73e5780c732356880c23fdb476bcff98 -- src student-tests alembic pyproject.toml uv.lock Dockerfile compose.yaml Makefile infra scripts; git diff --exit-code 7fc911c332aefe33285ea9e7811c37abd9bb20a6 -- .pipeline; docker ps -a --filter label=com.docker.compose.project=mtusi2026lab3-grade3-final-20261105; docker ps -a --filter label=com.docker.compose.project=mtusi2026lab3-grade3-20261105; docker ps -a --filter name=mtusi-lab3-test'
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
.venv/bin/ruff check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
All checks passed!
.venv/bin/ruff format --check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
107 files already formatted
.venv/bin/ty check src student-tests alembic
All checks passed!
- Validating...
✓ change/2026-11-05-adopt-sqlalchemy-alembic
✓ spec/lab1-event-publication
✓ spec/lab1-messenger-chats
✓ spec/lab1-messenger-history
✓ spec/lab1-messenger-identity
✓ spec/lab1-service-operability
✓ spec/lab2-auth-sessions
✓ spec/lab2-dependency-failures
✓ spec/lab2-history-index
✓ spec/lab2-persistent-storage
✓ spec/lab2-session-cache
✓ spec/lab3-failover-operations
✓ spec/lab3-idempotent-messages
✓ spec/lab3-load-balancing
✓ spec/lab3-scaling-cost
Totals: 15 passed, 0 failed (15 items)
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
exit_code: 0 elapsed_seconds: 4.870
+34
View File
@@ -0,0 +1,34 @@
date: 2026-11-05T18:53:15.466343+00:00 commit: 18de59574016564ce4eb69da9f4363441ba33f7d
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make down
docker compose --profile bench down
Container mtusi2026lab3-grade3-20261105-lb-1 Stopping
Container mtusi2026lab3-grade3-20261105-api-1 Stopping
Container mtusi2026lab3-grade3-20261105-api-2 Stopping
Container mtusi2026lab3-grade3-20261105-lb-1 Stopped
Container mtusi2026lab3-grade3-20261105-lb-1 Removing
Container mtusi2026lab3-grade3-20261105-lb-1 Removed
Container mtusi2026lab3-grade3-20261105-api-1 Stopped
Container mtusi2026lab3-grade3-20261105-api-1 Removing
Container mtusi2026lab3-grade3-20261105-api-1 Removed
Container mtusi2026lab3-grade3-20261105-api-2 Stopped
Container mtusi2026lab3-grade3-20261105-api-2 Removing
Container mtusi2026lab3-grade3-20261105-api-2 Removed
Container mtusi2026lab3-grade3-20261105-valkey-1 Stopping
Container mtusi2026lab3-grade3-20261105-migrate-1 Stopping
Container mtusi2026lab3-grade3-20261105-migrate-1 Stopped
Container mtusi2026lab3-grade3-20261105-migrate-1 Removing
Container mtusi2026lab3-grade3-20261105-migrate-1 Removed
Container mtusi2026lab3-grade3-20261105-postgres-1 Stopping
Container mtusi2026lab3-grade3-20261105-valkey-1 Stopped
Container mtusi2026lab3-grade3-20261105-valkey-1 Removing
Container mtusi2026lab3-grade3-20261105-postgres-1 Stopped
Container mtusi2026lab3-grade3-20261105-postgres-1 Removing
Container mtusi2026lab3-grade3-20261105-valkey-1 Removed
Container mtusi2026lab3-grade3-20261105-postgres-1 Removed
Network mtusi2026lab3-grade3-20261105_edge Removing
Network mtusi2026lab3-grade3-20261105_backend Removing
Network mtusi2026lab3-grade3-20261105_edge Removed
Network mtusi2026lab3-grade3-20261105_backend Removed
exit_code: 0 elapsed_seconds: 3.336
+27
View File
@@ -0,0 +1,27 @@
date: 2026-11-05T18:57:54.159450+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make lb-check
python3 scripts/probe.py check --rounds 20 --out evidence/lb-check.json
{
"instances_one_token": {
"1b4a73f61b07": 20,
"8ffe0c70f4ea": 20
},
"same_key": {
"rounds": 20,
"parallel": 8,
"statuses": {
"201": 160
},
"instances": {
"8ffe0c70f4ea": 80,
"1b4a73f61b07": 80
},
"identical_bodies_rounds": 20,
"single_copy_rounds": 20,
"conflict_rounds": 20
},
"pass": true
}
exit_code: 0 elapsed_seconds: 0.648
+25
View File
@@ -0,0 +1,25 @@
date: 2026-11-05T18:58:38.021999+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make persistence-evidence
sh scripts/persistence-evidence.sh "http://127.0.0.1:18083" > evidence/persistence.txt
cat evidence/persistence.txt
date: 2026-11-05T18:58:38Z commit: 0a1f48b
== before: service hostname StartedAt status
api 1b4a73f61b07 2026-11-05T18:58:36.142839135Z running
api 8ffe0c70f4ea 2026-11-05T18:58:18.239416584Z running
lb 936b69811632 2026-11-05T18:56:03.008030758Z running
migrate c73a6ab4f829 2026-11-05T18:56:03.5137618Z exited
postgres 097df27ee36a 2026-11-05T18:56:02.802565633Z running
valkey ac9a3cf7b7a0 2026-11-05T18:56:02.774072466Z running
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18083"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
== after: service hostname StartedAt status
api 1b4a73f61b07 2026-11-05T18:58:43.578633972Z running
api 8ffe0c70f4ea 2026-11-05T18:58:43.512173305Z running
lb 936b69811632 2026-11-05T18:58:41.899974554Z running
migrate c73a6ab4f829 2026-11-05T18:58:42.423420221Z exited
postgres 097df27ee36a 2026-11-05T18:58:41.642264971Z running
valkey ac9a3cf7b7a0 2026-11-05T18:58:41.694216387Z running
exit_code: 0 elapsed_seconds: 9.441
+13
View File
@@ -0,0 +1,13 @@
date: 2026-11-05T18:58:18.083291+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make restore
scripts/restore.sh
Container mtusi2026lab3-grade3-final-20261105-api-2 Running
Container mtusi2026lab3-grade3-final-20261105-api-1 Starting
Container mtusi2026lab3-grade3-final-20261105-api-1 Started
Container mtusi2026lab3-grade3-final-20261105-api-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-api-2 Waiting
Container mtusi2026lab3-grade3-final-20261105-api-1 Healthy
Container mtusi2026lab3-grade3-final-20261105-api-2 Healthy
exit_code: 0 elapsed_seconds: 2.015
+13
View File
@@ -0,0 +1,13 @@
date: 2026-11-05T18:58:35.973739+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make restore
scripts/restore.sh
Container mtusi2026lab3-grade3-final-20261105-api-1 Running
Container mtusi2026lab3-grade3-final-20261105-api-2 Starting
Container mtusi2026lab3-grade3-final-20261105-api-2 Started
Container mtusi2026lab3-grade3-final-20261105-api-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-api-2 Waiting
Container mtusi2026lab3-grade3-final-20261105-api-1 Healthy
Container mtusi2026lab3-grade3-final-20261105-api-2 Healthy
exit_code: 0 elapsed_seconds: 2.004
+53
View File
@@ -0,0 +1,53 @@
date: 2026-11-05T18:57:54.853348+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make retry-check
python3 scripts/probe.py retry --out evidence/retry.json
{
"variants": [
{
"variant": "timeout",
"lost_attempt": {
"status": 0,
"client_timeout_s": 0.5,
"chat_lock_held_s": 1.5,
"replica": "1b4a73f61b07",
"replica_killed": false,
"replica_answered": 201
},
"retry": {
"after_s": 1.539,
"status": 201,
"attempts": 1,
"replica": "8ffe0c70f4ea"
},
"copies_in_history": 1,
"same_message": true,
"written_by": "lost attempt",
"pass": true
},
{
"variant": "kill",
"lost_attempt": {
"status": 0,
"client_timeout_s": 0.5,
"chat_lock_held_s": 1.5,
"replica": "8ffe0c70f4ea",
"replica_killed": true,
"replica_answered": null
},
"retry": {
"after_s": 1.551,
"status": 201,
"attempts": 1,
"replica": "1b4a73f61b07"
},
"copies_in_history": 1,
"same_message": true,
"written_by": "lost attempt",
"pass": true
}
],
"pass": true
}
exit_code: 0 elapsed_seconds: 7.326
+72
View File
@@ -0,0 +1,72 @@
date: 2026-11-05T18:58:59.414270+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make stack-evidence
sh scripts/evidence-stack.sh
date: 2026-11-05T18:58:59Z commit: 0a1f48b
$ docker compose --env-file .env config --quiet && echo valid
valid
$ docker compose ps --format '{{.Service}} {{.Name}} {{.Status}} {{.Ports}}'
api mtusi2026lab3-grade3-final-20261105-api-1 Up 16 seconds (healthy)
api mtusi2026lab3-grade3-final-20261105-api-2 Up 16 seconds (healthy)
lb mtusi2026lab3-grade3-final-20261105-lb-1 Up 17 seconds (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
postgres mtusi2026lab3-grade3-final-20261105-postgres-1 Up 18 seconds (healthy)
valkey mtusi2026lab3-grade3-final-20261105-valkey-1 Up 18 seconds (healthy)
$ docker compose config | grep -c container_name
0
$ docker port <каждая реплика api> # реплики не публикуют порт
8ffe0c70f4ea: []
1b4a73f61b07: []
$ docker inspect: hostname = X-Instance-Id, сети, лимиты CPU (nano) и памяти
api 1b4a73f61b07 /mtusi2026lab3-grade3-final-20261105-api-2 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
api 8ffe0c70f4ea /mtusi2026lab3-grade3-final-20261105-api-1 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
lb 936b69811632 /mtusi2026lab3-grade3-final-20261105-lb-1 nets=mtusi2026lab3-grade3-final-20261105_backend,mtusi2026lab3-grade3-final-20261105_edge, cpus=1000000000 mem=134217728 user=haproxy ro=true
postgres 097df27ee36a /mtusi2026lab3-grade3-final-20261105-postgres-1 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=2000000000 mem=1073741824 user=70:70 ro=false
valkey ac9a3cf7b7a0 /mtusi2026lab3-grade3-final-20261105-valkey-1 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=500000000 mem=134217728 user=999:1000 ro=false
$ curl LB stats: backend api, server status check
api1 UP L7OK 200
api2 UP L7OK 200
BACKEND UP
$ for i in 1..6: curl -D - http://127.0.0.1:18083/health/live | X-Instance-Id
x-instance-id: 1b4a73f61b07
x-instance-id: 8ffe0c70f4ea
x-instance-id: 1b4a73f61b07
x-instance-id: 8ffe0c70f4ea
x-instance-id: 1b4a73f61b07
x-instance-id: 8ffe0c70f4ea
date: 2026-11-05T18:59:00Z commit: 0a1f48b
host: Apple M4 Max, 16 CPU, 48 GiB RAM, macOS 15.1
docker: 28.3.2, VM: 16 CPU, 8217190400 bytes
compose: 2.38.2-desktop.1
images:
image: ${API_IMAGE:-mtusi-messenger:${COMPOSE_PROJECT_NAME}}
image: haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b
image: postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b
image: valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a
image: grafana/k6:2.3.0@sha256:2dd4756ec6e14e62778916e1eb850108e4b499304c02df56760fa0bdb0fba0b8
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS builder
COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS runtime
python in image: Python 3.14.7
haproxy: HAProxy version 3.2.26-3e0f11a 2026/10/14 - https://haproxy.org/
packages (uv.lock):
fastapi 0.141.1
uvicorn 0.54.0
uvicorn-worker 0.4.0
gunicorn 26.2.0
sqlalchemy 2.0.45
alembic 1.16.5
asyncpg 0.32.0
argon2-cffi 25.1.0
pydantic 2.13.5
pydantic-settings 2.15.0
dishka 1.10.1
structlog 26.1.0
redis 8.1.0
process users (service uid command):
api 10001 python
lb 99 haproxy
postgres 70 postgres
valkey 999 tini
valkey 999 valkey-server
exit_code: 0 elapsed_seconds: 2.112
+155
View File
@@ -0,0 +1,155 @@
date: 2026-11-05T18:55:27.662096+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ sh -c 'docker volume ls --filter label=com.docker.compose.project="$COMPOSE_PROJECT_NAME"; docker compose config --quiet && make up && docker compose ps -a && docker compose exec -T postgres psql -U messenger -d messenger -c "SELECT version_num FROM alembic_version"'
DRIVER VOLUME NAME
sh scripts/secrets.sh
docker compose up -d --build --wait
#1 [internal] load local bake definitions
#1 reading from stdin 454B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.65kB done
#2 DONE 0.0s
#3 [internal] load metadata for ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
#3 DONE 0.0s
#4 [internal] load metadata for docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
#4 DONE 1.7s
#5 [internal] load .dockerignore
#5 transferring context: 437B done
#5 DONE 0.0s
#6 FROM ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
#6 resolve ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 0.0s done
#6 DONE 0.0s
#7 [internal] load build context
#7 transferring context: 29.64kB done
#7 DONE 0.0s
#8 [builder 1/7] FROM docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
#8 resolve docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d 0.0s done
#8 DONE 0.0s
#9 [builder 4/7] COPY pyproject.toml uv.lock README.md ./
#9 CACHED
#10 [builder 2/7] COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
#10 CACHED
#11 [builder 3/7] WORKDIR /build
#11 CACHED
#12 [builder 5/7] RUN uv sync --locked --no-dev --no-install-project --no-editable
#12 CACHED
#13 [builder 6/7] COPY src ./src
#13 DONE 0.0s
#14 [builder 7/7] RUN uv sync --locked --no-dev --no-editable
#14 0.139 Resolved 64 packages in 0.40ms
#14 0.140 Building mtusi-messenger @ file:///build
#14 1.569 Built mtusi-messenger @ file:///build
#14 1.572 Prepared 1 package in 1.43s
#14 1.576 Installed 1 package in 4ms
#14 1.653 Bytecode compiled 1275 files in 76ms
#14 1.653 + mtusi-messenger==1.3.0 (from file:///build)
#14 DONE 1.7s
#15 [runtime 2/6] RUN groupadd --system --gid 10001 messenger && useradd --system --uid 10001 --gid messenger --no-create-home --shell /usr/sbin/nologin messenger
#15 CACHED
#16 [runtime 3/6] COPY --from=builder --chown=root:root /opt/venv /opt/venv
#16 DONE 0.2s
#17 [runtime 4/6] WORKDIR /app
#17 DONE 0.0s
#18 [runtime 5/6] COPY --chown=root:root alembic.ini ./
#18 DONE 0.0s
#19 [runtime 6/6] COPY --chown=root:root alembic ./alembic
#19 DONE 0.0s
#20 exporting to image
#20 exporting layers
#20 exporting layers 1.8s done
#20 exporting manifest sha256:5038ad65552ef8a56c20f7f9f042205fa4f08bed2182f7d170da334d08a3bd61
#20 exporting manifest sha256:5038ad65552ef8a56c20f7f9f042205fa4f08bed2182f7d170da334d08a3bd61 done
#20 exporting config sha256:de74256583c9ad3781e5456b23c7688aa2ee86733f0d16bcd296b9112aee8335 done
#20 exporting attestation manifest sha256:206b908d058f5f2d5d194ed07ef9ab77cc18e8bcc9445e252eb82c397e4e5c81 done
#20 exporting manifest list sha256:59081a6760b0d025ed7c613a68f6f939f3223f3ad2c6e8a9952ded4551c932ee done
#20 naming to docker.io/library/mtusi-messenger:mtusi2026lab3-grade3-final-20261105 done
#20 unpacking to docker.io/library/mtusi-messenger:mtusi2026lab3-grade3-final-20261105
#20 unpacking to docker.io/library/mtusi-messenger:mtusi2026lab3-grade3-final-20261105 0.3s done
#20 DONE 2.1s
#21 resolving provenance for metadata file
#21 DONE 0.0s
api Built
Network mtusi2026lab3-grade3-final-20261105_backend Creating
Network mtusi2026lab3-grade3-final-20261105_backend Created
Network mtusi2026lab3-grade3-final-20261105_edge Creating
Network mtusi2026lab3-grade3-final-20261105_edge Created
Volume "mtusi2026lab3-grade3-final-20261105_valkeydata" Creating
Volume "mtusi2026lab3-grade3-final-20261105_valkeydata" Created
Volume "mtusi2026lab3-grade3-final-20261105_pgdata" Creating
Volume "mtusi2026lab3-grade3-final-20261105_pgdata" Created
Container mtusi2026lab3-grade3-final-20261105-lb-1 Creating
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Creating
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Creating
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Created
Container mtusi2026lab3-grade3-final-20261105-lb-1 Created
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Created
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Creating
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Created
Container mtusi2026lab3-grade3-final-20261105-api-2 Creating
Container mtusi2026lab3-grade3-final-20261105-api-1 Creating
Container mtusi2026lab3-grade3-final-20261105-api-2 Created
Container mtusi2026lab3-grade3-final-20261105-api-1 Created
Container mtusi2026lab3-grade3-final-20261105-lb-1 Starting
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Starting
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Starting
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Started
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Started
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-lb-1 Started
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Healthy
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Starting
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Started
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Exited
Container mtusi2026lab3-grade3-final-20261105-api-1 Starting
Container mtusi2026lab3-grade3-final-20261105-api-1 Started
Container mtusi2026lab3-grade3-final-20261105-api-2 Starting
Container mtusi2026lab3-grade3-final-20261105-api-2 Started
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-lb-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-api-1 Waiting
Container mtusi2026lab3-grade3-final-20261105-api-2 Waiting
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Exited
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Healthy
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Healthy
Container mtusi2026lab3-grade3-final-20261105-api-1 Healthy
Container mtusi2026lab3-grade3-final-20261105-api-2 Healthy
Container mtusi2026lab3-grade3-final-20261105-lb-1 Healthy
scripts/lb-wait.sh
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-grade3-final-20261105-api-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 6 seconds ago Up 3 seconds (healthy)
mtusi2026lab3-grade3-final-20261105-api-2 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "python -m gunicorn …" api 6 seconds ago Up 3 seconds (healthy)
mtusi2026lab3-grade3-final-20261105-lb-1 haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b "docker-entrypoint.s…" lb 6 seconds ago Up 6 seconds (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
mtusi2026lab3-grade3-final-20261105-migrate-1 mtusi-messenger:mtusi2026lab3-grade3-final-20261105 "alembic upgrade head" migrate 6 seconds ago Exited (0) 4 seconds ago
mtusi2026lab3-grade3-final-20261105-postgres-1 postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b "docker-entrypoint.s…" postgres 6 seconds ago Up 6 seconds (healthy)
mtusi2026lab3-grade3-final-20261105-valkey-1 valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a "tini -- docker-entr…" valkey 6 seconds ago Up 6 seconds (healthy)
version_num
-----------------------
0002_idempotency_keys
(1 row)
exit_code: 0 elapsed_seconds: 13.244
+41
View File
@@ -0,0 +1,41 @@
date: 2026-11-05T18:59:05.166340+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ sh -c 'make down && docker compose ps -a && docker volume ls --filter label=com.docker.compose.project="$COMPOSE_PROJECT_NAME" && docker volume ls --filter label=com.docker.compose.project=mtusi2026lab3-grade3-20261105'
docker compose --profile bench down
Container mtusi2026lab3-grade3-final-20261105-api-2 Stopping
Container mtusi2026lab3-grade3-final-20261105-api-1 Stopping
Container mtusi2026lab3-grade3-final-20261105-lb-1 Stopping
Container mtusi2026lab3-grade3-final-20261105-lb-1 Stopped
Container mtusi2026lab3-grade3-final-20261105-lb-1 Removing
Container mtusi2026lab3-grade3-final-20261105-lb-1 Removed
Container mtusi2026lab3-grade3-final-20261105-api-2 Stopped
Container mtusi2026lab3-grade3-final-20261105-api-2 Removing
Container mtusi2026lab3-grade3-final-20261105-api-1 Stopped
Container mtusi2026lab3-grade3-final-20261105-api-1 Removing
Container mtusi2026lab3-grade3-final-20261105-api-2 Removed
Container mtusi2026lab3-grade3-final-20261105-api-1 Removed
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Stopping
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Stopping
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Stopped
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Removing
Container mtusi2026lab3-grade3-final-20261105-migrate-1 Removed
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Stopping
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Stopped
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Removing
Container mtusi2026lab3-grade3-final-20261105-postgres-1 Removed
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Stopped
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Removing
Container mtusi2026lab3-grade3-final-20261105-valkey-1 Removed
Network mtusi2026lab3-grade3-final-20261105_edge Removing
Network mtusi2026lab3-grade3-final-20261105_backend Removing
Network mtusi2026lab3-grade3-final-20261105_edge Removed
Network mtusi2026lab3-grade3-final-20261105_backend Removed
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
DRIVER VOLUME NAME
local mtusi2026lab3-grade3-final-20261105_pgdata
local mtusi2026lab3-grade3-final-20261105_valkeydata
DRIVER VOLUME NAME
local mtusi2026lab3-grade3-20261105_pgdata
local mtusi2026lab3-grade3-20261105_valkeydata
exit_code: 0 elapsed_seconds: 3.351
+7
View File
@@ -0,0 +1,7 @@
date: 2026-11-05T18:59:01.562450+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make storage-evidence
sh scripts/evidence-storage.sh
evidence/{schema,migrations,kdf,secrets}.txt обновлены
exit_code: 0 elapsed_seconds: 3.569
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
date: 2026-11-05T19:06:00.788460+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ git diff --check
evidence/migrations.txt:3: trailing whitespace.
+ users | sessions | chats | members | messages | keys | versions
evidence/migrations.txt:10: trailing whitespace.
+ users | sessions | chats | members | messages | keys | versions
evidence/schema.txt:120: trailing whitespace.
+ Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
evidence/schema.txt:122: trailing whitespace.
+ version_num | character varying(32) | | not null | | extended | | |
evidence/schema.txt:128: trailing whitespace.
+ version_num
evidence/stack.txt:5: trailing whitespace.
+api mtusi2026lab3-grade3-final-20261105-api-1 Up 16 seconds (healthy)
evidence/stack.txt:6: trailing whitespace.
+api mtusi2026lab3-grade3-final-20261105-api-2 Up 16 seconds (healthy)
evidence/stack.txt:8: trailing whitespace.
+postgres mtusi2026lab3-grade3-final-20261105-postgres-1 Up 18 seconds (healthy)
evidence/stack.txt:9: trailing whitespace.
+valkey mtusi2026lab3-grade3-final-20261105-valkey-1 Up 18 seconds (healthy)
exit_code: 2 elapsed_seconds: 0.017
+5 -5
View File
@@ -1,13 +1,13 @@
date: 2026-10-30T02:54:58Z commit: e049c26
date: 2026-11-05T18:59:04Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
$ psql -c "SELECT substring(password_hash from '^[$]argon2id[$]v=[0-9]+[$]m=[0-9]+,t=[0-9]+,p=[0-9]+[$]') AS kdf_prefix, username = 'seed_author' AS seed_stub, count(*) AS users, min(length(password_hash)) AS min_length, max(length(password_hash)) AS max_length FROM users GROUP BY 1, 2 ORDER BY 2"
kdf_prefix | seed_stub | users | min_length | max_length
kdf_prefix | seed_stub | users | min_length | max_length
---------------------------------+-----------+-------+------------+------------
$argon2id$v=19$m=19456,t=2,p=1$ | f | 120 | 97 | 97
$argon2id$v=19$m=19456,t=2,p=1$ | f | 70 | 97 | 97
(1 row)
$ psql -c "SELECT octet_length(token_hash) AS stored_bytes, count(*) AS sessions FROM sessions GROUP BY 1"
stored_bytes | sessions
stored_bytes | sessions
--------------+----------
32 | 114
32 | 24
(1 row)
+4 -4
View File
@@ -1,7 +1,7 @@
{
"instances_one_token": {
"fe75c6c37e5a": 20,
"ff81f93e8b0d": 20
"1b4a73f61b07": 20,
"8ffe0c70f4ea": 20
},
"same_key": {
"rounds": 20,
@@ -10,8 +10,8 @@
"201": 160
},
"instances": {
"ff81f93e8b0d": 80,
"fe75c6c37e5a": 80
"8ffe0c70f4ea": 80,
"1b4a73f61b07": 80
},
"identical_bodies_rounds": 20,
"single_copy_rounds": 20,
+9 -10
View File
@@ -1,15 +1,14 @@
date: 2026-10-30T02:54:56Z commit: e049c26
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM idempotency_keys) keys, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | keys | versions
-------+----------+-------+---------+----------+-------+----------
120 | 114 | 51 | 102 | 30748 | 30748 | 2
date: 2026-11-05T18:59:02Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM idempotency_keys) keys, (SELECT count(*) FROM alembic_version) versions"
users | sessions | chats | members | messages | keys | versions
-------+----------+-------+---------+----------+------+----------
70 | 24 | 6 | 12 | 284 | 284 | 1
(1 row)
$ make migrate
{"reason":"up to date","event":"migration.completed","level":"info","ts":"2026-10-30T02:54:58.470450Z"}
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM idempotency_keys) keys, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | keys | versions
-------+----------+-------+---------+----------+-------+----------
120 | 114 | 51 | 102 | 30748 | 30748 | 2
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM idempotency_keys) keys, (SELECT count(*) FROM alembic_version) versions"
users | sessions | chats | members | messages | keys | versions
-------+----------+-------+---------+----------+------+----------
70 | 24 | 6 | 12 | 284 | 284 | 1
(1 row)
+14 -14
View File
@@ -1,18 +1,18 @@
date: 2026-10-30T02:45:46Z commit: e049c26
date: 2026-11-05T18:58:38Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
== before: service hostname StartedAt status
api fe75c6c37e5a 2026-10-30T02:45:42.870380597Z running
api ff81f93e8b0d 2026-10-30T02:45:24.812924046Z running
lb 35712870f3c4 2026-10-30T02:44:54.845670713Z running
migrate a384e9cbafb2 2026-10-30T02:44:55.92784763Z exited
postgres cd7b0d78bc19 2026-10-30T02:44:54.84929213Z running
valkey c9501d6e445a 2026-10-30T02:44:54.848454921Z running
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18083"
api 1b4a73f61b07 2026-11-05T18:58:36.142839135Z running
api 8ffe0c70f4ea 2026-11-05T18:58:18.239416584Z running
lb 936b69811632 2026-11-05T18:56:03.008030758Z running
migrate c73a6ab4f829 2026-11-05T18:56:03.5137618Z exited
postgres 097df27ee36a 2026-11-05T18:56:02.802565633Z running
valkey ac9a3cf7b7a0 2026-11-05T18:56:02.774072466Z running
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18083"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
== after: service hostname StartedAt status
api fe75c6c37e5a 2026-10-30T02:45:51.665472503Z running
api ff81f93e8b0d 2026-10-30T02:45:51.605189211Z running
lb 35712870f3c4 2026-10-30T02:45:50.031474752Z running
migrate a384e9cbafb2 2026-10-30T02:45:50.534128753Z exited
postgres cd7b0d78bc19 2026-10-30T02:45:49.755618211Z running
valkey c9501d6e445a 2026-10-30T02:45:49.792453169Z running
api 1b4a73f61b07 2026-11-05T18:58:43.578633972Z running
api 8ffe0c70f4ea 2026-11-05T18:58:43.512173305Z running
lb 936b69811632 2026-11-05T18:58:41.899974554Z running
migrate c73a6ab4f829 2026-11-05T18:58:42.423420221Z exited
postgres 097df27ee36a 2026-11-05T18:58:41.642264971Z running
valkey ac9a3cf7b7a0 2026-11-05T18:58:41.694216387Z running
+6 -6
View File
@@ -6,15 +6,15 @@
"status": 0,
"client_timeout_s": 0.5,
"chat_lock_held_s": 1.5,
"replica": "fe75c6c37e5a",
"replica": "1b4a73f61b07",
"replica_killed": false,
"replica_answered": 201
},
"retry": {
"after_s": 1.522,
"after_s": 1.539,
"status": 201,
"attempts": 1,
"replica": "ff81f93e8b0d"
"replica": "8ffe0c70f4ea"
},
"copies_in_history": 1,
"same_message": true,
@@ -27,15 +27,15 @@
"status": 0,
"client_timeout_s": 0.5,
"chat_lock_held_s": 1.5,
"replica": "ff81f93e8b0d",
"replica": "8ffe0c70f4ea",
"replica_killed": true,
"replica_answered": null
},
"retry": {
"after_s": 1.518,
"after_s": 1.551,
"status": 201,
"attempts": 1,
"replica": "fe75c6c37e5a"
"replica": "1b4a73f61b07"
},
"copies_in_history": 1,
"same_message": true,
+46 -49
View File
@@ -1,13 +1,13 @@
date: 2026-10-30T02:54:55Z commit: e049c26
date: 2026-11-05T18:59:01Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
$ psql -c '\d+ users'
Table "public.users"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
---------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
username | text | | not null | | extended | | |
display_name | text | | not null | | extended | | |
password_hash | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
id | uuid | | not null | | plain | | |
username | text | | not null | | extended | | |
display_name | text | | not null | | extended | | |
password_hash | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"users_pkey" PRIMARY KEY, btree (id)
"users_username_key" UNIQUE CONSTRAINT, btree (username)
@@ -22,12 +22,12 @@ Access method: heap
$ psql -c '\d+ sessions'
Table "public.sessions"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
token_hash | bytea | | not null | | extended | | |
user_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
expires_at | timestamp with time zone | | not null | | plain | | |
token_hash | bytea | | not null | | extended | | |
user_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
expires_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"sessions_pkey" PRIMARY KEY, btree (token_hash)
"sessions_user_idx" btree (user_id)
@@ -40,12 +40,12 @@ Access method: heap
$ psql -c '\d+ chats'
Table "public.chats"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
title | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
last_message_at | timestamp with time zone | | | | plain | | |
id | uuid | | not null | | plain | | |
title | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
last_message_at | timestamp with time zone | | | | plain | | |
Indexes:
"chats_pkey" PRIMARY KEY, btree (id)
Check constraints:
@@ -56,12 +56,12 @@ Access method: heap
$ psql -c '\d+ chat_members'
Table "public.chat_members"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------+--------------------------+-----------+----------+---------+---------+-------------+--------------+-------------
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
position | smallint | | not null | | plain | | |
chat_created_at | timestamp with time zone | | not null | | plain | | |
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
position | smallint | | not null | | plain | | |
chat_created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"chat_members_pkey" PRIMARY KEY, btree (chat_id, user_id)
"chat_members_user_idx" btree (user_id, chat_created_at, chat_id)
@@ -77,13 +77,13 @@ Access method: heap
$ psql -c '\d+ messages'
Table "public.messages"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
chat_id | uuid | | not null | | plain | | |
sender_id | uuid | | not null | | plain | | |
text | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
id | uuid | | not null | | plain | | |
chat_id | uuid | | not null | | plain | | |
sender_id | uuid | | not null | | plain | | |
text | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"messages_pkey" PRIMARY KEY, btree (id)
"messages_history_idx" btree (chat_id, created_at, id)
@@ -97,14 +97,14 @@ Access method: heap
$ psql -c '\d+ idempotency_keys'
Table "public.idempotency_keys"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
key | text | | not null | | extended | | |
fingerprint | bytea | | not null | | extended | | |
message_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
key | text | | not null | | extended | | |
fingerprint | bytea | | not null | | extended | | |
message_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"idempotency_keys_pkey" PRIMARY KEY, btree (chat_id, user_id, key)
Check constraints:
@@ -115,21 +115,18 @@ Foreign-key constraints:
"idempotency_keys_message_id_fkey" FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ schema_migrations'
Table "public.schema_migrations"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
version | text | | not null | | extended | | |
checksum | text | | not null | | extended | | |
applied_at | timestamp with time zone | | not null | now() | plain | | |
$ psql -c '\d+ alembic_version'
Table "public.alembic_version"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-------------+-----------------------+-----------+----------+---------+----------+-------------+--------------+-------------
version_num | character varying(32) | | not null | | extended | | |
Indexes:
"schema_migrations_pkey" PRIMARY KEY, btree (version)
"alembic_version_pkc" PRIMARY KEY, btree (version_num)
Access method: heap
$ psql -c 'SELECT version, left(checksum, 12), applied_at FROM schema_migrations'
version | checksum | applied_at
-----------------------+--------------+-------------------------------
0001_init | 9a13618f078a | 2026-10-30 02:44:56.558169+00
0002_idempotency_keys | d9159a355532 | 2026-10-30 02:44:56.565046+00
(2 rows)
$ psql -c 'SELECT version_num FROM alembic_version'
version_num
-----------------------
0002_idempotency_keys
(1 row)
+4 -4
View File
@@ -1,4 +1,4 @@
date: 2026-10-30T02:54:59Z commit: e049c26
date: 2026-11-05T18:59:04Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
$ git ls-files secrets .env backups volumes
(пусто: секретов, .env, дампов и volumes в Git нет)
$ git check-ignore -v secrets/database_url secrets/postgres_password .env backups/
@@ -6,7 +6,7 @@ $ git check-ignore -v secrets/database_url secrets/postgres_password .env backup
.gitignore:5:secrets/ secrets/postgres_password
.gitignore:2:.env .env
.gitignore:15:backups/ backups/
$ docker volume ls --filter label=com.docker.compose.project=mtusi2026lab3
$ docker volume ls --filter label=com.docker.compose.project=mtusi2026lab3-grade3-final-20261105
DRIVER VOLUME NAME
local mtusi2026lab3_pgdata
local mtusi2026lab3_valkeydata
local mtusi2026lab3-grade3-final-20261105_pgdata
local mtusi2026lab3-grade3-final-20261105_valkeydata
+6 -4
View File
@@ -1,5 +1,7 @@
date: 2026-10-30T02:45:01Z commit: e049c26
$ make test # BASE_URL=http://127.0.0.1:18083 — порт lb из docker compose port
python3 tests/smoke.py --base-url "http://127.0.0.1:18083"
date: 2026-11-05T18:57:53.639190+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make test
python3 tests/smoke.py --base-url "http://127.0.0.1:18083"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
exit=0
exit_code: 0 elapsed_seconds: 0.471
+20 -20
View File
@@ -1,31 +1,31 @@
date: 2026-10-30T02:45:01Z commit: e049c26
date: 2026-11-05T18:58:59Z commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
$ docker compose --env-file .env config --quiet && echo valid
valid
$ docker compose ps --format '{{.Service}} {{.Name}} {{.Status}} {{.Ports}}'
api mtusi2026lab3-api-1 Up 4 seconds (healthy)
api mtusi2026lab3-api-2 Up 4 seconds (healthy)
lb mtusi2026lab3-lb-1 Up 7 seconds (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
postgres mtusi2026lab3-postgres-1 Up 7 seconds (healthy)
valkey mtusi2026lab3-valkey-1 Up 7 seconds (healthy)
api mtusi2026lab3-grade3-final-20261105-api-1 Up 16 seconds (healthy)
api mtusi2026lab3-grade3-final-20261105-api-2 Up 16 seconds (healthy)
lb mtusi2026lab3-grade3-final-20261105-lb-1 Up 17 seconds (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
postgres mtusi2026lab3-grade3-final-20261105-postgres-1 Up 18 seconds (healthy)
valkey mtusi2026lab3-grade3-final-20261105-valkey-1 Up 18 seconds (healthy)
$ docker compose config | grep -c container_name
0
$ docker port <каждая реплика api> # реплики не публикуют порт
ff81f93e8b0d: []
fe75c6c37e5a: []
8ffe0c70f4ea: []
1b4a73f61b07: []
$ docker inspect: hostname = X-Instance-Id, сети, лимиты CPU (nano) и памяти
api fe75c6c37e5a /mtusi2026lab3-api-2 nets=mtusi2026lab3_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
api ff81f93e8b0d /mtusi2026lab3-api-1 nets=mtusi2026lab3_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
lb 35712870f3c4 /mtusi2026lab3-lb-1 nets=mtusi2026lab3_backend,mtusi2026lab3_edge, cpus=1000000000 mem=134217728 user=haproxy ro=true
postgres cd7b0d78bc19 /mtusi2026lab3-postgres-1 nets=mtusi2026lab3_backend, cpus=2000000000 mem=1073741824 user=70:70 ro=false
valkey c9501d6e445a /mtusi2026lab3-valkey-1 nets=mtusi2026lab3_backend, cpus=500000000 mem=134217728 user=999:1000 ro=false
api 1b4a73f61b07 /mtusi2026lab3-grade3-final-20261105-api-2 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
api 8ffe0c70f4ea /mtusi2026lab3-grade3-final-20261105-api-1 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
lb 936b69811632 /mtusi2026lab3-grade3-final-20261105-lb-1 nets=mtusi2026lab3-grade3-final-20261105_backend,mtusi2026lab3-grade3-final-20261105_edge, cpus=1000000000 mem=134217728 user=haproxy ro=true
postgres 097df27ee36a /mtusi2026lab3-grade3-final-20261105-postgres-1 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=2000000000 mem=1073741824 user=70:70 ro=false
valkey ac9a3cf7b7a0 /mtusi2026lab3-grade3-final-20261105-valkey-1 nets=mtusi2026lab3-grade3-final-20261105_backend, cpus=500000000 mem=134217728 user=999:1000 ro=false
$ curl LB stats: backend api, server status check
api1 UP L7OK 200
api2 UP L7OK 200
BACKEND UP
BACKEND UP
$ for i in 1..6: curl -D - http://127.0.0.1:18083/health/live | X-Instance-Id
x-instance-id: fe75c6c37e5a
x-instance-id: ff81f93e8b0d
x-instance-id: fe75c6c37e5a
x-instance-id: ff81f93e8b0d
x-instance-id: fe75c6c37e5a
x-instance-id: ff81f93e8b0d
x-instance-id: 1b4a73f61b07
x-instance-id: 8ffe0c70f4ea
x-instance-id: 1b4a73f61b07
x-instance-id: 8ffe0c70f4ea
x-instance-id: 1b4a73f61b07
x-instance-id: 8ffe0c70f4ea
+248 -227
View File
@@ -1,6 +1,7 @@
date: 2026-10-30T02:44:17Z commit: e049c26
$ PYTEST_ADDOPTS=-vv make student-test # все собственные тесты без маркера stack (одноразовые PostgreSQL и Valkey в Docker), по именам
.venv/bin/pytest
date: 2026-11-05T18:55:39.665597+00:00 commit: 0a1f48bd73e5780c732356880c23fdb476bcff98
environment: COMPOSE_PROJECT_NAME=mtusi2026lab3-grade3-final-20261105 LB_HTTP_PORT=18083 LB_STATS_PORT=23083 API_REPLICAS=2 NO_PROXY=localhost,127.0.0.1,::1
$ make student-test PYTEST_ARGS=-vv
.venv/bin/pytest -vv
============================= test session starts ==============================
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0 -- <repo>/.venv/bin/python
cachedir: .pytest_cache
@@ -9,260 +10,280 @@ configfile: pyproject.toml
testpaths: student-tests
plugins: asyncio-1.4.0, anyio-4.15.1
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collecting ... collected 255 items / 12 deselected / 243 selected
collecting ... collected 283 items / 12 deselected / 271 selected
student-tests/api/test_access.py::test_outsider_gets_404_on_chat PASSED [ 0%]
student-tests/api/test_access.py::test_unknown_chat_is_indistinguishable_from_foreign PASSED [ 0%]
student-tests/api/test_access.py::test_outsider_cannot_write PASSED [ 1%]
student-tests/api/test_access.py::test_outsider_cannot_read_history PASSED [ 1%]
student-tests/api/test_access.py::test_access_checked_before_body PASSED [ 2%]
student-tests/api/test_access.py::test_access_checked_before_body PASSED [ 1%]
student-tests/api/test_access.py::test_chat_list_hides_foreign_chats PASSED [ 2%]
student-tests/api/test_access.py::test_403_is_never_used PASSED [ 2%]
student-tests/api/test_access.py::test_request_shape_is_checked_before_access PASSED [ 3%]
student-tests/api/test_access.py::test_request_shape_is_checked_before_access PASSED [ 2%]
student-tests/api/test_access.py::test_outsider_does_not_wait_for_members_lock PASSED [ 3%]
student-tests/api/test_bounded_contexts.py::test_identity_does_not_know_about_messaging PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_identity_does_not_know_about_messaging PASSED [ 3%]
student-tests/api/test_bounded_contexts.py::test_domains_do_not_import_infrastructure PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_core_layers_do_not_import_pydantic PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_shared_knows_nothing_about_zones PASSED [ 5%]
student-tests/api/test_bounded_contexts.py::test_shared_knows_nothing_about_zones PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_shared_core_is_free_of_transport PASSED [ 5%]
student-tests/api/test_bounded_contexts.py::test_shared_core_holds_only_platform PASSED [ 6%]
student-tests/api/test_bounded_contexts.py::test_shared_entrypoints_hold_only_transport PASSED [ 6%]
student-tests/api/test_bounded_contexts.py::test_shared_core_holds_only_platform PASSED [ 5%]
student-tests/api/test_bounded_contexts.py::test_shared_entrypoints_hold_only_transport PASSED [ 5%]
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_errors_events_and_commands PASSED [ 6%]
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_http_layer PASSED [ 7%]
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_http_layer PASSED [ 6%]
student-tests/api/test_bounded_contexts.py::test_only_main_knows_both_zones PASSED [ 7%]
student-tests/api/test_bounded_contexts.py::test_application_has_no_separate_entrypoints_root PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_shared_source_mentions_no_domain_vocabulary PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_shared_declares_no_concrete_commands_or_events PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_shared_has_no_test_doubles PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_zone_errors_do_not_leak_transport_codes PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_sql_of_each_zone_reads_only_its_tables PASSED [ 10%]
student-tests/api/test_bounded_contexts.py::test_messaging_does_not_import_identity_at_all PASSED [ 10%]
student-tests/api/test_cache.py::test_second_check_is_served_from_cache PASSED [ 11%]
student-tests/api/test_cache.py::test_logout_writes_tombstone_before_database PASSED [ 11%]
student-tests/api/test_bounded_contexts.py::test_application_has_no_separate_entrypoints_root PASSED [ 7%]
student-tests/api/test_bounded_contexts.py::test_shared_source_mentions_no_domain_vocabulary PASSED [ 7%]
student-tests/api/test_bounded_contexts.py::test_shared_declares_no_concrete_commands_or_events PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_shared_has_no_test_doubles PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_zone_errors_do_not_leak_transport_codes PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_sql_of_each_zone_reads_only_its_tables PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_messaging_does_not_import_identity_at_all PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_sqlalchemy_stays_in_infrastructure_and_asyncpg_is_only_a_driver PASSED [ 9%]
student-tests/api/test_cache.py::test_second_check_is_served_from_cache PASSED [ 10%]
student-tests/api/test_cache.py::test_logout_writes_tombstone_before_database PASSED [ 10%]
student-tests/api/test_cache.py::test_logout_rejected_by_database_changes_nothing PASSED [ 11%]
student-tests/api/test_cache.py::test_fill_racing_with_logout_does_not_revive_token PASSED [ 12%]
student-tests/api/test_cache.py::test_flushall_loses_nothing PASSED [ 12%]
student-tests/api/test_cache.py::test_unreachable_cache_is_bypassed_without_anonymous_access PASSED [ 13%]
student-tests/api/test_concurrency.py::test_hundred_messages_from_ten_clients PASSED [ 13%]
student-tests/api/test_concurrency.py::test_history_follows_the_clock_but_never_moves_back PASSED [ 13%]
student-tests/api/test_concurrency.py::test_parallel_registration_keeps_username_unique PASSED [ 14%]
student-tests/api/test_concurrency.py::test_parallel_chat_creation_is_atomic PASSED [ 14%]
student-tests/api/test_consistency.py::test_registration_is_visible_to_chats_immediately PASSED [ 15%]
student-tests/api/test_consistency.py::test_parallel_registrations_are_all_usable_as_members PASSED [ 15%]
student-tests/api/test_consistency.py::test_rejected_registration_leaves_no_trace PASSED [ 16%]
student-tests/api/test_consistency.py::test_failed_chat_creation_rolls_back_both_tables PASSED [ 16%]
student-tests/api/test_consistency.py::test_rejected_message_does_not_enter_history PASSED [ 16%]
student-tests/api/test_consistency.py::test_confirmed_write_is_visible_to_next_read PASSED [ 17%]
student-tests/api/test_consistency.py::test_parallel_writes_across_zones_keep_counts_consistent PASSED [ 17%]
student-tests/api/test_consistency.py::test_chat_membership_survives_parallel_reads_and_writes PASSED [ 18%]
student-tests/api/test_drain.py::test_draining_replica_is_not_ready_but_alive PASSED [ 18%]
student-tests/api/test_drain.py::test_sigterm_leaves_rotation_then_closes_and_cancels_stuck_requests PASSED [ 18%]
student-tests/api/test_events.py::test_event_has_no_message_text PASSED [ 19%]
student-tests/api/test_events.py::test_every_subscriber_receives_event PASSED [ 19%]
student-tests/api/test_events.py::test_failing_subscriber_does_not_block_others PASSED [ 20%]
student-tests/api/test_events.py::test_queue_overflow_drops_events_without_raising PASSED [ 20%]
student-tests/api/test_events.py::test_publication_does_not_delay_response PASSED [ 20%]
student-tests/api/test_events.py::test_null_logger_hides_everything PASSED [ 21%]
student-tests/api/test_idempotency.py::test_replay_returns_the_same_message PASSED [ 21%]
student-tests/api/test_idempotency.py::test_same_json_in_other_layout_is_a_replay PASSED [ 22%]
student-tests/api/test_idempotency.py::test_other_body_with_same_key_conflicts PASSED [ 22%]
student-tests/api/test_idempotency.py::test_missing_key_is_rejected PASSED [ 23%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[0] PASSED [ 23%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[1] PASSED [ 23%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[2] PASSED [ 24%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[3] PASSED [ 24%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[4] PASSED [ 25%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[5] PASSED [ 25%]
student-tests/api/test_idempotency.py::test_rejected_attempt_does_not_take_the_key PASSED [ 25%]
student-tests/api/test_idempotency.py::test_key_is_scoped_by_user_and_chat PASSED [ 26%]
student-tests/api/test_idempotency.py::test_replay_checks_session_and_access_again PASSED [ 26%]
student-tests/api/test_idempotency.py::test_expired_key_starts_over PASSED [ 27%]
student-tests/api/test_idempotency.py::test_concurrent_retries_through_two_replicas_store_one_message PASSED [ 27%]
student-tests/api/test_instance.py::test_every_response_names_the_replica PASSED [ 27%]
student-tests/api/test_instance.py::test_rejected_body_names_the_replica PASSED [ 28%]
student-tests/api/test_instance.py::test_unhandled_error_names_the_replica PASSED [ 28%]
student-tests/api/test_instance.py::test_replica_defaults_to_container_hostname PASSED [ 29%]
student-tests/api/test_migrations.py::test_migrations_are_ordered_and_versioned PASSED [ 29%]
student-tests/api/test_migrations.py::test_rerun_changes_nothing PASSED [ 30%]
student-tests/api/test_migrations.py::test_changed_migration_is_refused PASSED [ 30%]
student-tests/api/test_migrations.py::test_sender_must_be_member_even_bypassing_api PASSED [ 30%]
student-tests/api/test_migrations.py::test_key_needs_a_member_and_a_message PASSED [ 31%]
student-tests/api/test_negative.py::test_malformed_json PASSED [ 31%]
student-tests/api/test_negative.py::test_unexpected_field PASSED [ 32%]
student-tests/api/test_negative.py::test_wrong_types PASSED [ 32%]
student-tests/api/test_negative.py::test_invalid_registration[body0] PASSED [ 32%]
student-tests/api/test_negative.py::test_invalid_registration[body1] PASSED [ 33%]
student-tests/api/test_negative.py::test_invalid_registration[body2] PASSED [ 33%]
student-tests/api/test_negative.py::test_invalid_registration[body3] PASSED [ 34%]
student-tests/api/test_negative.py::test_invalid_registration[body4] PASSED [ 34%]
student-tests/api/test_negative.py::test_invalid_registration[body5] PASSED [ 34%]
student-tests/api/test_negative.py::test_invalid_registration[body6] PASSED [ 35%]
student-tests/api/test_negative.py::test_invalid_registration[body7] PASSED [ 35%]
student-tests/api/test_negative.py::test_invalid_registration[body8] PASSED [ 36%]
student-tests/api/test_negative.py::test_invalid_registration[body9] PASSED [ 36%]
student-tests/api/test_negative.py::test_invalid_registration[body10] PASSED [ 37%]
student-tests/api/test_negative.py::test_duplicate_username PASSED [ 37%]
student-tests/api/test_negative.py::test_missing_identity PASSED [ 37%]
student-tests/api/test_negative.py::test_invalid_bearer[] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer ] PASSED [ 39%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer not a token] PASSED [ 39%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 39%]
student-tests/api/test_negative.py::test_invalid_bearer[Token abcdef] PASSED [ 40%]
student-tests/api/test_negative.py::test_invalid_bearer[11111111-1111-4111-8111-111111111111] PASSED [ 40%]
student-tests/api/test_negative.py::test_user_id_header_alone_is_ignored PASSED [ 41%]
student-tests/api/test_negative.py::test_identity_checked_before_body PASSED [ 41%]
student-tests/api/test_negative.py::test_empty_message_rejected PASSED [ 41%]
student-tests/api/test_negative.py::test_long_message_rejected PASSED [ 42%]
student-tests/api/test_negative.py::test_sender_id_not_accepted PASSED [ 42%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body0] PASSED [ 43%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body1] PASSED [ 43%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body2] PASSED [ 44%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body3] PASSED [ 44%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body4] PASSED [ 44%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body5] PASSED [ 45%]
student-tests/api/test_negative.py::test_creator_must_be_member PASSED [ 45%]
student-tests/api/test_negative.py::test_unknown_member_rejected PASSED [ 46%]
student-tests/api/test_negative.py::test_bad_chat_id_in_path PASSED [ 46%]
student-tests/api/test_operability.py::test_health_needs_no_identity PASSED [ 46%]
student-tests/api/test_operability.py::test_every_response_carries_request_id PASSED [ 47%]
student-tests/api/test_operability.py::test_client_request_id_is_preserved PASSED [ 47%]
student-tests/api/test_operability.py::test_unknown_public_route_is_404 PASSED [ 48%]
student-tests/api/test_operability.py::test_unknown_protected_route_needs_identity PASSED [ 48%]
student-tests/api/test_operability.py::test_method_not_allowed_is_hidden PASSED [ 48%]
student-tests/api/test_operability.py::test_logs_do_not_contain_message_text PASSED [ 49%]
student-tests/api/test_operability.py::test_log_lines_are_json PASSED [ 49%]
student-tests/api/test_operability.py::test_body_limit_returns_413 PASSED [ 50%]
student-tests/api/test_operability.py::test_chunked_body_is_limited_too PASSED [ 50%]
student-tests/api/test_operability.py::test_ready_turns_unavailable_without_database PASSED [ 51%]
student-tests/api/test_operability.py::test_protected_request_is_503_not_401_without_database PASSED [ 51%]
student-tests/api/test_operability.py::test_state_survives_new_process PASSED [ 51%]
student-tests/api/test_operability.py::test_logs_do_not_contain_credentials PASSED [ 52%]
student-tests/api/test_pagination.py::test_full_walk_has_no_gaps_or_repeats PASSED [ 52%]
student-tests/api/test_pagination.py::test_limit_may_change_between_pages PASSED [ 53%]
student-tests/api/test_pagination.py::test_last_page_closes_history PASSED [ 53%]
student-tests/api/test_pagination.py::test_cursor_is_shared_between_members PASSED [ 53%]
student-tests/api/test_pagination.py::test_cursor_from_another_chat_is_rejected PASSED [ 54%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[garbage] PASSED [ 54%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[1.2.3.4] PASSED [ 55%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[%20] PASSED [ 55%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[] PASSED [ 55%]
student-tests/api/test_pagination.py::test_limit_out_of_range[0] PASSED [ 56%]
student-tests/api/test_pagination.py::test_limit_out_of_range[-1] PASSED [ 56%]
student-tests/api/test_cache.py::test_fill_racing_with_logout_does_not_revive_token PASSED [ 11%]
student-tests/api/test_cache.py::test_flushall_loses_nothing PASSED [ 11%]
student-tests/api/test_cache.py::test_unreachable_cache_is_bypassed_without_anonymous_access PASSED [ 12%]
student-tests/api/test_concurrency.py::test_hundred_messages_from_ten_clients PASSED [ 12%]
student-tests/api/test_concurrency.py::test_history_follows_the_clock_but_never_moves_back PASSED [ 12%]
student-tests/api/test_concurrency.py::test_parallel_registration_keeps_username_unique PASSED [ 13%]
student-tests/api/test_concurrency.py::test_parallel_chat_creation_is_atomic PASSED [ 13%]
student-tests/api/test_consistency.py::test_registration_is_visible_to_chats_immediately PASSED [ 14%]
student-tests/api/test_consistency.py::test_parallel_registrations_are_all_usable_as_members PASSED [ 14%]
student-tests/api/test_consistency.py::test_rejected_registration_leaves_no_trace PASSED [ 14%]
student-tests/api/test_consistency.py::test_failed_chat_creation_rolls_back_both_tables PASSED [ 15%]
student-tests/api/test_consistency.py::test_rejected_message_does_not_enter_history PASSED [ 15%]
student-tests/api/test_consistency.py::test_confirmed_write_is_visible_to_next_read PASSED [ 15%]
student-tests/api/test_consistency.py::test_parallel_writes_across_zones_keep_counts_consistent PASSED [ 16%]
student-tests/api/test_consistency.py::test_chat_membership_survives_parallel_reads_and_writes PASSED [ 16%]
student-tests/api/test_drain.py::test_draining_replica_is_not_ready_but_alive PASSED [ 16%]
student-tests/api/test_drain.py::test_sigterm_leaves_rotation_then_closes_and_cancels_stuck_requests PASSED [ 17%]
student-tests/api/test_events.py::test_event_has_no_message_text PASSED [ 17%]
student-tests/api/test_events.py::test_every_subscriber_receives_event PASSED [ 18%]
student-tests/api/test_events.py::test_failing_subscriber_does_not_block_others PASSED [ 18%]
student-tests/api/test_events.py::test_queue_overflow_drops_events_without_raising PASSED [ 18%]
student-tests/api/test_events.py::test_publication_does_not_delay_response PASSED [ 19%]
student-tests/api/test_events.py::test_null_logger_hides_everything PASSED [ 19%]
student-tests/api/test_idempotency.py::test_replay_returns_the_same_message PASSED [ 19%]
student-tests/api/test_idempotency.py::test_same_json_in_other_layout_is_a_replay PASSED [ 20%]
student-tests/api/test_idempotency.py::test_other_body_with_same_key_conflicts PASSED [ 20%]
student-tests/api/test_idempotency.py::test_missing_key_is_rejected PASSED [ 21%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[0] PASSED [ 21%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[1] PASSED [ 21%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[2] PASSED [ 22%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[3] PASSED [ 22%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[4] PASSED [ 22%]
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[5] PASSED [ 23%]
student-tests/api/test_idempotency.py::test_rejected_attempt_does_not_take_the_key PASSED [ 23%]
student-tests/api/test_idempotency.py::test_key_is_scoped_by_user_and_chat PASSED [ 23%]
student-tests/api/test_idempotency.py::test_replay_checks_session_and_access_again PASSED [ 24%]
student-tests/api/test_idempotency.py::test_expired_key_starts_over PASSED [ 24%]
student-tests/api/test_idempotency.py::test_concurrent_retries_through_two_replicas_store_one_message PASSED [ 25%]
student-tests/api/test_instance.py::test_every_response_names_the_replica PASSED [ 25%]
student-tests/api/test_instance.py::test_rejected_body_names_the_replica PASSED [ 25%]
student-tests/api/test_instance.py::test_unhandled_error_names_the_replica PASSED [ 26%]
student-tests/api/test_instance.py::test_replica_defaults_to_container_hostname PASSED [ 26%]
student-tests/api/test_migrations.py::test_migrations_are_ordered_and_versioned PASSED [ 26%]
student-tests/api/test_migrations.py::test_fresh_schema_matches_models PASSED [ 27%]
student-tests/api/test_migrations.py::test_rerun_changes_nothing PASSED [ 27%]
student-tests/api/test_migrations.py::test_legacy_upgrade_preserves_every_row[1] PASSED [ 28%]
student-tests/api/test_migrations.py::test_legacy_upgrade_preserves_every_row[2] PASSED [ 28%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[DROP INDEX messages_history_idx] PASSED [ 28%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[ALTER TABLE messages DROP CONSTRAINT messages_chat_id_sender_id_fkey] PASSED [ 29%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[ALTER TABLE users DROP CONSTRAINT users_username_format] PASSED [ 29%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[ALTER TABLE users ALTER COLUMN display_name TYPE varchar] PASSED [ 29%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[ALTER TABLE users ALTER COLUMN username TYPE text COLLATE "C"] PASSED [ 30%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[ALTER TABLE sessions SET UNLOGGED] PASSED [ 30%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[ALTER TABLE sessions ALTER COLUMN expires_at DROP NOT NULL] PASSED [ 30%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[UPDATE schema_migrations SET checksum = 'tampered' WHERE version = '0001_init'] PASSED [ 31%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[DELETE FROM schema_migrations WHERE version = '0001_init'] PASSED [ 31%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[UPDATE schema_migrations SET version = 'unknown' WHERE version = '0002_idempotency_keys'] PASSED [ 32%]
student-tests/api/test_migrations.py::test_legacy_drift_is_refused_without_stamping[DROP TABLE schema_migrations] PASSED [ 32%]
student-tests/api/test_migrations.py::test_unknown_revision_is_refused PASSED [ 32%]
student-tests/api/test_migrations.py::test_simultaneous_migration_processes_serialize[False] PASSED [ 33%]
student-tests/api/test_migrations.py::test_simultaneous_migration_processes_serialize[True] PASSED [ 33%]
student-tests/api/test_migrations.py::test_sender_must_be_member_even_bypassing_api PASSED [ 33%]
student-tests/api/test_migrations.py::test_key_needs_a_member_and_a_message PASSED [ 34%]
student-tests/api/test_migrations.py::test_failed_revision_rolls_back_ddl_and_version PASSED [ 34%]
student-tests/api/test_negative.py::test_malformed_json PASSED [ 35%]
student-tests/api/test_negative.py::test_unexpected_field PASSED [ 35%]
student-tests/api/test_negative.py::test_wrong_types PASSED [ 35%]
student-tests/api/test_negative.py::test_invalid_registration[body0] PASSED [ 36%]
student-tests/api/test_negative.py::test_invalid_registration[body1] PASSED [ 36%]
student-tests/api/test_negative.py::test_invalid_registration[body2] PASSED [ 36%]
student-tests/api/test_negative.py::test_invalid_registration[body3] PASSED [ 37%]
student-tests/api/test_negative.py::test_invalid_registration[body4] PASSED [ 37%]
student-tests/api/test_negative.py::test_invalid_registration[body5] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_registration[body6] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_registration[body7] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_registration[body8] PASSED [ 39%]
student-tests/api/test_negative.py::test_invalid_registration[body9] PASSED [ 39%]
student-tests/api/test_negative.py::test_invalid_registration[body10] PASSED [ 39%]
student-tests/api/test_negative.py::test_duplicate_username PASSED [ 40%]
student-tests/api/test_negative.py::test_missing_identity PASSED [ 40%]
student-tests/api/test_negative.py::test_invalid_bearer[] PASSED [ 40%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer] PASSED [ 41%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer ] PASSED [ 41%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer not a token] PASSED [ 42%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 42%]
student-tests/api/test_negative.py::test_invalid_bearer[Token abcdef] PASSED [ 42%]
student-tests/api/test_negative.py::test_invalid_bearer[11111111-1111-4111-8111-111111111111] PASSED [ 43%]
student-tests/api/test_negative.py::test_user_id_header_alone_is_ignored PASSED [ 43%]
student-tests/api/test_negative.py::test_identity_checked_before_body PASSED [ 43%]
student-tests/api/test_negative.py::test_empty_message_rejected PASSED [ 44%]
student-tests/api/test_negative.py::test_long_message_rejected PASSED [ 44%]
student-tests/api/test_negative.py::test_sender_id_not_accepted PASSED [ 45%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body0] PASSED [ 45%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body1] PASSED [ 45%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body2] PASSED [ 46%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body3] PASSED [ 46%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body4] PASSED [ 46%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body5] PASSED [ 47%]
student-tests/api/test_negative.py::test_creator_must_be_member PASSED [ 47%]
student-tests/api/test_negative.py::test_unknown_member_rejected PASSED [ 47%]
student-tests/api/test_negative.py::test_bad_chat_id_in_path PASSED [ 48%]
student-tests/api/test_operability.py::test_health_needs_no_identity PASSED [ 48%]
student-tests/api/test_operability.py::test_every_response_carries_request_id PASSED [ 49%]
student-tests/api/test_operability.py::test_client_request_id_is_preserved PASSED [ 49%]
student-tests/api/test_operability.py::test_unknown_public_route_is_404 PASSED [ 49%]
student-tests/api/test_operability.py::test_unknown_protected_route_needs_identity PASSED [ 50%]
student-tests/api/test_operability.py::test_method_not_allowed_is_hidden PASSED [ 50%]
student-tests/api/test_operability.py::test_logs_do_not_contain_message_text PASSED [ 50%]
student-tests/api/test_operability.py::test_log_lines_are_json PASSED [ 51%]
student-tests/api/test_operability.py::test_body_limit_returns_413 PASSED [ 51%]
student-tests/api/test_operability.py::test_chunked_body_is_limited_too PASSED [ 52%]
student-tests/api/test_operability.py::test_ready_turns_unavailable_without_database PASSED [ 52%]
student-tests/api/test_operability.py::test_protected_request_is_503_not_401_without_database PASSED [ 52%]
student-tests/api/test_operability.py::test_state_survives_new_process PASSED [ 53%]
student-tests/api/test_operability.py::test_logs_do_not_contain_credentials PASSED [ 53%]
student-tests/api/test_pagination.py::test_full_walk_has_no_gaps_or_repeats PASSED [ 53%]
student-tests/api/test_pagination.py::test_limit_may_change_between_pages PASSED [ 54%]
student-tests/api/test_pagination.py::test_last_page_closes_history PASSED [ 54%]
student-tests/api/test_pagination.py::test_cursor_is_shared_between_members PASSED [ 54%]
student-tests/api/test_pagination.py::test_cursor_from_another_chat_is_rejected PASSED [ 55%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[garbage] PASSED [ 55%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[1.2.3.4] PASSED [ 56%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[%20] PASSED [ 56%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[] PASSED [ 56%]
student-tests/api/test_pagination.py::test_limit_out_of_range[0] PASSED [ 57%]
student-tests/api/test_pagination.py::test_limit_out_of_range[-1] PASSED [ 57%]
student-tests/api/test_pagination.py::test_limit_out_of_range[101] PASSED [ 57%]
student-tests/api/test_pagination.py::test_limit_out_of_range[abc] PASSED [ 57%]
student-tests/api/test_pagination.py::test_limit_out_of_range[abc] PASSED [ 58%]
student-tests/api/test_pagination.py::test_limit_out_of_range[1.5] PASSED [ 58%]
student-tests/api/test_pagination.py::test_limit_out_of_range[] PASSED [ 58%]
student-tests/api/test_pagination.py::test_default_limit_is_50 PASSED [ 58%]
student-tests/api/test_pagination.py::test_limit_out_of_range[] PASSED [ 59%]
student-tests/api/test_pagination.py::test_default_limit_is_50 PASSED [ 59%]
student-tests/api/test_pagination.py::test_unknown_query_parameter_is_ignored PASSED [ 59%]
student-tests/api/test_pagination.py::test_chat_list_pagination PASSED [ 59%]
student-tests/api/test_pagination.py::test_chat_list_pagination PASSED [ 60%]
student-tests/api/test_pool.py::test_exhausted_pool_answers_503_in_bounded_time PASSED [ 60%]
student-tests/api/test_pool.py::test_statement_timeout_is_set_on_connections PASSED [ 60%]
student-tests/api/test_sessions.py::test_login_returns_session_for_registered_user PASSED [ 60%]
student-tests/api/test_sessions.py::test_registration_response_hides_password PASSED [ 61%]
student-tests/api/test_sessions.py::test_password_is_stored_as_argon2id PASSED [ 61%]
student-tests/api/test_sessions.py::test_session_stores_only_token_digest PASSED [ 62%]
student-tests/api/test_sessions.py::test_wrong_password_and_unknown_user_look_the_same PASSED [ 62%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers0] PASSED [ 62%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers1] PASSED [ 63%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers2] PASSED [ 63%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers3] PASSED [ 64%]
student-tests/api/test_sessions.py::test_password_with_colon_logs_in PASSED [ 64%]
student-tests/api/test_sessions.py::test_login_with_body_is_rejected PASSED [ 65%]
student-tests/api/test_sessions.py::test_basic_on_business_endpoint_gets_bearer_challenge PASSED [ 65%]
student-tests/api/test_sessions.py::test_user_id_header_does_not_override_owner PASSED [ 65%]
student-tests/api/test_sessions.py::test_authentication_precedes_validation PASSED [ 66%]
student-tests/api/test_sessions.py::test_logout_revokes_only_current_session PASSED [ 66%]
student-tests/api/test_sessions.py::test_short_ttl_session_expires PASSED [ 67%]
student-tests/api/test_sessions.py::test_expired_sessions_are_purged_on_next_login PASSED [ 67%]
student-tests/api/test_sessions.py::test_chat_routes_require_bearer PASSED [ 67%]
student-tests/api/test_timeout.py::test_timeout_returns_unavailable_error_body PASSED [ 68%]
student-tests/api/test_timeout.py::test_timeout_does_not_break_following_requests PASSED [ 68%]
student-tests/api/test_timeout.py::test_timeout_is_logged_without_message_text PASSED [ 69%]
student-tests/api/test_timeout.py::test_normal_request_is_not_affected_by_timeout PASSED [ 69%]
student-tests/api/test_timeout.py::test_slow_event_handler_does_not_trigger_timeout PASSED [ 69%]
student-tests/api/test_timeout.py::test_healthcheck_stays_fast PASSED [ 70%]
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[whole-second] PASSED [ 70%]
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[microseconds] PASSED [ 71%]
student-tests/unit/test_authentication.py::test_basic_splits_on_first_colon PASSED [ 71%]
student-tests/unit/test_authentication.py::test_basic_decodes_utf8_password PASSED [ 72%]
student-tests/unit/test_authentication.py::test_basic_scheme_is_case_insensitive PASSED [ 72%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[] PASSED [ 72%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic] PASSED [ 73%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic ] PASSED [ 73%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic !!!not-base64!!!] PASSED [ 74%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U] PASSED [ 74%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic bm8tY29sb24taGVyZQ==] PASSED [ 74%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic 0LDQu9C40YHQsDrQv9Cw0YDQvtC70Yw=] PASSED [ 75%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U6//4=] PASSED [ 75%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Bearer YWxpY2U6c2VjcmV0] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_bearer_accepts_token68 PASSED [ 76%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer] PASSED [ 77%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer ] PASSED [ 77%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer a b] PASSED [ 78%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Basic abc] PASSED [ 78%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 79%]
student-tests/unit/test_authentication.py::test_bearer_rejects_oversized_token PASSED [ 79%]
student-tests/unit/test_authentication.py::test_challenge_depends_only_on_path PASSED [ 79%]
student-tests/unit/test_cursor.py::test_roundtrip_preserves_key PASSED [ 80%]
student-tests/unit/test_cursor.py::test_cursor_is_opaque PASSED [ 80%]
student-tests/unit/test_cursor.py::test_cursor_from_another_scope_is_rejected PASSED [ 81%]
student-tests/unit/test_cursor.py::test_forged_cursor_is_rejected PASSED [ 81%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[] PASSED [ 81%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[garbage] PASSED [ 82%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.2.3] PASSED [ 82%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[2.1.2.3] PASSED [ 83%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.notanumber.ff.AAAA] PASSED [ 83%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.1.zz.AAAA] PASSED [ 83%]
student-tests/unit/test_cursor.py::test_tampered_payload_is_rejected PASSED [ 84%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[ab] PASSED [ 84%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED [ 85%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[Alice] PASSED [ 85%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice-01] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[\u0430\u043b\u0438\u0441\u0430] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[a b] PASSED [ 87%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\n] PASSED [ 87%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\r\n] PASSED [ 88%]
student-tests/unit/test_domain.py::test_username_accepts_valid[abc] PASSED [ 88%]
student-tests/unit/test_domain.py::test_username_accepts_valid[a_b_9] PASSED [ 88%]
student-tests/unit/test_domain.py::test_username_accepts_valid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED [ 89%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[] PASSED [ 89%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[ ] PASSED [ 90%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[\t\n] PASSED [ 90%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 90%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[] PASSED [ 91%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[ ] PASSED [ 91%]
student-tests/api/test_pool.py::test_idle_session_does_not_acquire_connection PASSED [ 61%]
student-tests/api/test_pool.py::test_closed_idle_connection_is_replaced_before_registration PASSED [ 61%]
student-tests/api/test_pool.py::test_readiness_timeout_releases_waiter PASSED [ 61%]
student-tests/api/test_pool.py::test_server_statement_timeout_returns_connection PASSED [ 62%]
student-tests/api/test_pool.py::test_unit_of_work_persists_sessions_and_events_only_on_commit[False] PASSED [ 62%]
student-tests/api/test_pool.py::test_unit_of_work_persists_sessions_and_events_only_on_commit[True] PASSED [ 63%]
student-tests/api/test_pool.py::test_integrity_failure_rolls_back_and_keeps_pool_usable PASSED [ 63%]
student-tests/api/test_pool.py::test_blocked_message_times_out_without_taking_key[database] PASSED [ 63%]
student-tests/api/test_pool.py::test_blocked_message_times_out_without_taking_key[request] PASSED [ 64%]
student-tests/api/test_pool.py::test_message_integrity_failure_rolls_back_receipt_and_timestamp PASSED [ 64%]
student-tests/api/test_sessions.py::test_login_returns_session_for_registered_user PASSED [ 64%]
student-tests/api/test_sessions.py::test_registration_response_hides_password PASSED [ 65%]
student-tests/api/test_sessions.py::test_password_is_stored_as_argon2id PASSED [ 65%]
student-tests/api/test_sessions.py::test_session_stores_only_token_digest PASSED [ 66%]
student-tests/api/test_sessions.py::test_wrong_password_and_unknown_user_look_the_same PASSED [ 66%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers0] PASSED [ 66%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers1] PASSED [ 67%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers2] PASSED [ 67%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers3] PASSED [ 67%]
student-tests/api/test_sessions.py::test_password_with_colon_logs_in PASSED [ 68%]
student-tests/api/test_sessions.py::test_login_with_body_is_rejected PASSED [ 68%]
student-tests/api/test_sessions.py::test_basic_on_business_endpoint_gets_bearer_challenge PASSED [ 69%]
student-tests/api/test_sessions.py::test_user_id_header_does_not_override_owner PASSED [ 69%]
student-tests/api/test_sessions.py::test_authentication_precedes_validation PASSED [ 69%]
student-tests/api/test_sessions.py::test_logout_revokes_only_current_session PASSED [ 70%]
student-tests/api/test_sessions.py::test_short_ttl_session_expires PASSED [ 70%]
student-tests/api/test_sessions.py::test_expired_sessions_are_purged_on_next_login PASSED [ 70%]
student-tests/api/test_sessions.py::test_chat_routes_require_bearer PASSED [ 71%]
student-tests/api/test_timeout.py::test_timeout_returns_unavailable_error_body PASSED [ 71%]
student-tests/api/test_timeout.py::test_timeout_does_not_break_following_requests PASSED [ 71%]
student-tests/api/test_timeout.py::test_timeout_is_logged_without_message_text PASSED [ 72%]
student-tests/api/test_timeout.py::test_normal_request_is_not_affected_by_timeout PASSED [ 72%]
student-tests/api/test_timeout.py::test_slow_event_handler_does_not_trigger_timeout PASSED [ 73%]
student-tests/api/test_timeout.py::test_healthcheck_stays_fast PASSED [ 73%]
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[whole-second] PASSED [ 73%]
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[microseconds] PASSED [ 74%]
student-tests/unit/test_authentication.py::test_basic_splits_on_first_colon PASSED [ 74%]
student-tests/unit/test_authentication.py::test_basic_decodes_utf8_password PASSED [ 74%]
student-tests/unit/test_authentication.py::test_basic_scheme_is_case_insensitive PASSED [ 75%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[] PASSED [ 75%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic ] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic !!!not-base64!!!] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U] PASSED [ 77%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic bm8tY29sb24taGVyZQ==] PASSED [ 77%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic 0LDQu9C40YHQsDrQv9Cw0YDQvtC70Yw=] PASSED [ 77%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U6//4=] PASSED [ 78%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Bearer YWxpY2U6c2VjcmV0] PASSED [ 78%]
student-tests/unit/test_authentication.py::test_bearer_accepts_token68 PASSED [ 78%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[] PASSED [ 79%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer] PASSED [ 79%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer ] PASSED [ 80%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer a b] PASSED [ 80%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Basic abc] PASSED [ 80%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 81%]
student-tests/unit/test_authentication.py::test_bearer_rejects_oversized_token PASSED [ 81%]
student-tests/unit/test_authentication.py::test_challenge_depends_only_on_path PASSED [ 81%]
student-tests/unit/test_cursor.py::test_roundtrip_preserves_key PASSED [ 82%]
student-tests/unit/test_cursor.py::test_cursor_is_opaque PASSED [ 82%]
student-tests/unit/test_cursor.py::test_cursor_from_another_scope_is_rejected PASSED [ 83%]
student-tests/unit/test_cursor.py::test_forged_cursor_is_rejected PASSED [ 83%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[] PASSED [ 83%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[garbage] PASSED [ 84%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.2.3] PASSED [ 84%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[2.1.2.3] PASSED [ 84%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.notanumber.ff.AAAA] PASSED [ 85%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.1.zz.AAAA] PASSED [ 85%]
student-tests/unit/test_cursor.py::test_tampered_payload_is_rejected PASSED [ 85%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[ab] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[Alice] PASSED [ 87%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice-01] PASSED [ 87%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[\u0430\u043b\u0438\u0441\u0430] PASSED [ 87%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[] PASSED [ 88%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[a b] PASSED [ 88%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\n] PASSED [ 88%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\r\n] PASSED [ 89%]
student-tests/unit/test_domain.py::test_username_accepts_valid[abc] PASSED [ 89%]
student-tests/unit/test_domain.py::test_username_accepts_valid[a_b_9] PASSED [ 90%]
student-tests/unit/test_domain.py::test_username_accepts_valid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED [ 90%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[] PASSED [ 90%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[ ] PASSED [ 91%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[\t\n] PASSED [ 91%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 91%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[] PASSED [ 92%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[ ] PASSED [ 92%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxx] PASSED [ 92%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 92%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 93%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[\t\t\t\t\t\t\t\t\t\t\t\t] PASSED [ 93%]
student-tests/unit/test_domain.py::test_password_counts_code_points[xxxxxxxxxxxx] PASSED [ 93%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f] PASSED [ 93%]
student-tests/unit/test_domain.py::test_password_counts_code_points[xxxxxxxxxxxx] PASSED [ 94%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f] PASSED [ 94%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\u043f\u0430\u0440\u043e\u043b\u044c:\u0441:\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c] PASSED [ 94%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b] PASSED [ 94%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b] PASSED [ 95%]
student-tests/unit/test_domain.py::test_password_is_not_printed PASSED [ 95%]
student-tests/unit/test_domain.py::test_session_token_is_opaque_and_stored_as_digest PASSED [ 95%]
student-tests/unit/test_domain.py::test_session_tokens_are_unique PASSED [ 95%]
student-tests/unit/test_domain.py::test_session_tokens_are_unique PASSED [ 96%]
student-tests/unit/test_domain.py::test_message_text_counts_code_points_not_bytes PASSED [ 96%]
student-tests/unit/test_domain.py::test_message_text_rejects_blank PASSED [ 96%]
student-tests/unit/test_domain.py::test_message_text_rejects_blank PASSED [ 97%]
student-tests/unit/test_domain.py::test_chat_requires_creator_in_members PASSED [ 97%]
student-tests/unit/test_domain.py::test_chat_rejects_duplicate_members PASSED [ 97%]
student-tests/unit/test_domain.py::test_chat_rejects_more_than_hundred_members PASSED [ 97%]
student-tests/unit/test_domain.py::test_chat_rejects_more_than_hundred_members PASSED [ 98%]
student-tests/unit/test_domain.py::test_receipt_replays_only_the_same_request PASSED [ 98%]
student-tests/unit/test_domain.py::test_posted_message_describes_itself PASSED [ 98%]
student-tests/unit/test_domain.py::test_user_registration_emits_event PASSED [ 99%]
student-tests/unit/test_domain.py::test_clock_is_strictly_increasing PASSED [ 99%]
student-tests/unit/test_timeouts.py::test_timeouts_shrink_inwards_and_shutdown_fits_the_stop_budget PASSED [100%]
===================== 243 passed, 12 deselected in 20.60s ======================
exit=0
$ .venv/bin/pytest -s -q student-tests/api/test_drain.py student-tests/unit/test_timeouts.py # SIGTERM-окно и цепочка таймаутов
.окно: ready/live (503, 200), порт закрыт через 1.17 с, выход 2.43 с
запрос, принятый до SIGTERM и дописанный после закрытия порта: HTTP/1.1 201 Created
запрос, тело которого так и не пришло: HTTP/1.1 503 Service Unavailable
content-type application/json, тело {'error': {'code': 'unavailable', 'message': 'Сервис временно недоступен', 'request_id': '83cd403af06b44c1ac1fbf05f09908b4'}}
.обнаружение 1.5 с (зависание 3.5 с), окно 2.0 с, дообработка 3.0 с, остановка 6.0 с, хук 7.0 с, stop_grace_period 8.0 с; LB server 10.0 с > запрос 8.0 с > БД 3.0 с; readiness 0.8 с < check 1.0 с
.
3 passed in 4.14s
exit=0
===================== 271 passed, 12 deselected in 29.48s ======================
exit_code: 0 elapsed_seconds: 30.076