[IRRIGOAPI-116] Add boot-time HA readiness probe to prevent false alerts #14

Merged
chris merged 3 commits from feature/IRRIGOAPI-116 into main 2026-08-19 08:39:37 -06:00
Owner

Ticket

IRRIGOAPI-116 Boot-time valve reconcile races Home Assistant startup, causing false ha-call-failed alert

Summary

  • Adds waitForHaReady() to the HA data layer: polls GET <HA_URL>/api/ every 2 s until HA responds 2xx or HA_BOOT_TIMEOUT_MS elapses (default 30 s)
  • Calls waitForHaReady() at the start of runBootSequence, before reconcileCycleAndRelayState, so the reconcile sweep only runs once HA is actually listening
  • Never throws — if HA does not come up in time, boot continues and any genuine errors are still alerted normally
  • Also wires loadInFlightCycles from the injected scheduleEntriesRepo directly into the reconciler, removing a dependency on module-level state and making boot tests runnable in isolation
## Ticket [IRRIGOAPI-116](http://192.168.2.100:7123/home/browse/IRRIGOAPI-116/) Boot-time valve reconcile races Home Assistant startup, causing false ha-call-failed alert ## Summary - Adds `waitForHaReady()` to the HA data layer: polls `GET <HA_URL>/api/` every 2 s until HA responds 2xx or `HA_BOOT_TIMEOUT_MS` elapses (default 30 s) - Calls `waitForHaReady()` at the start of `runBootSequence`, before `reconcileCycleAndRelayState`, so the reconcile sweep only runs once HA is actually listening - Never throws — if HA does not come up in time, boot continues and any genuine errors are still alerted normally - Also wires `loadInFlightCycles` from the injected `scheduleEntriesRepo` directly into the reconciler, removing a dependency on module-level state and making boot tests runnable in isolation
Polls GET <HA_URL>/api/ until HA responds 2xx (or HA_BOOT_TIMEOUT_MS elapses).
Never throws — boot continues on timeout with a warning. Configurable via
HA_BOOT_TIMEOUT_MS env var (default 30 s).
Calls waitForHaReady() before reconcileCycleAndRelayState so HA startup
races no longer produce false ha-call-failed alerts. Also passes
loadInFlightCycles from the injected scheduleEntriesRepo so the boot
reconcile no longer relies on module-level daemon state (makes boot
tests runnable in isolation).
[IRRIGOAPI-116] Address pre-PR review.
All checks were successful
plane-sync / sync (pull_request) Successful in 1s
bba1b96bdc
Expose waitForHaReady in DaemonOptions so start() tests can supply a
no-op; set HA_URL/HA_TOKEN in daemon test beforeEach so the real probe
can resolve via the existing mockFetch stub without touching HA.
chris merged commit b115f2beaf into main 2026-08-19 08:39:37 -06:00
chris deleted branch feature/IRRIGOAPI-116 2026-08-19 08:39:37 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
chris/irrigo!14
No description provided.