myxce/.kiro/specs/raft-ha-core-safety
Rongsong Shen 806257afcf test(raft-ha-core-safety): RED tests for election liveness & safety under churn (task 5.1)
Add three Phase-5 cases to test_ha_core_safety.c pinning the spurious-failover
root cause (research.md §"Phase 4/5"):

- CORE RED test_5_1_spurious_failover_suppressed_while_primary_alive: a
  control-channel flap (transient RDHUP) while a current-term primary is alive
  (fresh heartbeat) must NOT launch a PreVote failover. FAILs on baseline
  (Expected 0 Was 5) — the RDHUP-initiation path (ha_on_primary_ctrl_fd_rdhup
  -> ha_begin_failover -> ha_start_prevote_async synchronous branch) has no
  ha_heartbeat_is_fresh guard, unlike the deferred ha_failover_stagger_fn path.
  GREEN when task 5.2 adds that guard.

- LIVENESS test_5_1_genuine_loss_elects_and_advances_term: genuine loss (stale
  heartbeat) still launches a real failover; a failed round re-arms; rapid
  rounds advance the term. Guards 5.2 against over-suppression (Req 6.1/6.2/6.3).

- SAFETY test_5_1_election_safety_one_primary_per_term: two candidates contest
  the same term; the real handle_request_vote grants at most one vote per term
  (A=3/B=0), so at most one committing primary per term. Falsifiable Election
  Safety check mapped to raft/raft.tla (Req 4.1/4.3).

Deterministic (no sleeps; clock reads only), c==NULL unit-test mode, clean
ha_fini teardown. test_ha_core_safety suite: 17 Tests / 1 Failure (the
intended RED); all 2.x/4.x/seam cases still pass; no new ASAN leaks.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dbTHR9CsEYK9RsqmQpQpC
2026-06-30 00:22:33 +00:00
..
design.md docs(raft-ha-core-safety): retarget Phase 4/5 to RDHUP-flap root cause 2026-06-28 03:24:12 +00:00
requirements.md docs(raft-ha-core-safety): finalize spec (requirements, design, research, tasks) 2026-06-27 04:37:07 +00:00
research.md research(raft-ha-core-safety): Phase-4/5 stall root cause — RDHUP-flap spurious failover 2026-06-28 03:12:45 +00:00
spec.json docs(raft-ha-core-safety): finalize spec (requirements, design, research, tasks) 2026-06-27 04:37:07 +00:00
tasks.md test(raft-ha-core-safety): RED tests for election liveness & safety under churn (task 5.1) 2026-06-30 00:22:33 +00:00