How the operator decides
Under the failover machinery there is a two-second poll loop and a small table. The loop turns each site into one of four states with a debounce in front of it; the table turns the set of states into exactly one action. This unit teaches you to run that table in your head, then read the same decision back out of the logs and the metrics so you are never guessing what the operator is about to do. Knowing the table is not the same as knowing the timing — Unit 3 holds a site down and puts a clock on it.
Topics
Unit test
Quick check: can you compute the 6s detection delay from pollInterval and failureThreshold, name the Reason string for a group with one writable and one unreachable site, and say what the anti-flap cooldown will not stop?
Project
brdecide — the failover predictor
(Optional — see the brief for the shorter jq route and what skipping it costs you.) Build a tool that takes a failover-group status plus a clock and prints the decision the operator would take — the action, the alert, the Reason string, and whether cooldown will let it run. Check your own mental model against the real table now, on your terms, instead of at 3am while an incident checks it for you.