Skip to content

raft: make isLogUpToDate swap-proof β€” LogPosition(term,index) value typeΒ #1254

Description

@keddie

πŸ€– This issue was generated by Claude on behalf of @keddie.

Hardening follow-up from the #1245 fix review (PR #1251). RaftLogMath.isLogUpToDate(ourLastTerm, ourLastIndex, candidateLastIndex, candidateLastTerm) orders the two sides oppositely β€” ours as (term, index), candidate as (index, term) (inherited from the wire-message field order). All current call sites are correct and VoteRestrictionSnapshotTest pins them, but a future caller swapping the two middle Longs compiles silently β€” in the vote-restriction path, a safety-critical function.

Fix: introduce a small LogPosition(term: Long, index: Long) value type (or use two same-ordered (term, index) pairs) so the compiler catches a swap. Low priority; ergonomic/future-proofing, not a current defect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    readyClear acceptance criteria, ready to implement

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions