Recurrence: DAILY+INTERVAL+BYDAY search window too small (spurious failure) #10

Closed
opened 2026-06-05 10:26:08 +00:00 by victor · 0 comments
Owner

next_occurrence for DAILY uses limit = interval + 10 days (src/core/recurrence.rs:204) while also requiring the day to satisfy BYDAY (line 208). When the interval-aligned days and the BYDAY weekdays only coincide far out, the window is exhausted and it returns an error.

Repro: FREQ=DAILY;INTERVAL=5;BYDAY=MO with a Monday anchor — first day that is both a multiple of 5 from anchor and a Monday is 35 days out (lcm(5,7)=35), but limit=15, so done fails with "no daily occurrence found within 15 days".

Fix: widen the daily search bound to cover the lcm of interval and 7 (e.g. interval*7 + slack, mirroring the WEEKLY bound at line 183), or compute the next aligned weekday directly. Add a test for the repro case.

Found in review.

`next_occurrence` for DAILY uses `limit = interval + 10` days (src/core/recurrence.rs:204) while also requiring the day to satisfy BYDAY (line 208). When the interval-aligned days and the BYDAY weekdays only coincide far out, the window is exhausted and it returns an error. **Repro:** `FREQ=DAILY;INTERVAL=5;BYDAY=MO` with a Monday anchor — first day that is both a multiple of 5 from anchor and a Monday is 35 days out (lcm(5,7)=35), but limit=15, so `done` fails with "no daily occurrence found within 15 days". **Fix:** widen the daily search bound to cover the lcm of interval and 7 (e.g. `interval*7 + slack`, mirroring the WEEKLY bound at line 183), or compute the next aligned weekday directly. Add a test for the repro case. Found in review.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
victor/task-manager#10
No description provided.