Skip to content

raft-runtime: public RaftHost::status() accessor - #69

Open
chrischeng-c4 wants to merge 2 commits into
mainfrom
issue/42
Open

chrischeng-c4 wants to merge 2 commits into
mainfrom
issue/42

Conversation

@chrischeng-c4

Copy link
Copy Markdown
Contributor

Closes #42

Changes

  • Implemented pub async fn status(&self) -> RaftStatus on RaftHost in crates/raft-runtime/src/application/host/membership_ops.rs with doc comments noting it returns the point-in-time snapshot matching /raftz.
  • Relocated host_status(&Shared) -> RaftStatus next to RaftStatus in crates/raft-runtime/src/application/host/status.rs and re-exported it in crates/raft-runtime/src/interfaces/peer_http/status.rs, preserving the exact JSON shape and avoiding duplicate field mappings.
  • Registered and implemented integration tests in crates/raft-runtime/tests/it/host_status.rs (registered in tests/it/main.rs) covering leader, follower, and learner roles, verifying equivalence with /raftz over h2c.

Local Test Evidence

  • Compilation: cargo check -p raft-runtime --all-targets succeeded with 0 errors.
  • Formatting / Clippy: formatting verified with rustfmt --edition 2024; cargo clippy passed cleanly for all changed files.
  • Affected local unit tests: cargo test -p raft-runtime --test it -- raft_status_json_is_pinned passed (1 passed; 0 failed).

Cloud MR Validation (PENDING / NOT RUN)

Per the user's test policy, tests that launch clusters, Raft nodes, perform elections, or use HTTP/network interactions run exclusively in cloud CI:

  • host_status integration test suite (tests/it/host_status.rs): NOT RUN locally; PENDING cloud CI execution on the opened PR.
  • Full crate test suite (cargo test -p raft-runtime): PENDING cloud CI verification.

@chrischeng-c4

Copy link
Copy Markdown
Contributor Author

Summary of Repair for Issue #42

Diff Classification & Changes

  • Diff classification: Test fix for host_status::learner_status in crates/raft-runtime/tests/it/host_status.rs.
  • Root cause: In learner_status, the test configured a 3-node cluster and called demote_voter, which failed in CI with DemotionRefused::ToleranceWouldDrop { before: 1, after: 0 } because reducing a 3-voter cluster to 2 voters drops fault tolerance from 1 to 0.
  • Fix: Updated learner_status to use a 4-voter cluster (cluster(4)), matching membership_changes.rs where voter demotion retains fault tolerance of 1.

Local Validation Evidence

  • Compilation: cargo check -p raft-runtime --all-targets passed cleanly (0 errors).
  • Formatting: rustfmt --edition 2024 --check crates/raft-runtime/tests/it/host_status.rs passed cleanly.
  • Affected isolated unit test: cargo test -p raft-runtime --test it -- wire_golden::raft_status_json_is_pinned passed (1 passed, 0 failed).

Cloud MR Validation (PENDING / NOT RUN)

Per the user's test policy, tests that launch clusters, Raft nodes, perform elections, or use HTTP/network interactions run exclusively in cloud CI:

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.

raft-runtime: public RaftHost::status() accessor

1 participant