python student-tests/run_failover.py
hook: scripts/stop-one.cmd; api replicas: ['1c773748bc05', 'aa3dac85e7ed']

=== run 1: containers before (HAProxy: api1 UP, api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       1c773748bc05  running (healthy)    2026-10-15T16:32:38.776
api       aa3dac85e7ed  running (healthy)    2026-10-15T16:32:38.423
lb        f9c8bda9ea4c  running (healthy)    2026-10-15T16:32:39.190
migrate   7420f3f1ddda  exited               2026-10-15T16:32:47.434
postgres  5c16b9b684f2  running (healthy)    2026-10-15T16:35:06.670
valkey    c74935587700  running (healthy)    2026-10-15T16:34:57.760
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 125, "failed_attempts": 0, "first_recovery_seconds": 5.703}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
containers after (HAProxy: api1 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       1c773748bc05  running (healthy)    2026-10-15T16:32:38.776
api       aa3dac85e7ed  exited               2026-10-15T16:32:38.423
lb        f9c8bda9ea4c  running (healthy)    2026-10-15T16:32:39.190
migrate   7420f3f1ddda  exited               2026-10-15T16:32:47.434
postgres  5c16b9b684f2  running (healthy)    2026-10-15T16:35:06.670
valkey    c74935587700  running (healthy)    2026-10-15T16:34:57.760
the hook stopped aa3dac85e7ed (X-Instance-Id of that replica = container ID); other api containers, postgres, valkey and lb kept running
restored: docker start aa3dac85e7ed -> healthy and back in HAProxy (api1 UP, api2 UP)

=== run 2: containers before (HAProxy: api1 UP, api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       1c773748bc05  running (healthy)    2026-10-15T16:32:38.776
api       aa3dac85e7ed  running (healthy)    2026-10-15T16:36:08.417
lb        f9c8bda9ea4c  running (healthy)    2026-10-15T16:32:39.190
migrate   7420f3f1ddda  exited               2026-10-15T16:32:47.434
postgres  5c16b9b684f2  running (healthy)    2026-10-15T16:35:06.670
valkey    c74935587700  running (healthy)    2026-10-15T16:34:57.760
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 125, "failed_attempts": 0, "first_recovery_seconds": 4.843}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
containers after (HAProxy: api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       1c773748bc05  exited               2026-10-15T16:32:38.776
api       aa3dac85e7ed  running (healthy)    2026-10-15T16:36:08.417
lb        f9c8bda9ea4c  running (healthy)    2026-10-15T16:32:39.190
migrate   7420f3f1ddda  exited               2026-10-15T16:32:47.434
postgres  5c16b9b684f2  running (healthy)    2026-10-15T16:35:06.670
valkey    c74935587700  running (healthy)    2026-10-15T16:34:57.760
the hook stopped 1c773748bc05 (X-Instance-Id of that replica = container ID); other api containers, postgres, valkey and lb kept running
restored: docker start 1c773748bc05 -> healthy and back in HAProxy (api1 UP, api2 UP)

PASS: public failover test passed 2 times; every api replica was stopped once and restored
