Skip to content

Model Raft leadership nomination edge cases - #8126

Open
Amaury Chamayou (achamayou) wants to merge 13 commits into
mainfrom
achamayou/late-nomination-tla
Open

Model Raft leadership nomination edge cases#8126
Amaury Chamayou (achamayou) wants to merge 13 commits into
mainfrom
achamayou/late-nomination-tla

Conversation

@achamayou

@achamayou Amaury Chamayou (achamayou) commented Aug 6, 2026

Copy link
Copy Markdown
Member

Align the TLA+ consensus model and C++ tracing with leadership nomination edge cases.

Changes

  • Ignore a stale ProposeVoteRequest when its term differs from the recipient current term.
  • Add late_nomination, where a node advances to term 3 before receiving a term-2 nomination and remains a candidate.
  • Emit step_down_and_nominate_successor tracing only when an explicit nomination selects a successor and sends ProposeVoteRequest.
  • Add nominate_without_successor, where a single-node leader remains leader and queues no proposal or nomination trace event.
  • Keep these model-dependent scenarios separate from Expand Raft driver scenario coverage #8122 following review feedback.

Validation

  • Both tracing-enabled and tracing-disabled raft_driver builds pass.
  • All 44 scenarios on this branch plus the eight additional scenarios from Expand Raft driver scenario coverage #8122 execute successfully and pass TLC trace validation.
  • late_nomination emits one explicit nomination event; nominate_without_successor emits none.
  • Combined with Expand Raft driver scenario coverage #8122, whole-binary coverage moves from 50.89% to 50.95% for lines and 64.52% to 64.78% for branches; focused Raft/driver coverage moves from 79.74% to 79.86% for lines and 68.06% to 68.37% for branches.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Raft TLA+ consensus model so ProposeVoteRequest (leadership nomination) messages are ignored and discarded when their term does not match the recipient’s currentTerm, matching the C++ implementation, and adds a deterministic Raft-driver scenario to exercise this case.

Changes:

  • Exclude ProposeVoteRequest from UpdateTerm, preventing term advancement due to nomination messages.
  • Update RcvProposeVoteRequest to explicitly discard mismatched-term nominations while leaving node state unchanged.
  • Add tests/raft_scenarios/late_nomination to validate that a delayed, stale nomination does not restart candidacy.

Custom instructions used:

  • .github/copilot-instructions.md
  • .github/instructions/reviewing.instructions.md

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tla/consensus/ccfraft.tla Aligns the TLA receive/update-term logic with C++ behavior for stale ProposeVoteRequest nominations.
tests/raft_scenarios/late_nomination Adds a deterministic scenario where a delayed term-2 nomination arrives after the recipient advances to term 3, and must be ignored.

@achamayou Amaury Chamayou (achamayou) added run-long-verification Run Long Verification jobs tla TLA+ specifications READY TO MERGE labels Aug 6, 2026
@achamayou Amaury Chamayou (achamayou) changed the title Handle stale leadership nominations in the Raft TLA model Model Raft leadership nomination edge cases Aug 6, 2026
@achamayou
Amaury Chamayou (achamayou) marked this pull request as draft August 6, 2026 16:10
@achamayou
Amaury Chamayou (achamayou) marked this pull request as ready for review August 7, 2026 10:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comment thread src/consensus/aft/raft.h
…t path

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Comment thread tla/consensus/ccfraft.tla Outdated
Comment thread src/consensus/aft/raft.h
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

READY TO MERGE run-long-verification Run Long Verification jobs tla TLA+ specifications

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants