test(raft-ha-core-safety): payload-aware persist-guard RED + pins (task 2.1)

Case (a) empty-then-full = genuine RED (payload-blind guard at persist.c:822
no-ops the corrective write, Expected 64 Was 0). Cases (b) full-then-empty
and (c) identical-rewrite = baseline-passing pins that constrain the 2.2
fix asymmetry (empty must never overwrite stored full; identical re-stream
stays idempotent). 7 tests/1 RED/no ASAN.
This commit is contained in:
Rongsong Shen 2026-06-27 10:20:02 +00:00
parent 07f08e58f5
commit 3b5eda1429
2 changed files with 119 additions and 2 deletions

View file

@ -40,7 +40,7 @@
- [ ] 2. Committed-prefix divergence fix: cross-term catch-up payload integrity + payload-aware guard
- _Root cause (task 1.3, verified): the cross-term catch-up streamer silently ships `PLEN=0` on a short `pread`/`malloc`-fail, and the `(term,lsn)`-only persist guard is payload-blind. Term and ingest-path are correct — the payload is lost._
- [ ] 2.1 RED: payload-aware persistence guard tests
- [x] 2.1 RED: payload-aware persistence guard tests
- Add cases: an empty-payload (`PLEN=0`) entry written at an existing LSN N followed by the correct full-payload entry must end with the FULL payload (today the `(term,lsn)`-only idempotency guard silently no-ops the corrective write); the reverse (full then empty at the same `(term,lsn)`) must NOT degrade the stored entry to empty; an identical `(term, payload-crc)` re-write is a safe idempotent no-op
- Observable completion: the new persistence cases FAIL on the baseline because the guard compares only `(term, lsn)` and cannot see the payload difference
- _Requirements: 1.1, 1.2, 2.1, 2.2, 3.1, 3.4_