Finalize the lab 3 report against recorded evidence

Rerun the clean clone pass on the final commit in its own compose project:
secrets, config, up with migrations on empty volumes, readiness, smoke,
replica spread and same key races, failover, persistence, repeated
migrations, down keeping volumes and reset-data removing them. Record the
student tests by name and the limits policy on the final code.

Check every figure of the report against evidence files and fix the ones
that drifted: data set sizes, the share of the chat lock statement, the
WAL waits, the aborted series, the disturbed steps, the restart timing
and the image ID of the rolling update. State which commit each evidence
file was taken on, answer the defense questions, index evidence/ and
bring AGENTS.md and the openspec context up to date for lab 3.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-29 03:13:24 +03:00
co-authored by Claude Opus 5.5
parent e88673dfec
commit e425a9d236
7 changed files with 709 additions and 169 deletions
+48 -2
View File
@@ -1,5 +1,51 @@
# Доказательства
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
Обезличенные результаты прогонов лабы 3. Пользователи, чаты и тексты синтетические; паролей, токенов, `.env`,
содержимого `secrets/` и дампов здесь нет. В первой строке каждого текстового файла — дата (UTC) и коммит
прогона. Проверки через балансировщик шли с `BASE_URL=http://localhost:18083` (порт 8080 на машине был занят
стендами других лаб). Hostname реплики = `X-Instance-Id`; ID контейнеров меняются между прогонами.
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
## Уровень «3» и перенос лабы 2
| Файл | Что доказывает | Команда | Коммит |
| --- | --- | --- | --- |
| `clean-clone.txt` | запуск из свежего clone на пустых volumes: секреты, `config`, `make up` с миграциями `0001`/`0002`, готовность, smoke, ≥2 реплики и гонки ключа, failover, persistence, повтор миграций, `make down` (volumes остаются), `make reset-data` (volumes удалены) | последовательность из `REPORT.md`, раздел «Запуск» | `e88673d` |
| `smoke.txt` | публичный smoke через LB | `make test BASE_URL=…` | `e00eb6c` |
| `stack.txt` | сервисы, только `lb` публикует порты, `container_name` 0, `docker port` реплик пуст, hostname ↔ `X-Instance-Id`, лимиты, сети, uid, взгляд LB | `make stack-evidence` | `e00eb6c` |
| `environment.txt` | host, Docker, образы по digest, версии пакетов, uid процессов | `make stack-evidence` | `e00eb6c` |
| `lb-check.json` | 40 `GET /users/me` одним токеном — 20 + 20 по двум репликам; 20 раундов × 8 параллельных POST с одним ключом — 160 × `201`, одна копия, `409` на другой body | `make lb-check` | `e00eb6c` |
| `failover-27de23496b0f.txt`, `failover-a3536e394b3f.txt` | `make test-failover ACTION_SCRIPT=scripts/stop-one.sh` для каждой реплики: `docker inspect` до/после, остановлен именно target, лог его остановки, `restore` | `make failover-evidence BASE_URL=…` | `e00eb6c` |
| `hooks.txt` | `stop-one.sh`: длительность, код, остановлен только target; неизвестный ID → 3; без переменной → 1; все реплики остановлены → `503` LB в формате контракта | команды внутри файла | `e00eb6c` |
| `persistence.txt` | `make test-persistence ACTION_SCRIPT=scripts/restart.sh` и `StartedAt` всех контейнеров до и после | `make persistence-evidence BASE_URL=…` | `e00eb6c` |
| `faults.txt` | тесты стенда лабы 2 через LB: гонка регистрации, остановка Valkey и PostgreSQL, рестарт API | `make test-faults BASE_URL=…` | `e00eb6c` |
| `student-tests.txt` | все собственные тесты по именам (идемпотентность, `X-Instance-Id`, сессии, конвейер) и вывод теста `SIGTERM`-окна и цепочки таймаутов | `PYTEST_ADDOPTS=-vv make student-test`; `pytest -s` двух файлов | `e88673d` |
| `schema.txt` | `\d+` всех таблиц и применённые миграции | `make storage-evidence` | `0796e29` |
| `migrations.txt` | повторный `migrate` → `up to date`, счётчики строк до и после равны | `make storage-evidence` | `0796e29` |
| `kdf.txt` | Argon2id у всех пользователей, в `sessions` только 32-байтовые SHA-256 | `make storage-evidence` | `0796e29` |
| `secrets.txt` | секреты, `.env`, дампы и volumes не в Git и игнорируются | `make storage-evidence` | `0796e29` |
## Уровень «4»
| Файл | Что доказывает | Команда | Коммит |
| --- | --- | --- | --- |
| `limits.txt` | лимиты CPU/RAM всех сервисов (объявлены и применены), порты только у LB на `127.0.0.1`, секреты, volumes и сети по политике | `make limits` | `e88673d` |
| `limits-violations.txt` | та же проверка ловит подмешанные нарушения (5 штук, код 1) | `COMPOSE_FILE=compose.yaml:violations.yaml python3 scripts/limits.py` | `e00eb6c` |
| `detection/{sigterm,kill,pause,postgres}.json` | время исключения backend из ротации против заявленного максимума, ответ LB после исключения, время возврата | `make detection` | `e00eb6c` |
| `failover-each/summary.json`, `failover-each/<hostname>/` | поочерёдная остановка каждой реплики под k6 100 rps: RPS, ошибки, p50/p95/p99, обнаружение, возврат, зонд записи, счётчики LB; сырьё — `k6/`, `lb_up.csv`, `probe.csv`, `action.txt` | `make failover-each` | `e00eb6c` |
| `rolling-from-8d28d45/` | rolling update с образа уровня «3» на текущий под k6: ёмкость, ошибки, замена всех реплик, `migrate` один раз | `make rolling-update FROM_REV=8d28d45` | `e00eb6c` |
| `rolling/` | rolling update текущей сборкой под k6 | `make rolling-update` | `e00eb6c` |
## Трек 1 «Цена масштабирования»
`track1/` — серии A и B, сравнение до/после, графики и проверки после улучшения; состав и поля CSV —
`track1/README.md`.
| Файл | Что доказывает | Команда |
| --- | --- | --- |
| `track1/host.txt` | снимок хоста, версии и соседние контейнеры перед сериями | `make track1-host` |
| `track1/series-a/` | 1×4, 2×2, 4×1 при 4 CPU / 2 GiB API | `make track1-a` |
| `track1/series-b/` | 1×1, 2×1, 8×1 по 1 CPU (4×1 — из серии A) | `make track1-b` |
| `track1/compare/` | улучшение: «до» (`edc091d`) и «после» на 8×1 | `make track1-compare` |
| `track1/plots/` | графики и сводка потолков `capacity.md` | `make plots` |
| `track1/after-checks.txt` | уровни «3» и «4» на коде с улучшением (`dde113b`) | команды внутри файла |
| `track1/host-others.csv`, `track1/aborted/` | нагрузка соседних стендов во время замеров и прерванная первая попытка серии A | см. `track1/README.md` |
+194 -12
View File
@@ -1,5 +1,9 @@
date: 2026-10-28T08:44:21Z commit: ae8fb0a
$ git clone … && git checkout solution/bpi2303-kostylev
date: 2026-10-28T23:57:41Z commit: e88673d dir: mtusi2026lab3-clean (свой compose-проект и volumes)
$ git clone … mtusi2026lab3-clean && cd mtusi2026lab3-clean && git checkout solution/bpi2303-kostylev
HEAD e88673d Archive the scaling cost change
$ docker volume ls -q --filter name=mtusi2026lab3-clean | wc -l | tr -d ' '
0
exit=0
$ make secrets
sh scripts/secrets.sh
создан secrets/postgres_password
@@ -9,19 +13,197 @@ sh scripts/secrets.sh
создан secrets/valkey.conf
создан secrets/cache_url
создан .env из .env.example
exit=0
$ sed LB_HTTP_PORT=18083 LB_STATS_PORT=23083 .env # 8080 на этой машине занят стендами других лаб
$ git status --short --ignored secrets .env
!! .env
!! secrets/
exit=0
$ docker compose --env-file .env config --quiet && echo valid
valid
$ make up # docker compose up -d --build --wait
Container mtusi2026lab3-postgres-1 Healthy
Container mtusi2026lab3-migrate-1 Exited
Container mtusi2026lab3-postgres-1 Healthy
Container mtusi2026lab3-migrate-1 Exited
Container mtusi2026lab3-valkey-1 Healthy
Container mtusi2026lab3-api-2 Healthy
Container mtusi2026lab3-api-1 Healthy
Container mtusi2026lab3-lb-1 Healthy
up --wait: 15 s
exit=0
$ make up
sh scripts/secrets.sh
docker compose up -d --build --wait
(вывод BuildKit сокращён: базовые слои из кэша, пересобран только пакет приложения)
#18 exporting attestation manifest sha256:ed849b42694ed5a522c42c73051e106c02d36f3a6a8618af0a878222e35c20a5 done
#18 naming to docker.io/library/mtusi-messenger:lab3 done
#19 resolving provenance for metadata file
api Built
Network mtusi2026lab3-clean_edge Creating
Network mtusi2026lab3-clean_edge Created
Network mtusi2026lab3-clean_backend Creating
Network mtusi2026lab3-clean_backend Created
Volume "mtusi2026lab3-clean_pgdata" Creating
Volume "mtusi2026lab3-clean_pgdata" Created
Volume "mtusi2026lab3-clean_valkeydata" Creating
Volume "mtusi2026lab3-clean_valkeydata" Created
Container mtusi2026lab3-clean-lb-1 Creating
Container mtusi2026lab3-clean-valkey-1 Creating
Container mtusi2026lab3-clean-postgres-1 Creating
Container mtusi2026lab3-clean-valkey-1 Created
Container mtusi2026lab3-clean-postgres-1 Created
Container mtusi2026lab3-clean-migrate-1 Creating
Container mtusi2026lab3-clean-lb-1 Created
Container mtusi2026lab3-clean-migrate-1 Created
Container mtusi2026lab3-clean-api-2 Creating
Container mtusi2026lab3-clean-api-1 Creating
Container mtusi2026lab3-clean-api-1 Created
Container mtusi2026lab3-clean-api-2 Created
Container mtusi2026lab3-clean-valkey-1 Starting
Container mtusi2026lab3-clean-lb-1 Starting
Container mtusi2026lab3-clean-postgres-1 Starting
Container mtusi2026lab3-clean-postgres-1 Started
Container mtusi2026lab3-clean-postgres-1 Waiting
Container mtusi2026lab3-clean-valkey-1 Started
Container mtusi2026lab3-clean-lb-1 Started
Container mtusi2026lab3-clean-postgres-1 Healthy
Container mtusi2026lab3-clean-migrate-1 Starting
Container mtusi2026lab3-clean-migrate-1 Started
Container mtusi2026lab3-clean-migrate-1 Waiting
Container mtusi2026lab3-clean-migrate-1 Exited
Container mtusi2026lab3-clean-api-2 Starting
Container mtusi2026lab3-clean-api-2 Started
Container mtusi2026lab3-clean-api-1 Starting
Container mtusi2026lab3-clean-api-1 Started
Container mtusi2026lab3-clean-api-2 Waiting
Container mtusi2026lab3-clean-api-1 Waiting
Container mtusi2026lab3-clean-migrate-1 Waiting
Container mtusi2026lab3-clean-postgres-1 Waiting
Container mtusi2026lab3-clean-valkey-1 Waiting
Container mtusi2026lab3-clean-lb-1 Waiting
Container mtusi2026lab3-clean-migrate-1 Exited
Container mtusi2026lab3-clean-valkey-1 Healthy
Container mtusi2026lab3-clean-postgres-1 Healthy
Container mtusi2026lab3-clean-api-2 Healthy
Container mtusi2026lab3-clean-api-1 Healthy
Container mtusi2026lab3-clean-lb-1 Healthy
exit=0
make up (build, migrate, wait healthy): 17 s
$ docker compose logs --no-log-prefix migrate
{"version":"0001_init","event":"migration.applied","level":"info","ts":"2026-10-28T23:57:55.908471Z"}
{"version":"0002_idempotency_keys","event":"migration.applied","level":"info","ts":"2026-10-28T23:57:55.908551Z"}
{"reason":"applied","event":"migration.completed","level":"info","ts":"2026-10-28T23:57:55.908595Z"}
exit=0
$ docker compose ps -a --format '{{.Service}} {{.State}} {{.Status}} {{.Ports}}'
api running Up 3 seconds (healthy)
api running Up 3 seconds (healthy)
lb running Up 10 seconds (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
migrate exited Exited (0) 4 seconds ago
postgres running Up 10 seconds (healthy)
valkey running Up 10 seconds (healthy)
exit=0
$ until curl -fsS http://localhost:18083/health/ready; do sleep 1; done; scripts/lb-wait.sh 2
{"status":"ok"}
LB: 2 api UP
$ make test BASE_URL=http://localhost:18083
python3 tests/smoke.py --base-url "http://localhost:18083"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
exit=0
$ python3 scripts/probe.py check --rounds 20
{
"instances_one_token": {
"8707058f0f3c": 20,
"c7bbd4c000bd": 20
},
"same_key": {
"rounds": 20,
"parallel": 8,
"statuses": {
"201": 160
},
"instances": {
"c7bbd4c000bd": 80,
"8707058f0f3c": 80
},
"identical_bodies_rounds": 20,
"single_copy_rounds": 20,
"conflict_rounds": 20
},
"pass": true
}
exit=0
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://localhost:18083
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:18083"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 132, "failed_attempts": 0, "first_recovery_seconds": 2.985}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
exit=0
$ docker compose ps -a --format '{{.Service}} {{.Name}} {{.State}} {{.Status}}' api
api mtusi2026lab3-clean-api-1 exited Exited (0) 12 seconds ago
api mtusi2026lab3-clean-api-2 running Up 21 seconds (healthy)
exit=0
$ make restore
scripts/restore.sh
Container mtusi2026lab3-clean-api-2 Running
Container mtusi2026lab3-clean-api-1 Starting
Container mtusi2026lab3-clean-api-1 Started
Container mtusi2026lab3-clean-api-2 Waiting
Container mtusi2026lab3-clean-api-1 Waiting
Container mtusi2026lab3-clean-api-2 Healthy
Container mtusi2026lab3-clean-api-1 Healthy
exit=0
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://localhost:18083
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost: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.
exit=0
$ docker compose ps -a --format '{{.Service}} {{.State}} {{.RunningFor}} {{.Status}}'
api running 44 seconds ago Up 4 seconds (healthy)
api running 44 seconds ago Up 4 seconds (healthy)
lb running 44 seconds ago Up 10 seconds (healthy)
migrate exited 44 seconds ago Exited (0) 4 seconds ago
postgres running 44 seconds ago Up 10 seconds (healthy)
valkey running 44 seconds ago Up 10 seconds (healthy)
exit=0
$ make migrate
docker compose run --rm migrate
Container mtusi2026lab3-clean-postgres-1 Running
{"reason":"up to date","event":"migration.completed","level":"info","ts":"2026-10-28T23:58:35.296474Z"}
exit=0
$ make down
docker compose down
Container mtusi2026lab3-clean-api-2 Stopping
Container mtusi2026lab3-clean-api-1 Stopping
Container mtusi2026lab3-clean-lb-1 Stopping
Container mtusi2026lab3-clean-lb-1 Stopped
Container mtusi2026lab3-clean-lb-1 Removing
Container mtusi2026lab3-clean-lb-1 Removed
Container mtusi2026lab3-clean-api-2 Stopped
Container mtusi2026lab3-clean-api-2 Removing
Container mtusi2026lab3-clean-api-2 Removed
Container mtusi2026lab3-clean-api-1 Stopped
Container mtusi2026lab3-clean-api-1 Removing
Container mtusi2026lab3-clean-api-1 Removed
Container mtusi2026lab3-clean-valkey-1 Stopping
Container mtusi2026lab3-clean-migrate-1 Stopping
Container mtusi2026lab3-clean-migrate-1 Stopped
Container mtusi2026lab3-clean-migrate-1 Removing
Container mtusi2026lab3-clean-migrate-1 Removed
Container mtusi2026lab3-clean-postgres-1 Stopping
Container mtusi2026lab3-clean-valkey-1 Stopped
Container mtusi2026lab3-clean-valkey-1 Removing
Container mtusi2026lab3-clean-valkey-1 Removed
Container mtusi2026lab3-clean-postgres-1 Stopped
Container mtusi2026lab3-clean-postgres-1 Removing
Container mtusi2026lab3-clean-postgres-1 Removed
Network mtusi2026lab3-clean_edge Removing
Network mtusi2026lab3-clean_backend Removing
Network mtusi2026lab3-clean_edge Removed
Network mtusi2026lab3-clean_backend Removed
exit=0
$ docker volume ls --format '{{.Name}}' --filter name=mtusi2026lab3-clean
mtusi2026lab3-clean_pgdata
mtusi2026lab3-clean_valkeydata
exit=0
$ make reset-data
Удаляются volumes с учебными данными стенда
docker compose down -v --remove-orphans
Volume mtusi2026lab3-clean_valkeydata Removing
Volume mtusi2026lab3-clean_pgdata Removing
Volume mtusi2026lab3-clean_valkeydata Removed
Volume mtusi2026lab3-clean_pgdata Removed
exit=0
$ docker volume ls --format '{{.Name}}' --filter name=mtusi2026lab3-clean | wc -l | tr -d ' '
0
exit=0
+6 -6
View File
@@ -1,4 +1,4 @@
date: 2026-10-28T16:53:57Z
date: 2026-10-29T00:01:40Z commit: e88673d
$ docker compose --profile bench config --format json (declared)
service cpus/mem ports secrets volumes networks ro
-------- ---------- ------------------------------- ------------------------------------ ---------- ---------------------- -----
@@ -12,10 +12,10 @@ valkey 0.5/128MiB - valkey.conf
$ docker inspect (running containers: hostname = X-Instance-Id, applied limits)
service hostname cpus memory published
-------- ------------ ---- ------- ---------------------------------------------------
api 27de23496b0f 1 512MiB
api a3536e394b3f 1 512MiB
lb 0b152ec25c09 1 128MiB 127.0.0.1:18083->8080/tcp,127.0.0.1:23083->8404/tcp
postgres 67fe9b43b70b 2 1024MiB
valkey e4c5a748222e 0.5 128MiB
api a843d54b43d6 1 512MiB
api e83eafdcbc8c 1 512MiB
lb 7158414e6b52 1 128MiB 127.0.0.1:18083->8080/tcp,127.0.0.1:23083->8404/tcp
postgres 2f2e8762d1a1 2 1024MiB
valkey fb760634494a 0.5 128MiB
PASS: limits, ports, secrets, volumes and networks match the policy
+247 -34
View File
@@ -1,40 +1,253 @@
date: 2026-10-28T17:04:35Z commit: e00eb6c
$ make student-test # pytest без маркера stack, по файлам
date: 2026-10-29T00:00:10Z commit: e88673d
$ PYTEST_ADDOPTS=-vv make student-test # все собственные тесты без маркера stack (одноразовые PostgreSQL и Valkey в Docker), по именам
============================= test session starts ==============================
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0
rootdir: /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab3
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
collected 252 items / 10 deselected / 242 selected
student-tests/api/test_access.py ....... [ 2%]
student-tests/api/test_bounded_contexts.py .................. [ 10%]
student-tests/api/test_cache.py ..... [ 12%]
student-tests/api/test_concurrency.py ... [ 13%]
student-tests/api/test_consistency.py ........ [ 16%]
student-tests/api/test_drain.py .. [ 17%]
student-tests/api/test_events.py ....... [ 20%]
student-tests/api/test_idempotency.py ............... [ 26%]
student-tests/api/test_instance.py .... [ 28%]
student-tests/api/test_migrations.py ..... [ 30%]
student-tests/api/test_negative.py ..................................... [ 45%]
[ 45%]
student-tests/api/test_operability.py ............. [ 51%]
student-tests/api/test_pagination.py ................. [ 58%]
student-tests/api/test_pool.py .. [ 59%]
student-tests/api/test_sessions.py .................. [ 66%]
student-tests/api/test_timeout.py ...... [ 69%]
student-tests/api/test_wire_format.py .. [ 69%]
student-tests/unit/test_authentication.py ..................... [ 78%]
student-tests/unit/test_cursor.py ........... [ 83%]
student-tests/unit/test_domain.py ...................................... [ 98%]
.. [ 99%]
student-tests/unit/test_timeouts.py . [100%]
===================== 242 passed, 10 deselected ======================
collecting ... collected 250 items / 10 deselected / 240 selected
student-tests/api/test_access.py::test_outsider_gets_404_on_chat PASSED
student-tests/api/test_access.py::test_unknown_chat_is_indistinguishable_from_foreign PASSED
student-tests/api/test_access.py::test_outsider_cannot_write PASSED
student-tests/api/test_access.py::test_outsider_cannot_read_history PASSED
student-tests/api/test_access.py::test_access_checked_before_body PASSED
student-tests/api/test_access.py::test_chat_list_hides_foreign_chats PASSED
student-tests/api/test_access.py::test_403_is_never_used PASSED
student-tests/api/test_bounded_contexts.py::test_identity_does_not_know_about_messaging PASSED
student-tests/api/test_bounded_contexts.py::test_messaging_touches_identity_only_through_events PASSED
student-tests/api/test_bounded_contexts.py::test_domains_do_not_import_infrastructure PASSED
student-tests/api/test_bounded_contexts.py::test_core_layers_do_not_import_pydantic PASSED
student-tests/api/test_bounded_contexts.py::test_shared_knows_nothing_about_zones PASSED
student-tests/api/test_bounded_contexts.py::test_shared_core_is_free_of_transport PASSED
student-tests/api/test_bounded_contexts.py::test_shared_core_holds_only_platform PASSED
student-tests/api/test_bounded_contexts.py::test_shared_entrypoints_hold_only_transport PASSED
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_errors_events_and_commands PASSED
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_http_layer PASSED
student-tests/api/test_bounded_contexts.py::test_only_main_knows_both_zones PASSED
student-tests/api/test_bounded_contexts.py::test_application_has_no_separate_entrypoints_root PASSED
student-tests/api/test_bounded_contexts.py::test_shared_source_mentions_no_domain_vocabulary PASSED
student-tests/api/test_bounded_contexts.py::test_shared_declares_no_concrete_commands_or_events PASSED
student-tests/api/test_bounded_contexts.py::test_shared_has_no_test_doubles PASSED
student-tests/api/test_bounded_contexts.py::test_zone_errors_do_not_leak_transport_codes PASSED
student-tests/api/test_bounded_contexts.py::test_sql_of_each_zone_reads_only_its_tables PASSED
student-tests/api/test_bounded_contexts.py::test_messaging_does_not_import_identity_at_all PASSED
student-tests/api/test_cache.py::test_second_check_is_served_from_cache PASSED
student-tests/api/test_cache.py::test_logout_writes_tombstone_before_database PASSED
student-tests/api/test_cache.py::test_fill_racing_with_logout_does_not_revive_token PASSED
student-tests/api/test_cache.py::test_flushall_loses_nothing PASSED
student-tests/api/test_cache.py::test_unreachable_cache_is_bypassed_without_anonymous_access PASSED
student-tests/api/test_concurrency.py::test_hundred_messages_from_ten_clients PASSED
student-tests/api/test_concurrency.py::test_history_follows_the_clock_but_never_moves_back PASSED
student-tests/api/test_concurrency.py::test_parallel_registration_keeps_username_unique PASSED
student-tests/api/test_concurrency.py::test_parallel_chat_creation_is_atomic PASSED
student-tests/api/test_consistency.py::test_registration_is_visible_to_chats_immediately PASSED
student-tests/api/test_consistency.py::test_parallel_registrations_are_all_usable_as_members PASSED
student-tests/api/test_consistency.py::test_rejected_registration_leaves_no_trace PASSED
student-tests/api/test_consistency.py::test_failed_chat_creation_rolls_back_both_tables PASSED
student-tests/api/test_consistency.py::test_rejected_message_does_not_enter_history PASSED
student-tests/api/test_consistency.py::test_confirmed_write_is_visible_to_next_read PASSED
student-tests/api/test_consistency.py::test_parallel_writes_across_zones_keep_counts_consistent PASSED
student-tests/api/test_consistency.py::test_chat_membership_survives_parallel_reads_and_writes PASSED
student-tests/api/test_drain.py::test_draining_replica_is_not_ready_but_alive PASSED
student-tests/api/test_drain.py::test_sigterm_leaves_rotation_then_closes_and_exits PASSED
student-tests/api/test_events.py::test_event_has_no_message_text PASSED
student-tests/api/test_events.py::test_every_subscriber_receives_event PASSED
student-tests/api/test_events.py::test_failing_subscriber_does_not_block_others PASSED
student-tests/api/test_events.py::test_queue_overflow_drops_events_without_raising PASSED
student-tests/api/test_events.py::test_projection_runs_before_publish_returns PASSED
student-tests/api/test_events.py::test_publication_does_not_delay_response PASSED
student-tests/api/test_events.py::test_null_logger_hides_everything PASSED
student-tests/api/test_idempotency.py::test_replay_returns_the_same_message PASSED
student-tests/api/test_idempotency.py::test_same_json_in_other_layout_is_a_replay PASSED
student-tests/api/test_idempotency.py::test_other_body_with_same_key_conflicts PASSED
student-tests/api/test_idempotency.py::test_missing_key_is_rejected PASSED
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[0] PASSED
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[1] PASSED
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[2] PASSED
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[3] PASSED
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[4] PASSED
student-tests/api/test_idempotency.py::test_malformed_key_is_rejected[5] PASSED
student-tests/api/test_idempotency.py::test_rejected_attempt_does_not_take_the_key PASSED
student-tests/api/test_idempotency.py::test_key_is_scoped_by_user_and_chat PASSED
student-tests/api/test_idempotency.py::test_replay_checks_session_and_access_again PASSED
student-tests/api/test_idempotency.py::test_expired_key_starts_over PASSED
student-tests/api/test_idempotency.py::test_concurrent_retries_through_two_replicas_store_one_message PASSED
student-tests/api/test_instance.py::test_every_response_names_the_replica PASSED
student-tests/api/test_instance.py::test_rejected_body_names_the_replica PASSED
student-tests/api/test_instance.py::test_unhandled_error_names_the_replica PASSED
student-tests/api/test_instance.py::test_replica_defaults_to_container_hostname PASSED
student-tests/api/test_migrations.py::test_migrations_are_ordered_and_versioned PASSED
student-tests/api/test_migrations.py::test_rerun_changes_nothing PASSED
student-tests/api/test_migrations.py::test_changed_migration_is_refused PASSED
student-tests/api/test_migrations.py::test_sender_must_be_member_even_bypassing_api PASSED
student-tests/api/test_migrations.py::test_key_needs_a_member_and_a_message PASSED
student-tests/api/test_negative.py::test_malformed_json PASSED
student-tests/api/test_negative.py::test_unexpected_field PASSED
student-tests/api/test_negative.py::test_wrong_types PASSED
student-tests/api/test_negative.py::test_invalid_registration[body0] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body1] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body2] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body3] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body4] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body5] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body6] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body7] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body8] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body9] PASSED
student-tests/api/test_negative.py::test_invalid_registration[body10] PASSED
student-tests/api/test_negative.py::test_duplicate_username PASSED
student-tests/api/test_negative.py::test_missing_identity PASSED
student-tests/api/test_negative.py::test_invalid_bearer[] PASSED
student-tests/api/test_negative.py::test_invalid_bearer[Bearer] PASSED
student-tests/api/test_negative.py::test_invalid_bearer[Bearer ] PASSED
student-tests/api/test_negative.py::test_invalid_bearer[Bearer not a token] PASSED
student-tests/api/test_negative.py::test_invalid_bearer[Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED
student-tests/api/test_negative.py::test_invalid_bearer[Token abcdef] PASSED
student-tests/api/test_negative.py::test_invalid_bearer[11111111-1111-4111-8111-111111111111] PASSED
student-tests/api/test_negative.py::test_user_id_header_alone_is_ignored PASSED
student-tests/api/test_negative.py::test_identity_checked_before_body PASSED
student-tests/api/test_negative.py::test_empty_message_rejected PASSED
student-tests/api/test_negative.py::test_long_message_rejected PASSED
student-tests/api/test_negative.py::test_sender_id_not_accepted PASSED
student-tests/api/test_negative.py::test_invalid_chat_creation[body0] PASSED
student-tests/api/test_negative.py::test_invalid_chat_creation[body1] PASSED
student-tests/api/test_negative.py::test_invalid_chat_creation[body2] PASSED
student-tests/api/test_negative.py::test_invalid_chat_creation[body3] PASSED
student-tests/api/test_negative.py::test_invalid_chat_creation[body4] PASSED
student-tests/api/test_negative.py::test_invalid_chat_creation[body5] PASSED
student-tests/api/test_negative.py::test_creator_must_be_member PASSED
student-tests/api/test_negative.py::test_unknown_member_rejected PASSED
student-tests/api/test_negative.py::test_bad_chat_id_in_path PASSED
student-tests/api/test_operability.py::test_health_needs_no_identity PASSED
student-tests/api/test_operability.py::test_every_response_carries_request_id PASSED
student-tests/api/test_operability.py::test_client_request_id_is_preserved PASSED
student-tests/api/test_operability.py::test_unknown_public_route_is_404 PASSED
student-tests/api/test_operability.py::test_unknown_protected_route_needs_identity PASSED
student-tests/api/test_operability.py::test_method_not_allowed_is_hidden PASSED
student-tests/api/test_operability.py::test_logs_do_not_contain_message_text PASSED
student-tests/api/test_operability.py::test_log_lines_are_json PASSED
student-tests/api/test_operability.py::test_body_limit_returns_413 PASSED
student-tests/api/test_operability.py::test_ready_turns_unavailable_without_database PASSED
student-tests/api/test_operability.py::test_protected_request_is_503_not_401_without_database PASSED
student-tests/api/test_operability.py::test_state_survives_new_process PASSED
student-tests/api/test_operability.py::test_logs_do_not_contain_credentials PASSED
student-tests/api/test_pagination.py::test_full_walk_has_no_gaps_or_repeats PASSED
student-tests/api/test_pagination.py::test_limit_may_change_between_pages PASSED
student-tests/api/test_pagination.py::test_last_page_closes_history PASSED
student-tests/api/test_pagination.py::test_cursor_is_shared_between_members PASSED
student-tests/api/test_pagination.py::test_cursor_from_another_chat_is_rejected PASSED
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[garbage] PASSED
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[1.2.3.4] PASSED
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[%20] PASSED
student-tests/api/test_pagination.py::test_limit_out_of_range[0] PASSED
student-tests/api/test_pagination.py::test_limit_out_of_range[-1] PASSED
student-tests/api/test_pagination.py::test_limit_out_of_range[101] PASSED
student-tests/api/test_pagination.py::test_limit_out_of_range[abc] PASSED
student-tests/api/test_pagination.py::test_limit_out_of_range[1.5] PASSED
student-tests/api/test_pagination.py::test_limit_out_of_range[] PASSED
student-tests/api/test_pagination.py::test_default_limit_is_50 PASSED
student-tests/api/test_pagination.py::test_unknown_query_parameter_is_ignored PASSED
student-tests/api/test_pagination.py::test_chat_list_pagination PASSED
student-tests/api/test_pool.py::test_exhausted_pool_answers_503_in_bounded_time PASSED
student-tests/api/test_pool.py::test_statement_timeout_is_set_on_connections PASSED
student-tests/api/test_sessions.py::test_login_returns_session_for_registered_user PASSED
student-tests/api/test_sessions.py::test_registration_response_hides_password PASSED
student-tests/api/test_sessions.py::test_password_is_stored_as_argon2id PASSED
student-tests/api/test_sessions.py::test_session_stores_only_token_digest PASSED
student-tests/api/test_sessions.py::test_wrong_password_and_unknown_user_look_the_same PASSED
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers0] PASSED
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers1] PASSED
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers2] PASSED
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers3] PASSED
student-tests/api/test_sessions.py::test_password_with_colon_logs_in PASSED
student-tests/api/test_sessions.py::test_login_with_body_is_rejected PASSED
student-tests/api/test_sessions.py::test_basic_on_business_endpoint_gets_bearer_challenge PASSED
student-tests/api/test_sessions.py::test_user_id_header_does_not_override_owner PASSED
student-tests/api/test_sessions.py::test_authentication_precedes_validation PASSED
student-tests/api/test_sessions.py::test_logout_revokes_only_current_session PASSED
student-tests/api/test_sessions.py::test_short_ttl_session_expires PASSED
student-tests/api/test_sessions.py::test_expired_sessions_are_purged_on_next_login PASSED
student-tests/api/test_sessions.py::test_chat_routes_require_bearer PASSED
student-tests/api/test_timeout.py::test_timeout_returns_unavailable_error_body PASSED
student-tests/api/test_timeout.py::test_timeout_does_not_break_following_requests PASSED
student-tests/api/test_timeout.py::test_timeout_is_logged_without_message_text PASSED
student-tests/api/test_timeout.py::test_normal_request_is_not_affected_by_timeout PASSED
student-tests/api/test_timeout.py::test_slow_event_handler_does_not_trigger_timeout PASSED
student-tests/api/test_timeout.py::test_healthcheck_stays_fast PASSED
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[whole-second] PASSED
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[microseconds] PASSED
student-tests/unit/test_authentication.py::test_basic_splits_on_first_colon PASSED
student-tests/unit/test_authentication.py::test_basic_decodes_utf8_password PASSED
student-tests/unit/test_authentication.py::test_basic_scheme_is_case_insensitive PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic ] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic !!!not-base64!!!] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic bm8tY29sb24taGVyZQ==] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic 0LDQu9C40YHQsDrQv9Cw0YDQvtC70Yw=] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U6//4=] PASSED
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Bearer YWxpY2U6c2VjcmV0] PASSED
student-tests/unit/test_authentication.py::test_bearer_accepts_token68 PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[] PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer] PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer ] PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer a b] PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Basic abc] PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED
student-tests/unit/test_authentication.py::test_bearer_rejects_oversized_token PASSED
student-tests/unit/test_authentication.py::test_challenge_depends_only_on_path PASSED
student-tests/unit/test_cursor.py::test_roundtrip_preserves_key PASSED
student-tests/unit/test_cursor.py::test_cursor_is_opaque PASSED
student-tests/unit/test_cursor.py::test_cursor_from_another_scope_is_rejected PASSED
student-tests/unit/test_cursor.py::test_forged_cursor_is_rejected PASSED
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[] PASSED
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[garbage] PASSED
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.2.3] PASSED
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[2.1.2.3] PASSED
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.notanumber.ff.AAAA] PASSED
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.1.zz.AAAA] PASSED
student-tests/unit/test_cursor.py::test_tampered_payload_is_rejected PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[ab] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[Alice] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice-01] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[\u0430\u043b\u0438\u0441\u0430] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[a b] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\n] PASSED
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\r\n] PASSED
student-tests/unit/test_domain.py::test_username_accepts_valid[abc] PASSED
student-tests/unit/test_domain.py::test_username_accepts_valid[a_b_9] PASSED
student-tests/unit/test_domain.py::test_username_accepts_valid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[] PASSED
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[ ] PASSED
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[\t\n] PASSED
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED
student-tests/unit/test_domain.py::test_password_rejects_invalid[] PASSED
student-tests/unit/test_domain.py::test_password_rejects_invalid[ ] PASSED
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxx] PASSED
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED
student-tests/unit/test_domain.py::test_password_rejects_invalid[\t\t\t\t\t\t\t\t\t\t\t\t] PASSED
student-tests/unit/test_domain.py::test_password_counts_code_points[xxxxxxxxxxxx] PASSED
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
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
student-tests/unit/test_domain.py::test_password_counts_code_points[\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b] PASSED
student-tests/unit/test_domain.py::test_password_is_not_printed PASSED
student-tests/unit/test_domain.py::test_session_token_is_opaque_and_stored_as_digest PASSED
student-tests/unit/test_domain.py::test_session_tokens_are_unique PASSED
student-tests/unit/test_domain.py::test_message_text_counts_code_points_not_bytes PASSED
student-tests/unit/test_domain.py::test_message_text_rejects_blank PASSED
student-tests/unit/test_domain.py::test_chat_requires_creator_in_members PASSED
student-tests/unit/test_domain.py::test_chat_rejects_duplicate_members PASSED
student-tests/unit/test_domain.py::test_chat_rejects_more_than_hundred_members PASSED
student-tests/unit/test_domain.py::test_receipt_replays_only_the_same_request PASSED
student-tests/unit/test_domain.py::test_posted_message_describes_itself PASSED
student-tests/unit/test_domain.py::test_user_registration_emits_event PASSED
student-tests/unit/test_domain.py::test_clock_is_strictly_increasing PASSED
student-tests/unit/test_timeouts.py::test_timeouts_shrink_inwards_and_shutdown_fits_the_stop_budget PASSED
===================== 240 passed, 10 deselected in 19.77s ======================
$ .venv/bin/pytest -s -q student-tests/api/test_drain.py student-tests/unit/test_timeouts.py # SIGTERM-окно и цепочка таймаутов
.окно: ready/live (503, 200), порт закрыт через 1.69 с, выход 2.11 с
.окно: ready/live (503, 200), порт закрыт через 1.74 с, выход 2.11 с
запрос, принятый до SIGTERM и дописанный после закрытия порта: HTTP/1.1 201 Created
.обнаружение 1.5 с (зависание 3.5 с), окно 2.0 с, остановка 5.0 с, хук 6.0 с, stop_grace_period 8.0 с; LB server 10.0 с > запрос 8.0 с > БД 3.0 с; readiness 0.8 с < check 1.0 с
.