Commit Graph

2 Commits (feat/phase-1-bootstrap)

Author SHA1 Message Date
HomeOS Bootstrap 3ed49ee882 fix(automations): honor conditions + atomic cooldown claim (R15)
Codex R15 flagged two P1 correctness bugs in AutomationEngine:
- Conditions were never evaluated — a trigger→condition→action rule ran its
  actions unconditionally. Now every stored condition must match current
  entity state (AND) before actions run; a false condition does NOT touch the
  cooldown clock, so the rule stays armed for its next legitimate trigger.
- Cooldown was read-check-then-save, so concurrent queue workers on a burst of
  state changes could all pass the check and each fire. Now claimed with a
  single conditional UPDATE — exactly one worker wins the race (H5).

+3 tests (condition true/false, cooldown-not-armed-on-failed-condition).
AutomationTest 9 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 01:15:22 +02:00
HomeOS Bootstrap d10172ac26 feat(automations): trigger→condition→action engine with cooldown + dry-run
- AutomationEngine: state_change + time triggers, cooldown debounce, dry-run
  logs instead of switching (H5), actions switch via DeviceCommandService
  (source=automation, audited H1) or notify via log.
- EvaluateAutomations: queued listener on DeviceStateChanged (keeps ingest
  fast, H2). automations:tick command scheduled every minute for time rules.
- CreateAutomation modal (wire-elements) wired to Automations index; DE/EN
  keys (R16). dry_run column migration + model cast.
- AutomationTest: 6 cases (trigger match, mismatch, cooldown, dry-run,
  time tick, disabled). Full suite 23 green; 11/11 tabs clean (R12).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 01:11:02 +02:00