feat(ha-config-bootstrap): implement ha_restore_term() for ha-term.bin read path (task 6.2)

This commit is contained in:
Rongsong Shen 2026-05-28 13:21:36 +00:00
parent 722d7824c4
commit 7c27ff1954
3 changed files with 91 additions and 1 deletions

View file

@ -140,7 +140,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
- `make test` fails
- _Requirements: 9.1, 9.2, 9.3_
- [ ] 6.2 Implement ha_init() restore path for ha-term.bin
- [x] 6.2 Implement ha_init() restore path for ha-term.bin
- Read `{workdir}/ha-term.bin` in `ha_init()` at startup; verify magic and CRC32; on match → restore `ha.term` and `ha.voted_for_*`; on missing → term=0 (3rd boot); on CRC mismatch → log WARN, initialize to term=0
- `ha_persist_term()` already implemented in task 4.2; this task only adds the read-path to `ha_init()`
- `make test` GREEN on all durability tests