feat(ha-heartbeat-liveness): add validate_heartbeat_config startup check (task 1.2)

Enforce heartbeat_timeout_ms >= 2 * heartbeat_interval_ms at startup.
validate_heartbeat_config() in startup_validation.c returns -EINVAL with
error message on violation; wired in cluster_init_phase1 before ha_init().
4 unit tests added to test_ha_startup.c.
This commit is contained in:
Rongsong Shen 2026-06-01 12:26:29 +00:00
parent bcb45e59d2
commit 9f9a6b3c0f
4 changed files with 129 additions and 4 deletions

View file

@ -8,7 +8,7 @@
- Observable: project builds; `ha_init()` test verifies `last_activity == 0` after init
- _Requirements: 1.1, 1.3, 3.1_
- [ ] 1.2 Add heartbeat timing validation at startup
- [x] 1.2 Add heartbeat timing validation at startup
- Implement `validate_heartbeat_config(heartbeat_timeout_ms, heartbeat_interval_ms, err_buf, err_len)` in `startup_validation.c`
- Returns `-EINVAL` when `heartbeat_timeout_ms < 2 * heartbeat_interval_ms`; writes human-readable error into `err_buf`
- Wire call into `main.c` after `ha_config_t` is populated, before `ha_init()`