# 2026-10-30, ветка solution/bpi2303-moraru, Apple M3 Pro (11 ядер, 18 GiB) / OrbStack, LB_PORT=8094
# Финальный прогон после всех изменений (read_only rootfs, фоновая компенсация «строка → объект», таймауты S3).
$ npm run typecheck
> tsc

$ make check
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
$ make validate PYTHON=.venv/bin/python
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
$ make test BASE_URL=http://localhost:8094
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.

$ python3 student-tests/idempotency_race.py --base-url http://localhost:8094 --parallel 64
{"parallel": 64, "replicas_hit": 2, "created_201": 32, "conflict_409": 32, "stored_messages": 1}
PASS: concurrent same-key POSTs through different replicas created exactly one message

$ make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://localhost:8094
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
took 53 s
# StartedAt до/после: persistence-before.txt / persistence-after.txt — изменился у 9 из 9 контейнеров
# (lb, api-1, api-2, reconciler, postgres, seaweedfs, s3 и повторённые one-shot migrate, s3-init).

$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://localhost:8094
# между прогонами: docker compose start api; лишний curl /health/live сдвигает round-robin, чтобы целью стала другая реплика
run 1: {"observed_instances_before": 2, "successful_writes": 63, "failed_attempts": 0, "first_recovery_seconds": 6.217} PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.  | messenger-lab4-api-1=running messenger-lab4-api-2=exited 
run 2: {"observed_instances_before": 2, "successful_writes": 66, "failed_attempts": 0, "first_recovery_seconds": 4.659} PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.  | messenger-lab4-api-1=exited messenger-lab4-api-2=running 
run 3: {"observed_instances_before": 2, "successful_writes": 102, "failed_attempts": 0, "first_recovery_seconds": 3.903} PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.  | messenger-lab4-api-1=running messenger-lab4-api-2=exited 
# resilience.py (LAB>=4) загружает sample.png до отказа и после остановки реплики скачивает его через оставшуюся,
# сравнивая байты. Лог lb в момент отказа (api1…api8 — слоты server-template, их заполняет DNS, номер слота не равен
# номеру контейнера; на каждый отказ две записи: readiness 503 во время drain, затем отказ соединения после выхода):
lb-1  | Server api/api1 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 2ms. 1 active and 0 backup servers left. 1 sessions active, 0 requeued, 0 remainin
lb-1  | Server api/api1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in q
lb-1  | Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remainin
lb-1  | Server api/api2 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in q
lb-1  | Server api/api1 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 7ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remainin
lb-1  | Server api/api1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 1ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in q
