--- id: "bug-1484" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "controller" severity: "unknown" timestamp: "2026-07-29T21:10:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/controller/ha.c (~6690-6711 heartbeat-reply vector", "~6805-6814 WAL-NACK vector); no test file drives either"] tags: ["ha.c", "raft_on_higher_term_observed", "repl_ack_decode_and_dispatch", "term-discovery", "bug-1421", "coverage-gap", "raft-adapter-conformance", "task-7.2", "found-not-yet-fixed", "pre-existing", "requirement-7.1", "requirement-7.2", "requirement-7.5"] related: ["bug-1421"] legacy: true --- # bug-1484: No test anywhere in src/controller/testsuite/ drives the real production dispatch path for either… ## Description No test anywhere in src/controller/testsuite/ drives the real production dispatch path for either term-discovery vector bug-1421 introduced (heartbeat-reply state-report term adoption, ha.c:6690-6711; WAL-NACK reply_term adoption inside repl_ack_decode_and_dispatch, ha.c:6805-6814) and asserts raft_on_higher_term_observed actually fires. The look-alike test_intake_higher_term_heartbeat_adopts_term (test_term_safety_adapter.c:1232) drives a different code path (ha_consume_append_entries -> raft_on_append_entries_request library-level UpdateTerm, an AE-request vector, not the AE-reply/state-report fallback bug-1421 added). test_persist_recovery.c (cited by design.md line 146 as covering this) has zero term-adoption content -- pure recovery mechanics. test_config_repl.c only covers the NEW config-push term vector added by this feature (Req 7.4), not the pre-existing heartbeat/WAL-NACK vectors. ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause bug-1421 (heartbeat-reply term-discovery fallback) shipped without a dedicated regression test asserting raft_on_higher_term_observed fires through the real repl_ack_decode_and_dispatch path for either vector -- found during raft-adapter-conformance task 7.2s regression-confirmation sweep, which searched the whole test suite (not just its own 8-file boundary) for `raft_on_higher_term_observed`/`higher_term` callers and found none exercising these two vectors end-to-end. ## Fix FIXED (2026-08-01) -- test-coverage gap closed, no production logic change (the underlying bug-1421 term-adoption code was already correct, just unverified end-to-end). Added test_term_adoption_vectors.c with two tests driving the real peer_ctrl_msg_handler -> repl_ack_decode_and_dispatch path (via peer_ctrl_msg_handler_for_test + standby_ep_ctx_build_for_test, c=NULL -- every c-dependent step downstream of the term check is already guarded): (a) test_heartbeat_state_report_higher_term_adopts_and_steps_down builds a wire-shape StateReport reply carrying a higher term and asserts raft_on_higher_term_observed adopts it and steps the node down from RAFT_LEADER (ha.c:6690-6711 vector); (b) test_wal_nack_higher_term_adopts_and_steps_down does the same for a WalAckReply{success=0} carrying a higher reply_term (ha.c:6805-6814 vector). Both went GREEN immediately, confirming Requirement 7.5's 'already verified' claim was correct in substance, just previously unverified by any test. Registered in meson.build controller_unit_test_src and controller_test.c. Full suite: 1071 -> 1073 Tests, 0 Failures. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1421