Fix fixture process transitions

This commit is contained in:
Gabriel Brown
2026-08-17 16:59:15 -04:00
parent a325ec807e
commit 4f93522f7d
2 changed files with 94 additions and 9 deletions
@@ -45,12 +45,15 @@ trap cleanup EXIT
start_test_shell() {
stop_test_shell || fail 'pre-existing branch shell did not stop cleanly'
qs_for_test --daemonize >"$shell_log" 2>&1
for _ in $(seq 1 80); do
if qs_for_test ipc show 2>/dev/null | rg '^target home-assistant$' >/dev/null; then
return
fi
sleep 0.1
for _attempt in 1 2; do
qs_for_test --daemonize >"$shell_log" 2>&1
for _ in $(seq 1 80); do
if qs_for_test ipc show 2>/dev/null | rg '^target home-assistant$' >/dev/null; then
return
fi
sleep 0.1
done
stop_test_shell || fail 'failed branch-shell attempt did not stop cleanly'
done
sed -n '1,200p' "$shell_log" >&2
fail 'isolated branch shell did not start'
@@ -185,6 +188,27 @@ wait_for_home_status '
(.entities[] | select(.id == "light.fixture_hall") | .active == true)
' 'nonzero no-output Home action did not fail safely and continue the queue'
qs_for_test ipc call home-assistant fixture process-actions >/dev/null
qs_for_test ipc call home-assistant brightness light.fixture_living 88 >/dev/null
jq -e '
.busyEntityIds == ["light.fixture_living"] and
.pendingBrightness["light.fixture_living"] == 88
' <<<"$(qs_for_test ipc call home-assistant status)" >/dev/null \
|| fail 'fixture transition setup did not start an in-flight action'
qs_for_test ipc call home-assistant fixture process-no-output >/dev/null
qs_for_test ipc call home-assistant toggle light.fixture_hall >/dev/null
wait_for_home_status '
.phase == "ready" and
.busy == false and
.busyEntityIds == [] and
.pendingBrightness == {} and
.entityErrors == {} and
(.entities[] |
select(.id == "light.fixture_living") |
.active == false and .brightnessPct == 36) and
(.entities[] | select(.id == "light.fixture_hall") | .active == true)
' 'switching process fixtures stranded or misattributed the new action'
qs_for_test ipc call home-assistant fixture missing-selected >/dev/null
jq -e '
.fixture == true and