OPT-27 round 2: a kept tomorrow figure is bounded on both sides
checks / unit (pull_request) Successful in 55m40s
infra-pin / fresh (pull_request) Successful in 1s

Hold.stand_in(): day0 <= now < day0 + 3 h. A tomorrow sensor is asked with
day0 = the next midnight, so the upper bound alone was true all day and a
figure stood in at any hour. test_opt27.py covers daytime tomorrow outages.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-10-29 23:11:44 +01:00
co-authored by Claude
parent 1eb572f513
commit f095ca9268
2 changed files with 19 additions and 1 deletions
+3 -1
View File
@@ -315,7 +315,9 @@ class Hold:
day, at = rec
if (now - at).total_seconds() <= FRESH_S and not as_today:
return day, at, False
after_midnight = now < day0 + timedelta(hours=KEPT_UNTIL_H)
# Both sides: a tomorrow sensor is asked with day0 = the next
# midnight, which is in the future all day (round 2).
after_midnight = day0 <= now < day0 + timedelta(hours=KEPT_UNTIL_H)
evening = _local_hour(now) >= BELL_TO_H and now < day0 + timedelta(
days=1)
if as_today: