feat(ha-prevote): implement pure voter-side PreVote decision (task 2.1)
raft_on_pre_vote_request: deny on stale term, else reuse on_vote_eligible (primary/heartbeat-stickiness/catch-up gates). Never mutates term/voted_for/ role and never persists or adopts a higher term. 6 RED-first raft unit tests assert the purity invariant; libxce suite green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
449b8e9e93
commit
722fee5323
3 changed files with 249 additions and 1 deletions
|
|
@ -16,7 +16,7 @@
|
|||
- _Boundary: raft pre-vote functions_
|
||||
|
||||
- [ ] 2. Core: raft-library pure PreVote decision and tally (test-first, no side effects)
|
||||
- [ ] 2.1 Implement the voter-side PreVote decision
|
||||
- [x] 2.1 Implement the voter-side PreVote decision
|
||||
- RED first: add raft unit tests asserting grant for a fresh, higher-or-equal-term candidate when the eligibility callback allows it, and deny on stale term or when the eligibility callback rejects.
|
||||
- Reuse the existing vote-eligibility callback (primary-deny, fresh-heartbeat stickiness, catch-up deny) and let the dispatcher apply freshness beforehand, exactly as the real-vote path does.
|
||||
- Observable: after a granted PreVote the test confirms term, voted-for, and role are all unchanged and no persist callback fired.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue