[Feature] Add CalDAV protocol sync, recurrence expansion, and free/busy capability #3

Open
opened 2026-07-07 02:52:07 +02:00 by zemion · 3 comments
Owner

Context

The first govoplan-calendar module stores VEVENT/iCalendar data and preserves raw iCalendar properties, but it is not yet a full CalDAV protocol implementation and does not yet expand every recurrence form for availability queries.

Acceptance Criteria

  • Implement recurrence expansion for RRULE, RDATE, EXDATE, RECURRENCE-ID, overridden instances, and detached instances.
  • Add a free/busy capability for scheduling, appointments, resource checks, and groupware adapters.
  • Define CalDAV collection sync tokens, ETags, REPORT handling, and conflict handling.
  • Add import/export/sync tests with multi-instance recurring events and exceptions.
  • Keep protocol adapters optional so core-only and calendar-only startup do not require Open-Xchange or connector packages.
  • Wiki: Repo-docs-CALENDAR-INTEGRATION-CONCEPT
  • Boundary issue: add-ideas/govoplan-calendar#1
  • Open-Xchange adapter issue: add-ideas/govoplan-calendar#2

Folded Sync Refactor Guardrails From #13

The provider-specific complexity debt from govoplan-calendar#13 is part of the broader sync/CalDAV implementation work and should be addressed incrementally while this issue changes sync behavior.

Additional acceptance notes:

  • Split provider-specific sync/parsing code into focused CalDAV, ICS, Graph, and EWS service modules before adding substantially more sync behavior.
  • Add parser fixtures for each provider before refactoring complex parser paths.
  • Keep the public calendar service API stable for existing module consumers.
  • Prioritize simplifying parse_discovery_multistatus, event_to_component, graph_event_payload, parse_ews_calendar_items, discover_caldav_calendars, sync_graph_source, and update_event as sync features are touched.

Source: folded from govoplan-calendar#13 (source/security-audit, audit complexity baseline codex-audit-full-2026-07-11:calendar-complexity-baseline).

<!-- codex-calendar-followup:caldav-recurrence-freebusy-20260707 --> ## Context The first `govoplan-calendar` module stores VEVENT/iCalendar data and preserves raw iCalendar properties, but it is not yet a full CalDAV protocol implementation and does not yet expand every recurrence form for availability queries. ## Acceptance Criteria - [ ] Implement recurrence expansion for RRULE, RDATE, EXDATE, RECURRENCE-ID, overridden instances, and detached instances. - [ ] Add a free/busy capability for scheduling, appointments, resource checks, and groupware adapters. - [ ] Define CalDAV collection sync tokens, ETags, REPORT handling, and conflict handling. - [ ] Add import/export/sync tests with multi-instance recurring events and exceptions. - [ ] Keep protocol adapters optional so core-only and calendar-only startup do not require Open-Xchange or connector packages. ## Related Context - Wiki: `Repo-docs-CALENDAR-INTEGRATION-CONCEPT` - Boundary issue: `add-ideas/govoplan-calendar#1` - Open-Xchange adapter issue: `add-ideas/govoplan-calendar#2` ## Folded Sync Refactor Guardrails From #13 The provider-specific complexity debt from `govoplan-calendar#13` is part of the broader sync/CalDAV implementation work and should be addressed incrementally while this issue changes sync behavior. Additional acceptance notes: - Split provider-specific sync/parsing code into focused CalDAV, ICS, Graph, and EWS service modules before adding substantially more sync behavior. - Add parser fixtures for each provider before refactoring complex parser paths. - Keep the public calendar service API stable for existing module consumers. - Prioritize simplifying `parse_discovery_multistatus`, `event_to_component`, `graph_event_payload`, `parse_ews_calendar_items`, `discover_caldav_calendars`, `sync_graph_source`, and `update_event` as sync features are touched. Source: folded from `govoplan-calendar#13` (`source/security-audit`, audit complexity baseline `codex-audit-full-2026-07-11:calendar-complexity-baseline`).
zemion added this to the Module And Integration Roadmap milestone 2026-07-07 02:52:07 +02:00
Author
Owner

Codex State: progress

Summary

  • A first backend recurrence expansion primitive now exists in govoplan_calendar.backend.ical for RRULE/RDATE/EXDATE over a requested range.
  • This does not yet expose CalDAV, free/busy, or recurrence-expanded event listing endpoints; those remain the main scope of this issue.

Changed Files

  • src/govoplan_calendar/backend/ical.py
  • tests/test_ical.py

Verification

  • PYTHONPATH=/mnt/DATA/git/govoplan-calendar/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan-core/.venv/bin/python -m unittest discover -s /mnt/DATA/git/govoplan-calendar/tests

Next / Blocked

  • Design API endpoints for expanded occurrences and free/busy before adding CalDAV protocol handlers.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - A first backend recurrence expansion primitive now exists in govoplan_calendar.backend.ical for RRULE/RDATE/EXDATE over a requested range. - This does not yet expose CalDAV, free/busy, or recurrence-expanded event listing endpoints; those remain the main scope of this issue. ### Changed Files - `src/govoplan_calendar/backend/ical.py` - `tests/test_ical.py` ### Verification - `PYTHONPATH=/mnt/DATA/git/govoplan-calendar/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan-core/.venv/bin/python -m unittest discover -s /mnt/DATA/git/govoplan-calendar/tests` ### Next / Blocked - Design API endpoints for expanded occurrences and free/busy before adding CalDAV protocol handlers. Suggested status label: `status/in-progress`
Author
Owner

Codex State: progress

Summary

  • Implemented a calendar-owned CalDAV sync source model with collection URL, auth metadata, sync token, ctag, last sync status, and no persisted secrets.
  • Added a standard-library CalDAV client for PROPFIND, calendar-query full sync, sync-collection incremental sync, GET fallback, multistatus parsing, ETags, deleted resources, and sync tokens.
  • Added inbound sync service that imports all VEVENT components in a CalDAV resource, preserves raw ICS, updates source_href/etag metadata, and soft-deletes local events for remote deletions.
  • Exposed CalDAV source CRUD and manual sync endpoints under /calendar/caldav/sources.
  • Remaining work: credential-store integration, scheduled/background sync, outbound writes/conflict policy, full free/busy API, and user-facing recurrence editing.

Changed Files

  • README.md
  • docs/CALENDAR_INTEGRATION_CONCEPT.md
  • src/govoplan_calendar/backend/caldav.py
  • src/govoplan_calendar/backend/db/models.py
  • src/govoplan_calendar/backend/ical.py
  • src/govoplan_calendar/backend/manifest.py
  • src/govoplan_calendar/backend/migrations/versions/8d9e0f1a2b3c_caldav_sync_sources.py
  • src/govoplan_calendar/backend/router.py
  • src/govoplan_calendar/backend/schemas.py
  • src/govoplan_calendar/backend/service.py
  • tests/test_caldav.py
  • tests/test_ical.py

Verification

  • PYTHONPATH=/mnt/DATA/git/govoplan-calendar/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan-core/.venv/bin/python -m unittest discover -s /mnt/DATA/git/govoplan-calendar/tests
  • PYTHONPATH=/mnt/DATA/git/govoplan-calendar/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan-core/.venv/bin/python -m compileall -q /mnt/DATA/git/govoplan-calendar/src/govoplan_calendar /mnt/DATA/git/govoplan-calendar/tests
  • cd /mnt/DATA/git/govoplan-core && ./.venv/bin/python -m govoplan_core.devserver --smoke --no-reload

Next / Blocked

  • Add credential-store/connector profile integration before enabling scheduled CalDAV sync.
  • Define outbound write and conflict resolution policy for local edits to synced CalDAV events.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Implemented a calendar-owned CalDAV sync source model with collection URL, auth metadata, sync token, ctag, last sync status, and no persisted secrets. - Added a standard-library CalDAV client for PROPFIND, calendar-query full sync, sync-collection incremental sync, GET fallback, multistatus parsing, ETags, deleted resources, and sync tokens. - Added inbound sync service that imports all VEVENT components in a CalDAV resource, preserves raw ICS, updates source_href/etag metadata, and soft-deletes local events for remote deletions. - Exposed CalDAV source CRUD and manual sync endpoints under /calendar/caldav/sources. - Remaining work: credential-store integration, scheduled/background sync, outbound writes/conflict policy, full free/busy API, and user-facing recurrence editing. ### Changed Files - `README.md` - `docs/CALENDAR_INTEGRATION_CONCEPT.md` - `src/govoplan_calendar/backend/caldav.py` - `src/govoplan_calendar/backend/db/models.py` - `src/govoplan_calendar/backend/ical.py` - `src/govoplan_calendar/backend/manifest.py` - `src/govoplan_calendar/backend/migrations/versions/8d9e0f1a2b3c_caldav_sync_sources.py` - `src/govoplan_calendar/backend/router.py` - `src/govoplan_calendar/backend/schemas.py` - `src/govoplan_calendar/backend/service.py` - `tests/test_caldav.py` - `tests/test_ical.py` ### Verification - `PYTHONPATH=/mnt/DATA/git/govoplan-calendar/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan-core/.venv/bin/python -m unittest discover -s /mnt/DATA/git/govoplan-calendar/tests` - `PYTHONPATH=/mnt/DATA/git/govoplan-calendar/src:/mnt/DATA/git/govoplan-tenancy/src:/mnt/DATA/git/govoplan-access/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan-core/.venv/bin/python -m compileall -q /mnt/DATA/git/govoplan-calendar/src/govoplan_calendar /mnt/DATA/git/govoplan-calendar/tests` - `cd /mnt/DATA/git/govoplan-core && ./.venv/bin/python -m govoplan_core.devserver --smoke --no-reload` ### Next / Blocked - Add credential-store/connector profile integration before enabling scheduled CalDAV sync. - Define outbound write and conflict resolution policy for local edits to synced CalDAV events. Suggested status label: `status/in-progress`
Author
Owner

Codex State: progress

Summary

  • Implemented encrypted CalDAV credential references, env secret refs, source sync scheduling fields, and due-sync service/API/task entry points.
  • Implemented two-way CalDAV PUT/DELETE for local event create/update/delete with ETag preconditions and multi-VEVENT resource preservation.
  • Added backend free/busy API primitive with recurrence expansion for scheduling and appointment integrations.

Changed Files

  • src/govoplan_calendar/backend/caldav.py
  • src/govoplan_calendar/backend/service.py
  • src/govoplan_calendar/backend/db/models.py
  • src/govoplan_calendar/backend/migrations/versions/9e0f1a2b3c4d_caldav_credentials_outbound_sync.py
  • src/govoplan_calendar/backend/tasks.py
  • tests/test_caldav.py

Verification

  • python -m unittest discover -s /mnt/DATA/git/govoplan-calendar/tests: 18 tests OK
  • python -m compileall -q src/govoplan_calendar tests: OK
  • govoplan_core.devserver --smoke --no-reload: OK

Next / Blocked

  • Remaining follow-ups: UI for CalDAV source/credential/sync settings, CalDAV server endpoints if GovOPlaN should be a CalDAV server, and richer user-facing recurrence editing.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Implemented encrypted CalDAV credential references, env secret refs, source sync scheduling fields, and due-sync service/API/task entry points. - Implemented two-way CalDAV PUT/DELETE for local event create/update/delete with ETag preconditions and multi-VEVENT resource preservation. - Added backend free/busy API primitive with recurrence expansion for scheduling and appointment integrations. ### Changed Files - `src/govoplan_calendar/backend/caldav.py` - `src/govoplan_calendar/backend/service.py` - `src/govoplan_calendar/backend/db/models.py` - `src/govoplan_calendar/backend/migrations/versions/9e0f1a2b3c4d_caldav_credentials_outbound_sync.py` - `src/govoplan_calendar/backend/tasks.py` - `tests/test_caldav.py` ### Verification - `python -m unittest discover -s /mnt/DATA/git/govoplan-calendar/tests: 18 tests OK` - `python -m compileall -q src/govoplan_calendar tests: OK` - `govoplan_core.devserver --smoke --no-reload: OK` ### Next / Blocked - Remaining follow-ups: UI for CalDAV source/credential/sync settings, CalDAV server endpoints if GovOPlaN should be a CalDAV server, and richer user-facing recurrence editing. Suggested status label: `status/in-progress`
zemion added the
type
feature
priority
p2
status
triage
module/calendar
codex/ready
labels 2026-07-07 22:44:30 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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