# make test-failover ACTION_SCRIPT=scripts/stop-one.cmd (Windows equivalent of stop-one.sh), repeated until every replica was the target
# date: 2026-11-12T13:13:33Z; replicas: 4c764ef640a6 540fcfe80e6c 

## run 1
$ docker compose ps -a api (before)
grigoriev-lab3-api-1 4c764ef640a6 Up 21 seconds (healthy)
grigoriev-lab3-api-2 540fcfe80e6c Up 20 seconds (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 112, "failed_attempts": 0, "first_recovery_seconds": 4.313}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
$ docker compose ps -a api (after: target stays stopped)
grigoriev-lab3-api-1 4c764ef640a6 Up 38 seconds (healthy)
grigoriev-lab3-api-2 540fcfe80e6c Exited (0) 11 seconds ago
stopped replica: 540fcfe80e6c
restored 540fcfe80e6c (back in LB rotation)

## run 2 (one extra GET /health/live through LB first: shifts round robin so the other replica serves the test message)
$ docker compose ps -a api (before)
grigoriev-lab3-api-1 4c764ef640a6 Up 3 minutes (healthy)
grigoriev-lab3-api-2 540fcfe80e6c Up 22 seconds (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 110, "failed_attempts": 0, "first_recovery_seconds": 4.373}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
$ docker compose ps -a api (after: target stays stopped)
grigoriev-lab3-api-1 4c764ef640a6 Exited (0) 11 seconds ago
grigoriev-lab3-api-2 540fcfe80e6c Up 40 seconds (healthy)
stopped replica: 4c764ef640a6
restored 4c764ef640a6 (back in LB rotation)
# note: runs 2-6 of the first attempt repeated the same target (540fcfe80e6c) because the test sends a fixed number of requests before the message and round robin is deterministic
