fix(02): populate hasRrule on every sync upsert so recurring masters are flagged

- Use ICAL.Event.isRecurring() (parity with expand.ts) to detect RRULE/RDATE
- Add hasRrule to .values() INSERT and .onDuplicateKeyUpdate() SET so the flag
  is set on first sync and self-heals on every subsequent re-sync
- Without this fix every event had has_rrule=0 (column default), causing the
  events route recurring-master pre-filter to return zero recurring occurrences
- Add sync.test.ts cases: hasRrule=true for timed+all-day recurring VEVENTs,
  hasRrule=false for non-recurring, and hasRrule in onDuplicateKeyUpdate.set
This commit is contained in:
Lucas Berger
2026-06-05 14:50:18 -04:00
parent 5d82f859fd
commit f70496871a
3 changed files with 127 additions and 0 deletions
+31
View File
@@ -57,3 +57,34 @@ DTEND;VALUE=DATE:20260616
SUMMARY:Test All-Day Event
END:VEVENT
END:VCALENDAR`
/**
* Sample VEVENT string — a timed recurring event (RRULE:FREQ=WEEKLY).
* Used to test that sync sets hasRrule=true for recurring events.
*/
export const SAMPLE_VEVENT_RECURRING_TIMED = `BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//FamilySync//Test//EN
BEGIN:VEVENT
UID:test-recurring-timed-001@familysync
DTSTART:20240101T100000Z
RRULE:FREQ=WEEKLY;BYDAY=MO
SUMMARY:Weekly Monday Meeting
END:VEVENT
END:VCALENDAR`
/**
* Sample VEVENT string — an all-day recurring event (RRULE:FREQ=YEARLY).
* Used to test that sync sets hasRrule=true for all-day recurring events,
* and that the events route returns occurrences even when dtstartUtc is NULL.
*/
export const SAMPLE_VEVENT_RECURRING_ALLDAY = `BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//FamilySync//Test//EN
BEGIN:VEVENT
UID:test-recurring-allday-001@familysync
DTSTART;VALUE=DATE:20240615
RRULE:FREQ=YEARLY
SUMMARY:Annual Birthday
END:VEVENT
END:VCALENDAR`