Home / Market / icalendar recurrence audit

icalendar recurrence audit

Audit RFC 5545 .ics recurrence expansion read-only across RRULE, RDATE, EXDATE, RECURRENCE-ID overrides, cancellations, TZID DST transitions, floating times, and all-day events.

skill★ 508790 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: icalendar-recurrence-audit description: "Audit RFC 5545 .ics recurrence expansion read-only across RRULE, RDATE, EXDATE, RECURRENCE-ID overrides, cancellations, TZID DST transitions, floating times, and all-day events." category: data risk: safe source: self source_type: self date_added: "2026-12-01" author: Koushik-Katkam tags: [icalendar, ics, rfc5545, recurrence, rrule, timezone, dst, testing]

---

iCalendar Recurrence Audit

Overview

Perform a strictly read-only, offline audit of RFC 5545 (.ics / VCALENDAR) recurrence expansion using maintained Python calendar libraries (icalendar, recurring-ical-events, python-dateutil, tzdata/zoneinfo) instead of custom regex or ad-hoc recurrence parsers. Computes exact local wall-clock timestamps and UTC instants inside a bounded date window and occurrence cap so DST shifts, excluded dates, overridden instances, cancellations, floating times, and all-day events are verified before ingestion or calendar sync.

Distinction from existing calendar skills:

When to Use

Prerequisites

How It Works

1. Parse strictly with a maintained RFC 5545 library

  1. Read .ics bytes read-only without rewriting or mutating the file.
  2. Parse via icalendar.Calendar.from_ical(...) (avoid custom line-unfolding or RRULE string splitters). On invalid/unparseable VCALENDAR input, bad RRULE syntax, missing DTSTART, invalid window types, mixed timezone-aware + timezone-naive window bounds, non-positive-integer max_occurrences, or invalid window ordering, return structured errors (human-readable errors plus machine-readable structured_errors with code) rather than silently succeeding or raising.

2. Bound expansion and classify occurrence semantics

Run recurring_ical_events.of(cal, skip_bad_series=False).paginate(page_size=..., earliest_end=window_start, latest_start=window_end) so recurrence generation stops lazily at window_end or max_occurrences instead of materializing an unbounded expansion in memory:

  1. Active vs. cancelled instances: recurring-ical-events returns RECURRENCE-ID override components carrying STATUS:CANCELLED; separate those into cancelled_occurrences rather than treating them as active instances.
  2. Timezone-aware (TZID / Z) occurrences: Preserve local wall-clock ISO string (local_iso) and compute exact utc_iso across spring-forward and fall-back transitions.
  3. Floating local times (tzinfo=None): Flag with a warning and report utc_iso = None because naive datetimes have no universal UTC instant without an assumed consumer timezone.
  4. All-day events (VALUE=DATE -> datetime.date): Record kind = "all_day" and utc_iso = None without attempting .astimezone().
  5. Bounded execution: max_occurrences bounds total inspected occurrences (active + cancelled); when more occurrences exist inside the window, mark truncated = True and stop inspecting before scanning further pages.

See icalendar recurrence harness for the runnable pytest audit module and synthetic fixtures.

3. Verify counts, cancellations, and byte preservation

Confirm expected active occurrence timestamps (local_iso and utc_iso), expected cancelled_occurrences, zero unexpected parser warnings, and identical file bytes before and after inspection.

Examples

Run the offline fixture suite in icalendar recurrence harness:

User request: "Audit our standup-series.ics across March and November 2026 DST transitions before import."
Inputs: Local .ics file, window [2026-03-06T00:00Z, 2026-03-13T00:00Z), max_occurrences=50.
Expected result: Spring-forward shifts UTC from 14:00:00Z (EST -05:00) to 13:00:00Z (EDT -04:00) while preserving
  09:00 local wall clock; EXDATE removes 2026-03-07; RDATE adds 2026-03-11; RECURRENCE-ID shifts 2026-03-08 to
  10:30:00-04:00 (14:30:00Z); STATUS:CANCELLED moves 2026-03-09 into cancelled_occurrences; floating and
  all-day events report utc_iso=None; source .ics bytes remain unchanged.

Limitations

Safety and Side Effects

Sources and related skills