Skip to content

Add single-node consensus trace validation mode - #8916

Draft
cjen1-msft wants to merge 1 commit into
cjen1-msft-fictional-broccolifrom
cjen1-msft-special-fortnight
Draft

cjen1-msft wants to merge 1 commit into
cjen1-msft-fictional-broccolifrom
cjen1-msft-special-fortnight

Conversation

@cjen1-msft

@cjen1-msft cjen1-msft commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #8925, which traces what a follower applies and a joiner's term history, and reads them in the reducer.

Adds --mode=single-node (with optional --node=NODE) alongside the existing complete mode (--mode=complete, the default). Complete mode, the global scheduler, all existing fixtures, and CI policy are unchanged.

In single-node mode, consensus-replay does not model the network and does not require a bootstrap node or other peers in the capture:

  • reduceNode reduces one node's event stream into its groups.
  • validateNode runs those groups on Consensus.Model.Node.step from the node's initial state, sharing the snapshot, send-matching, and input checks with complete mode.
  • Receive: builds nonempty AppendEntries batches from entries the node holds (up to the first term conflict) plus those it traced applying (execute_append_entries_sync), using placeholders for trailing unread entries that the model must not apply.
  • Join: uses the snapshot log built from init_as_backup's term history and snapshot hooks.
  • With --lenient, stops before a node's final group if that group is incomplete (the model queued sends the trace does not show); contradictions remain errors in either mode.

Multi-node partial mode (--mode=partial) and mid-trace cut support (--cut) are separate follow-up layers.

Verification
  • lake build --wfail (95 jobs, including ReplayDelivery), lake exe check-imports, and lake exe fmt --check pass.
  • Complete-mode fixture corpus: all 5 valid accepted, all 20 invalid rejected.
  • lean/consensus/replay/check-single-node.py passes: full trace (--mode=single-node, --mode=complete, --node=0, --node=1), lone-follower trace with no bootstrap node, repeated receive holding entries, torn final send/entry, join cut mid-rule, non-final incomplete rejection, untraced entry with ACK rejection, gap/mixed-view/wrong-sender/out-of-snapshot rejections, and bad flag combinations.
  • black, ruff, prettier, doc-newline-checks.sh, ascii-checks.sh, release-notes-checks.sh, and copyright-checks.sh pass.

@cjen1-msft cjen1-msft changed the title Validate consensus traces per node and compose clean captures Validate consensus traces per node Dec 2, 2026
@cjen1-msft
cjen1-msft changed the base branch from main to cjen1-msft-fictional-broccoli December 3, 2026 00:16
@cjen1-msft
cjen1-msft force-pushed the cjen1-msft-special-fortnight branch from 98ec14e to 397e17a Compare December 3, 2026 00:16
@cjen1-msft
cjen1-msft added this pull request to stack #8928 December 3, 2026 09:13
@cjen1-msft
cjen1-msft force-pushed the cjen1-msft-special-fortnight branch from 397e17a to b3d84b8 Compare December 3, 2026 11:13
Keep complete mode (the global scheduler) as the default and add --mode=single-node (with optional --node=NODE) to reduce and validate nodes independently on Consensus.Model.Node.step without modeling the network.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cjen1-msft
cjen1-msft force-pushed the cjen1-msft-special-fortnight branch from b3d84b8 to 1d533d4 Compare December 4, 2026 15:30
@cjen1-msft cjen1-msft changed the title Validate consensus traces per node Add single-node consensus trace validation mode Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant