myxce/.kiro/specs/raft-apply-decoupling
Rongsong Shen c005d40741 feat(raft-apply-decoupling): post-replay apply-correctness verification (task 5.1)
Add apply_verdict_t (APPLY_CLEAN/APPLY_DIVERGENT) computed alongside
the existing structural (CRC) recover_verdict_t. Dual-check design:
an entity-count check (WAL_JOB_SUBMIT entries scanned vs live jobmgr
growth, genuinely independent of apply_committed_entry()'s return
code) and a position check against a new last_applied_lsn field
(forward-looking infrastructure for task 6's live pump).

Fixes a real bug found during review: the position check's
expectation was computed from the physical WAL-scan tip
(current_lsn - 1), which advances past checkpoint markers and
unknown entry types that never reach apply_committed_entry(). A
crash between persist_checkpoint()'s marker-fsync step and its
later snapshot-persist step leaves a trailing checkpoint marker on
next boot, which falsely reported APPLY_DIVERGENT on a perfectly
clean recovery -- reachable today, not gated behind a future task.
Fixed by reading last_applied_lsn directly, which only advances for
entries actually dispatched through the apply seam.

Known accepted gap: entity-count check covers jobs only, not
workers (which can genuinely be created via WAL_WORKER_CTRL) --
documented for future extension.
2026-07-04 11:32:21 +00:00
..
brief.md docs: promote raft-apply-decoupling spec family from /kiro-discovery 2026-07-03 02:41:11 +00:00
design.md feat(raft-apply-decoupling): commit engine resolve primitive + majority-ack wiring (task 1.2) 2026-07-03 09:03:50 +00:00
facts-in-raft.md docs: promote raft-apply-decoupling spec family from /kiro-discovery 2026-07-03 02:41:11 +00:00
requirements.md docs(raft-apply-decoupling): add requirements, design, and task plan 2026-07-03 07:05:28 +00:00
research.md docs(raft-apply-decoupling): add requirements, design, and task plan 2026-07-03 07:05:28 +00:00
spec.json docs(raft-apply-decoupling): add requirements, design, and task plan 2026-07-03 07:05:28 +00:00
tasks.md feat(raft-apply-decoupling): post-replay apply-correctness verification (task 5.1) 2026-07-04 11:32:21 +00:00