docs(raft-sim-conformance): cosmetic cleanups (LOW review nits)

- sim_tla_action_name: drop brittle per-case 'raft.tla:NNN' line-number comments
  (some had drifted a few lines off; the return string IS the stable raft.tla
  Next-disjunct name, and the function header already cites raft.tla:454).
- test_sim_5_1_partition_heal: the per-follower convergence loop was vacuous —
  it bounded by commit_index, which stays 0 for followers under the leader-only
  commit model, so the loop never ran. Bound by log_count instead (followers DO
  advance the replicated log); Log Matching still guarantees the shared-prefix
  terms agree. Now non-vacuous; still passes.

Test/comment-only; no behavior change. Lib suite Ok:1 Fail:0.
This commit is contained in:
Rongsong Shen 2026-06-25 04:38:43 +00:00
parent 0e8b4a12bf
commit 6563adf8c6
2 changed files with 24 additions and 16 deletions

View file

@ -8229,22 +8229,27 @@ static void test_sim_5_1_partition_heal(void)
"post-heal cluster does not have exactly one leader");
/* Convergence is observable: the leader committed a non-trivial prefix, and
* every (formerly-isolated) node's committed entries match the leader's at the
* same index/term over their shared committed prefix. */
* every (formerly-isolated) node's REPLICATED LOG matches the leader's at the
* same index/term over their shared log prefix. NOTE: this library uses a
* leader-only commit model (a follower's commit_index does not advance from
* AppendEntries — see Implementation Notes), so followers end at commit_index=0;
* bounding by commit_index would make this loop vacuous. Bound by log_count
* instead, which followers DO advance via replication — Log Matching (asserted
* each step via raft_sim_check_all) guarantees the shared-prefix terms agree. */
TEST_ASSERT_TRUE_MESSAGE(c.nodes[leader_idx].commit_index > 0,
"leader never committed any entry across the scenario");
for (int i = 0; i < c.n; i++) {
if (i == leader_idx)
continue;
uint64_t shared = c.nodes[i].commit_index;
if (shared > c.nodes[leader_idx].commit_index)
shared = c.nodes[leader_idx].commit_index;
uint64_t shared = (uint64_t)c.nodes[i].log_count;
if (shared > (uint64_t)c.nodes[leader_idx].log_count)
shared = (uint64_t)c.nodes[leader_idx].log_count;
for (uint64_t e = 1; e <= shared; e++) {
TEST_ASSERT_EQUAL_UINT64_MESSAGE(
c.nodes[leader_idx].log[e - 1].term,
c.nodes[i].log[e - 1].term,
"formerly-isolated node diverges from leader committed prefix");
"formerly-isolated node diverges from leader's replicated log prefix");
}
}
}