[Audit] Refactor CalDAV and iCalendar parsing complexity hotspots #16

Closed
opened 2026-07-13 20:10:52 +02:00 by zemion · 1 comment
Owner

Xenon flags calendar parsing/conversion code above the configured complexity threshold.

Source report: /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt

Observed hotspots:

  • src/govoplan_calendar/backend/caldav.py:359 parse_discovery_multistatus rank E
  • src/govoplan_calendar/backend/ical.py:154 event_to_component rank D

Acceptance criteria:

  • Extract parsing and mapping sub-steps into small helpers.
  • Preserve VEVENT/CalDAV behavior and regression tests.
  • Keep security hardening work separate from broad parsing rewrites unless the same tests cover both.
<!-- codex-security-audit-fingerprint:security-audit-20260713-calendar-complexity --> Xenon flags calendar parsing/conversion code above the configured complexity threshold. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt` Observed hotspots: - `src/govoplan_calendar/backend/caldav.py:359 parse_discovery_multistatus` rank E - `src/govoplan_calendar/backend/ical.py:154 event_to_component` rank D Acceptance criteria: - Extract parsing and mapping sub-steps into small helpers. - Preserve VEVENT/CalDAV behavior and regression tests. - Keep security hardening work separate from broad parsing rewrites unless the same tests cover both.
Author
Owner

Codex State: done

Summary

  • Refactored CalDAV discovery parsing and VEVENT export into smaller helper phases.

Changed Files

  • parse_discovery_multistatus now delegates response parsing, propstat status checks, property application, component extraction, and dedupe to helpers; event_to_component now delegates identity/time, status, optional text, recurrence/parties, raw records, preserved properties, and alarms.

Verification

  • py_compile for caldav.py/ical.py and related tests; git diff --check for touched files; PYTHONPATH with calendar/tenancy/access/core python -m unittest tests.test_caldav tests.test_ical (24 tests OK); full calendar unittest discovery (33 tests OK).

Next / Blocked

  • Rerun the full audit battery after rebuild to confirm Xenon ranks for the refactored functions.
## Codex State: done ### Summary - Refactored CalDAV discovery parsing and VEVENT export into smaller helper phases. ### Changed Files - `parse_discovery_multistatus now delegates response parsing, propstat status checks, property application, component extraction, and dedupe to helpers; event_to_component now delegates identity/time, status, optional text, recurrence/parties, raw records, preserved properties, and alarms.` ### Verification - `py_compile for caldav.py/ical.py and related tests; git diff --check for touched files; PYTHONPATH with calendar/tenancy/access/core python -m unittest tests.test_caldav tests.test_ical (24 tests OK); full calendar unittest discovery (33 tests OK).` ### Next / Blocked - Rerun the full audit battery after rebuild to confirm Xenon ranks for the refactored functions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-calendar#16
No description provided.