fix: types: honour AddNode.overriding and stop stamping the unused time_ms #13
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 276 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #13"
general
weight: 0.35
lichuang
Finding
P2 — a command field that changes behaviour is ignored, and a log field that
nothing reads is stamped with a misleading contract.
Two dead/lying pieces of the state-machine input:
1.
Cmd::AddNode { node, overriding }is documented as "Whether to overrideexisting record", but
apply_add_nodeignored it and always calledadd_node, which overwrites(
src/raft/store/statemachine.rs,apply_cmd/apply_add_node).LeaderHandler::add_nodewrites the sync of existing members withoverriding: trueand the joining node withoverriding: false, so the twocases were meant to differ.
2.
LogEntry::time_msis set on every write(
do_write:entry.time_ms = Some(now_millis())) and read by nobody — theTTL support that used it was deleted. Its doc still claims "State machine
depends on clock time to expire values. The time to use has to be consistent
on leader and followers. Otherwise an
applyresults in different state onleader and followers." — a description of a determinism hazard that no
longer exists, attached to a value that costs bytes in every log entry.
How to reproduce
For
time_ms:grep -rn 'time_ms' src/shows one writer and zero readers.The fix
apply_add_node(node, overriding)inserts only whenoverridingis true orthe node is not in the table yet, matching the flag's documentation and
databend's semantics for the same command.do_writeno longer stampstime_ms; entries written now carryNone.The field itself stays: log entries already persisted in RocksDB were
encoded with it, so dropping it would make existing logs undecodable. Its doc
now says it is reserved and not consumed, and warns that a leader-stamped clock
must never drive
apply().Test:
test_apply_add_node_honours_overridingcovers both flag values.