Skip to content

A1-6: Fix broadcastProposal — replace simulation stub with real UDP broadcast #133

Closed as not planned

Description

@scttfrdmn

Context

broadcastProposal in internal/distributed/consensus.go:754 contains:

// For simulation, automatically accept our own proposals after a delay
go func() {
    time.Sleep(100 * time.Millisecond)
    ce.voteOnProposal(proposal.ID, true)
}()

This means configuration change proposals are never sent to other nodes. The proposal system is completely non-functional in a real cluster — only self-accepting proposals on a single node.

What to implement

Add to internal/distributed/gossip.go:

MessageTypeProposal     MessageType = "proposal"
MessageTypeProposalVote MessageType = "proposal_vote"

type ProposalVoteMessage struct {
    ProposalID string `json:"proposal_id"`
    NodeID     string `json:"node_id"`
    Accept     bool   `json:"accept"`
}

Replace broadcastProposal implementation:

  1. Marshal the ConsensusProposal as the gossip message data
  2. Call ce.cluster.gossip.sendConsensusMsg(node.Address, MessageTypeProposal, proposal) for each alive peer (mirrors the pattern in sendVoteRequests)
  3. Vote for the local node immediately via ce.voteOnProposal(proposal.ID, true) — no goroutine, no sleep
  4. Remove the simulation goroutine entirely

Add handleNetworkProposal(msg *GossipMessage) in consensus.go:

  • Unmarshal the proposal
  • Call ce.voteOnProposal with the local decision (for now, always accept — byzantine fault tolerance is future work)
  • Send a ProposalVoteMessage back to the proposer

Add handleNetworkProposalVote(msg *GossipMessage):

  • Unmarshal the vote
  • Call ce.voteOnProposal(proposalID, vote.Accept) with the voter's identity

Register both handlers in gossip.go's handleIncomingMessage switch.

Acceptance criteria

  • broadcastProposal sends UDP to all alive peers
  • Simulation goroutine with time.Sleep is removed
  • Two-node integration test: node A proposes a leadership change, node B's vote is received and counted
  • go test -race ./internal/distributed/... passes

Sequencing

Depends on A1-2 (new message types should align with the canonical ConsistencyLevel promotion, though not strictly required).

Activity

  1. added
    type: bug
    priority: high
    area: distributed
    on Apr 7, 2026
  2. added
    effort: medium
    on Aug 3, 2026
  3. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Closing as not-the-direction, per the decision on #169 — but with a caveat worth reading, because this issue is half real.

    §5 of docs/design/conditional-writes-vs-raft.md puts it precisely: "Proposals are a consensus concept; gossip still needs real broadcast for membership, so the networking work survives even though the proposal framing does not."

    So the defect this issue reports is genuine — broadcastProposal really is a time.Sleep(100ms) that self-accepts and sends nothing. What goes away is the thing being broadcast. There are no proposals to carry once there is no replicated log to change membership through, so MessageTypeProposal/MessageTypeProposalVote and ConsensusProposal are not being wired up.

    The surviving half — real gossip broadcast to alive peers — is already in place and has been exercised since: #279 got a three-node cluster forming and electing a single leader race-free, and #280 fixed the datagram size ceiling that was silently truncating the memberlist sync (the default held two members). sendConsensusMsg and the sendVoteRequests pattern this issue points at as the model are real, working code.

    If the simulation stub is still sitting in consensus.go after the CAS work replaces executeStrongConsistency, it should be deleted rather than fixed — filed as part of the taxonomy cleanup issue.

    Reference: https://github.com/scttfrdmn/objectfs/blob/main/docs/design/conditional-writes-vs-raft.md

  4. added
    resolution: wontfix
    on Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: distributedeffort: mediumpriority: highresolution: wontfixtype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions