Review fix: validate engine keys as child ids; every-day three-child walk

Review round 1 (Codex gpt-5.6-terra, 2 LOW): engine snapshot keys now
pass _validate_child_id (True/1.0 compare equal to 1 and would be
accepted then behave differently on lookup); the always-present test
now walks all 28 days asserting all three children's expected verdicts
instead of sampling every third day. Suite: 985 passed.
This commit is contained in:
Joshua King
2026-09-15 17:58:51 -04:00
parent 540f59a353
commit 6d48f433b7
2 changed files with 22 additions and 4 deletions
+4
View File
@@ -339,6 +339,10 @@ class PresenceEngine:
f"{schedules!r}"
)
for child_id, schedule in schedules.items():
# Validate the KEY as a model child id too: True and 1.0
# compare equal to 1, so {True: schedule(1)} would be
# accepted and then behave differently on lookup.
_validate_child_id(child_id)
if not isinstance(schedule, PresenceSchedule):
raise ValueError(
f"schedules[{child_id!r}] must be a PresenceSchedule, "