# evidence/local-checks.txt — публичные и собственные проверки ЛР 3
# Среда подготовки (локально, БЕЗ Docker/Compose, БЕЗ HAProxy):
#   python   = Python 3.13.14
#   flask    = 3.1.0
#   postgres = PostgreSQL 17.12 (Debian 17.12-0+deb13u1)
#   DB       = lab3db @ 127.0.0.1:5432 (запущен заранее; НЕ пересоздавался)
#   LB       = временный локальный round-robin на 127.0.0.1:8080 (emulation HAProxy; бинарник haproxy в среде отсутствует)
#   реплики  = api1:127.0.0.1:8083, api2:127.0.0.1:8084 (каждый со своим X-Instance-Id)
#   pg_postmaster_start_time = 2026-11-16 21:35:40.472449+00 (без изменений: БД не перезапускалась)
#   PID      = api1 33056 / api2 31913 / lb 20527
#   captured_utc = 2026-11-16T23:02:16Z
# Все публичные тесты идут через LB 8080. Секреты в evidence не пишутся.

### Round-robin через LB 8080 (X-Instance-Id по 4 запросам)
  -> 93acbc9d-c445-4ab6-94ff-ca2292795dd9
  -> b10c4e9a-ffd1-4800-ac69-b486be9a0305
  -> 93acbc9d-c445-4ab6-94ff-ca2292795dd9
  -> b10c4e9a-ffd1-4800-ac69-b486be9a0305

$ /workspace/venv-labs/bin/python -m messenger.migrate
Migrations applied successfully (already applied versions skipped).

$ make check validate PYTHON=/workspace/venv-labs/bin/python
$ /workspace/venv-labs/bin/python scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
$ /workspace/venv-labs/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.

$ make student-test PYTHON=/workspace/venv-labs/bin/python
test_atomic_chat_and_migration_repeat (test_api.ApiTests.test_atomic_chat_and_migration_repeat) ... ok
test_authentication_and_logout (test_api.ApiTests.test_authentication_and_logout) ... ok
test_expiry_and_restart_app (test_api.ApiTests.test_expiry_and_restart_app) ... ok
test_idempotency_expiry_and_errors (test_api.ApiTests.test_idempotency_expiry_and_errors) ... ok
test_pagination_survives_new_app (test_api.ApiTests.test_pagination_survives_new_app) ... ok
test_strict_validation_and_private_chat (test_api.ApiTests.test_strict_validation_and_private_chat) ... ok

----------------------------------------------------------------------
Ran 6 tests in 4.424s

OK

$ make test BASE_URL=http://127.0.0.1:8080 PYTHON=/workspace/venv-labs/bin/python
$ /workspace/venv-labs/bin/python tests/smoke.py --base-url http://127.0.0.1:8080
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.

$ make test-idempotency BASE_URL=http://127.0.0.1:8080 PYTHON=/workspace/venv-labs/bin/python
$ /workspace/venv-labs/bin/python scripts/check_idempotency.py --base-url http://127.0.0.1:8080
PASS: 24 concurrent requests / 8 clients / 2 replicas -> one message; conflict, scopes, access and logout verified.

