# 005 — Election Heartbeat on Admin Transition - Area: `main.go`, `pkg/election/*` - Priority: Medium ## Background Heartbeat loop starts only if this node is admin at startup. When admin changes via callback, role config is applied but no new heartbeat loop is launched. Risk: missed heartbeats post-takeover. ## Scope / Deliverables - Start/stop admin heartbeat within the election callback based on current winner. - Ensure single heartbeat goroutine per admin node; cleanly stop on demotion/shutdown. - Log state transitions and errors. ## Acceptance Criteria / Tests - In tests/sim, when admin role transfers, the new admin begins heartbeating within `HeartbeatTimeout/2`. - No duplicate heartbeats; demoted node stops sending heartbeats. ## Notes - Consider encapsulating heartbeat management inside `ElectionManager`.