$ npm run build
npm warn Unknown env config "http-proxy". This will stop working in the next major version of npm.

> mtusi-messenger-lab3@1.0.0 build
> npm run generate && tsc -p tsconfig.json

npm warn Unknown env config "http-proxy". This will stop working in the next major version of npm.

> mtusi-messenger-lab3@1.0.0 generate
> tsoa routes

$ docker-compose config --quiet
$ make check
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
The files belonging to this database system will be owned by user "agent".
This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /workspace/scratch/503693051415/runtime/state3/database ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Europe/Moscow
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    /workspace/scratch/503693051415/runtime/pg/usr/lib/postgresql/15/bin/pg_ctl -D /workspace/scratch/503693051415/runtime/state3/database -l logfile start

waiting for server to start.... done
server started
PostgreSQL started pid=88
Applied 001_core.sql
Applied 002_idempotency.sql
Migrations up to date
api-a started pid=112 on TCP 18081
api-b started pid=113 on TCP 18082
[NOTICE]   (114) : config : [infra/haproxy.cfg:31] : 'server api/api-a' : could not resolve address 'api-a', disabling server.
[NOTICE]   (114) : config : [infra/haproxy.cfg:32] : 'server api/api-b' : could not resolve address 'api-b', disabling server.
lb started pid=129
$ make test
python3 tests/smoke.py --base-url "http://localhost:8080" 
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
$ python3 student-tests/auth_and_chat.py
PASS: UTF-8 password with colon, strict JSON, and atomic chat creation
$ python3 student-tests/idempotency.py
PASS: 16 concurrent requests on 2 replicas yielded one message
$ make test-persistence ACTION_SCRIPT=<local process restart>
python3 tests/resilience.py --mode persistence --action-script "/workspace/scratch/503693051415/runtime/replicated-local.sh" --base-url "http://localhost:8080" 
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
lb stopped pid=129
api-a stopped pid=112
api-b stopped pid=113
PostgreSQL stopping pid=88
waiting for server to shut down.... done
server stopped
waiting for server to start.... done
server started
PostgreSQL started pid=239
Migrations up to date
api-a started pid=261 on TCP 18081
api-b started pid=262 on TCP 18082
[NOTICE]   (263) : config : [infra/haproxy.cfg:31] : 'server api/api-a' : could not resolve address 'api-a', disabling server.
[NOTICE]   (263) : config : [infra/haproxy.cfg:32] : 'server api/api-b' : could not resolve address 'api-b', disabling server.
lb started pid=278
$ make test-failover ACTION_SCRIPT=<local targeted process stop>
python3 tests/resilience.py --mode failover --action-script "/workspace/scratch/503693051415/runtime/stop-replica-local.sh" --base-url "http://localhost:8080" 
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 125, "failed_attempts": 8, "first_recovery_seconds": 0.231}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
api-a stopped pid=261
lb stopped pid=278
api-b stopped pid=262
PostgreSQL stopping pid=239
waiting for server to shut down.... done
server stopped
