test(ha-commit-engine): full regression green + legacy-path audit (task 6.1)

Fixed the 3 bug-411 baseline failures honestly: stale timeout
expectation updated to the reject-on-timeout contract (engine-wired
fixture, killing power retained); two healthy-primary gate fixtures
populated with standby_endpoints (gate logic untouched). Census: 46
groups / 467 tests / 0 failures standalone under default ASAN.
Audit (reviewer-confirmed, recorded in tasks.md): no production walAck
path reaches the deprecated acked_lsn>0 counting or n_active==0
short-circuit except the documented LSN-0 first entry. Leak inventory
for 6 groups documented as follow-up.
This commit is contained in:
Rongsong Shen 2026-06-12 03:32:19 +00:00
parent f0d6074d4e
commit 95a10cedf3
6 changed files with 785 additions and 295 deletions

View file

@ -386,6 +386,8 @@ static void test_rdhup_committing_fires_replication_hooks(void)
* ═════════════════════════════════════════════════════════════════════════ */
static void test_rdhup_primary_dispatch_gate_opens(void)
{
static int dummy_ep; /* stands in for the ACKing standby's endpoint */
install_stubs();
cluster_t c;
@ -397,6 +399,19 @@ static void test_rdhup_primary_dispatch_gate_opens(void)
c.ha.phase2_done = 1;
c.ha.n_peers = 1;
/* FIXTURE FIX (ha-commit-engine task 6.1, bug-411 baseline failure):
* ha_on_primary_ctrl_fd_rdhup re-derives ha->n_peers from
* myconf->peers_cfg.candidates_count (= 2 here), so the CTRL_PRIMARY
* dispatch gate requires write quorum: >= 1 connected standby. The
* ack below models a standby that connected and ACKed; in production
* it lives in ha->standby_endpoints (raft_cb_become_leader /
* on_standby_connected). Register it so quorum legitimately holds on
* this healthy primary — the gate itself must NOT be weakened. */
c.ha.standby_endpoints = calloc(1, sizeof(zarray_t));
TEST_ASSERT_NOT_NULL(c.ha.standby_endpoints);
zarray_init(c.ha.standby_endpoints, 4, NULL);
zarray_store(c.ha.standby_endpoints, &dummy_ep);
g_rdhup_state.c = &c;
ha_rdhup_election_hook = rdhup_election_drives_evaluate;
@ -423,6 +438,9 @@ static void test_rdhup_primary_dispatch_gate_opens(void)
"OPCode_jobdispatch must be allowed by dispatch gate in CTRL_PRIMARY (Req 5.3)");
clear_stubs();
zarray_fini(c.ha.standby_endpoints);
free(c.ha.standby_endpoints);
c.ha.standby_endpoints = NULL;
ha_fini(&c.ha);
printf("test_rdhup_primary_dispatch_gate_opens: PASS (gate accepts job ops)\n");
}