test(raft-ha-core-safety): harness infrastructure + payload-loss smoke-RED (task 1.4)

New test_ha_core_safety.c with deterministic gate/probe seams (no sleeps,
drain-before-fini per bug-1224): payload-controllable WAL writer, on-disk
(term,pcrc,len) readback probe, walcompare observer, apply-gap + kill/
election injection for phases 2.3/4.1/5.1. Smoke-RED (Expected 64 Was 0)
proves the payload-blind (term,lsn)-only guard at persist.c:822 drops a
corrective full-payload write at a committed LSN. 5 tests/1 RED/4 seam
PASS, no ASAN errors.
This commit is contained in:
Rongsong Shen 2026-06-27 09:49:51 +00:00
parent 9e55f09274
commit dc50924833
4 changed files with 415 additions and 1 deletions

View file

@ -25,7 +25,7 @@
- _Requirements: 7.1, 1.1_
- _Boundary: Deterministic Chaotic Harness_
- [ ] 1.4 Stand up the unit/integration harness infrastructure
- [x] 1.4 Stand up the unit/integration harness infrastructure
- Create `test_ha_core_safety.c` with the deterministic gate/probe seams (no sleeps; teardown drains pending delaymgr tasks to avoid the bug-1224 teardown-race UAF), the `(term, lsn)`/apply-gap/kill-injection fixtures, and register it in the controller unit-test build; include one smoke-RED case proving the harness can observe a divergence. The per-defect RED bodies are owned by their phases (2.3 ingest, 4.1 reconvergence, 5.1 election) — this task provides the shared seams they build on, not those cases
- Observable completion: `test_ha_core_safety` builds and runs, the injection fixtures and probe seams are usable by later phases, and the smoke-RED case FAILs on the baseline with no ASAN teardown errors
- _Requirements: 7.1, 7.4_