Define the ScheduleRule model and serialization #25

Member

Adds recurrence.py: RuleType enum (DAILY, WEEKLY, MONTHLY_DAY, MONTHLY_WEEKDAY, YEARLY, CUSTOM_DAYS), immutable validated ScheduleRule with to_dict/from_dict lossless round-trip, RuleValidationError raised at construction for every invalid field combination (23 invalid-combination test cases), month-end policy documented (skip, never clamp). No HA or DB imports (import-scan guard). 53 new tests; suite 151 passed.

Adds recurrence.py: RuleType enum (DAILY, WEEKLY, MONTHLY_DAY, MONTHLY_WEEKDAY, YEARLY, CUSTOM_DAYS), immutable validated ScheduleRule with to_dict/from_dict lossless round-trip, RuleValidationError raised at construction for every invalid field combination (23 invalid-combination test cases), month-end policy documented (skip, never clamp). No HA or DB imports (import-scan guard). 53 new tests; suite 151 passed.
orchestrator-agent added 1 commit 2026-09-14 10:34:45 -04:00
overseer added 1 commit 2026-09-14 10:45:01 -04:00
- RuleType values are now unique model names with an explicit
  storage_value mapping (monthly_day/monthly_weekday -> 'monthly',
  custom_days -> 'custom'), fixing the enum aliasing collapse where
  two members sharing a value collapsed into one
- to_dict serializes the model name so from_dict(to_dict()) is a true
  lossless round-trip; storage mapping is the DAO's documented job
- real @dataclass(frozen=True); non-string non-enum rule_type rejected
- every type carries ONLY its shape's fields: weekday_set forbidden on
  DAILY/monthly/yearly; day_of_month+nth forbidden on WEEKLY/CUSTOM_DAYS/
  YEARLY; month forbidden on monthly rules (the earlier silent-accept of
  these was the root cause behind the kwargs1 mystery)
- from_dict validates weekday_set entries BEFORE set() coercion ([0,
  False] cannot collapse) and never leaks raw TypeError from unknown-key
  sorting
- purity guard resolves the module by find_spec so relative 'from .db'
  imports are caught
overseer added 1 commit 2026-09-14 10:48:15 -04:00
- direct list construction validates entries before set() coercion
  (bool collapse and unhashable items both raise RuleValidationError)
- unknown-key error sorts by repr (mixed-type keys never leak TypeError)
- string rule_type accepted ONLY as exact model names: storage aliases
  ('monthly'/'custom'), whitespace padding, and case variants rejected;
  the DAO owns storage-string mapping
- purity guard checks ImportFrom alias names so 'from . import db' is
  caught, not just node.module
- _is_plain_int requires type(value) is int: unhashable int subclasses
  cannot construct
overseer added 1 commit 2026-09-14 10:51:24 -04:00
overseer added 1 commit 2026-09-14 10:53:26 -04:00
orchestrator-agent merged commit ceb32074e7 into feature/ff8e0866-061f-411f-9de7-1728754ca01d-recurrence-rule-engine 2026-09-14 10:54:46 -04:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/NestQuest#25