From 03c652260af43a5d39799437b06d587361f19e3c Mon Sep 17 00:00:00 2001 From: Paolo Donadeo Date: Sun, 17 May 2026 19:19:51 +0200 Subject: [PATCH] feat(event-predicates): warn on unhandled recurrence overrides and multiple masters - Add `warn_unhandled_recurring` collector that emits a warning when `RECURRENCE-ID` overrides are present but not yet handled, emitting the master event as-is - Register `warn_unhandled_recurring` in `all_collectors` - Warn when more than one master event (no `RECURRENCE-ID`) is found for a UID in `separate_master_and_recurrence`, using only the first --- bin/eventPredicates.ml | 16 +++++++++++++++- bin/utils.ml | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bin/eventPredicates.ml b/bin/eventPredicates.ml index 04f0068..41d336e 100644 --- a/bin/eventPredicates.ml +++ b/bin/eventPredicates.ml @@ -326,8 +326,22 @@ RRULE: (`Weekly, (Some `Until (`Utc (2026-07-01 09:00:00 +00:00))), None, []) | Some (_, recurs) -> debug_print_of_recurrence_and_skip ev recurs | None -> Ok rem +let warn_unhandled_recurring rem ev : (Remind.rem, error) result = + if List.length rem.Remind.recurring > 0 then + Printf.eprintf "Warning: RECURRENCE-ID overrides present but not handled (master emitted as-is)\t\t\tUID: %s\n" + (Utils.get_uid ev); + Ok rem + let all_collectors : collector list = - [ collect_uuid; collect_summary; collect_start_end_duration; collect_exdates; yearly_simple_date; simple_recurrence ] + [ + collect_uuid; + collect_summary; + collect_start_end_duration; + collect_exdates; + yearly_simple_date; + simple_recurrence; + warn_unhandled_recurring; + ] let remind_of_event (source : string) (ev : Icalendar.event list) : (Remind.rem, error) result = let () = if List.length ev = 0 then failwith "No events provided" in diff --git a/bin/utils.ml b/bin/utils.ml index 5bf9d09..f89cbd9 100644 --- a/bin/utils.ml +++ b/bin/utils.ml @@ -182,4 +182,8 @@ let separate_master_and_recurrence (events : Icalendar.event list) : Icalendar.e in match master_and_recurrences with | [], _ -> failwith "No master event found" - | master :: _, recurrences -> (master, recurrences) + | [ master ], recurrences -> (master, recurrences) + | master :: rest, recurrences -> + Printf.eprintf "Warning: %d extra master events (no RECURRENCE-ID) for UID: %s — only first used\n" + (List.length rest) (get_uid master); + (master, recurrences)