Skip to content

Commit 9f00439

Browse files
committed
fix: revert incorrect Cyrus hint and consolidate calendar wipe logic
The save-load.event.recurrences.exception: unsupported flag added to the Cyrus hints was wrong — the caldav-server-tester confirms the feature works. That incorrect flag caused search.py to force server_expand=True on all expand searches for Cyrus, breaking testTodoDatesearch (VTODO date search returned 3 instead of 5) and testRecurringDateWithExceptionSearch (RECURRENCE-ID assertion on server-expanded results). Also consolidate the wipe-objects logic: Calendar.delete(wipe=True) now handles per-object NotFoundError, and all three manual "for x in cal.search(): x.delete()" loops in _cleanup and _fixCalendar are replaced with cal.delete(wipe=True). prompt: save-load.event.recurrences.exception is found to be working by the caldav-server-tester project. ... Please fix the wipe logic - we should not duplicate it. AI Prompts: claude-sonnet-4-6: Please do a code review of the changes since master. The purpose of this branch is: * Reduce run-time of tests on github. They currently take more than an hour. The tests aren't quick here on my laptop, but they take significantly less time, and test more servers. I didn't investigate the details, but the tests are still much slower at github than locally. * Deal with test breakages on github. Tests still break, but now they also fail here at my laptop, I didn't investigate, but it could be the same reason. The changes causes test breakages: FAILED tests/test_caldav.py::TestForServerDavical::testRecurringDateWithExceptionSearch - KeyError: 'RECURRENCE-ID' FAILED tests/test_caldav.py::TestForServerCyrus::testTodoDatesearch - assert 3 == 5 FAILED tests/test_caldav.py::TestForServerCyrus::testRecurringDateWithExceptionSearch - KeyError: 'RECURRENCE-ID' claude-sonnet-4-6: save-load.event.recurrences.exception is found to be working by the caldav-server-tester project. This is a simple check, so I trust that it's working, and it shouldn't be marked as unsupported in the compatibility_hints. Perhaps the cyrus docker container run by github has another support matrix than the one run locally, i.e. due to versioning differences? search.recurrences.expanded.exception is reported to be supported, so it should most likely not be marked as unsupported. Does cyrus support save-load.event.recurrences.exception, but fails saving and loading a VTODO with recurrence exceptions? Please check. Since niquest by now is the default, there should not be any testing on a "Niquests fallback", but we do need testing on a "httpx fallback", so that part of the changeset is good. Please fix the wipe logic - we should not duplicate it.
1 parent 33a692e commit 9f00439

3 files changed

Lines changed: 12 additions & 23 deletions

File tree

caldav/collection.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,10 @@ def delete(self, wipe=None):
804804

805805
if wipe is True:
806806
for obj in self.search():
807-
obj.delete()
807+
try:
808+
obj.delete()
809+
except error.NotFoundError:
810+
pass
808811
return
809812

810813
## TODO: remove quirk handling from the functional tests
@@ -838,7 +841,10 @@ async def _async_delete(self, wipe=None):
838841

839842
if wipe is True:
840843
for obj in await self.search():
841-
await obj.delete()
844+
try:
845+
await obj.delete()
846+
except error.NotFoundError:
847+
pass
842848
return
843849

844850
quirk_info = self.client.features.is_supported("delete-calendar", dict)

caldav/compatibility_hints.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,10 +1148,6 @@ def dotted_feature_set_list(self, compact=False):
11481148
# Cyrus changes the Schedule-Tag even on attendee PARTSTAT-only updates,
11491149
# violating RFC6638 section 3.2 which requires the tag to remain stable.
11501150
"scheduling.schedule-tag.stable-partstat": {"support": "unsupported"},
1151-
# Cyrus splits exception VEVENTs (with RECURRENCE-ID) into separate calendar
1152-
# object resources rather than keeping master+exception together. Client-side
1153-
# expansion therefore cannot produce correct RECURRENCE-ID values.
1154-
"save-load.event.recurrences.exception": {"support": "unsupported"},
11551151
# Cyrus may not properly reject wrong passwords in some configurations.
11561152
# Cyrus implements server-side automatic scheduling: for cross-user invites,
11571153
# the server both auto-processes the invite into the attendee's calendar

tests/test_caldav.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,25 +1383,15 @@ def _cleanup(self, mode=None):
13831383
return ## no cleanup needed
13841384
if self.cleanup_regime == "wipe-calendar":
13851385
for cal in self.calendars_used:
1386-
## do we need a try-except-pass?
1387-
try:
1388-
for x in cal.search():
1389-
x.delete()
1390-
except error.NotFoundError:
1391-
pass
1386+
cal.delete(wipe=True)
13921387
elif not self.is_supported("create-calendar") or self.cleanup_regime == "thorough":
13931388
for cal in self.calendars_used:
1394-
for x in cal.search():
1395-
x.delete()
1389+
cal.delete(wipe=True)
13961390
return
13971391
for cal in self.calendars_used:
13981392
if str(cal.url) in self._preconfigured_calendar_urls:
13991393
## Pre-configured calendar: wipe objects, don't delete the calendar
1400-
try:
1401-
for x in cal.search():
1402-
x.delete()
1403-
except error.NotFoundError:
1404-
pass
1394+
cal.delete(wipe=True)
14051395
else:
14061396
cal.delete()
14071397
for calid in (self.testcal_id, self.testcal_id2, self.testcal_id + "-tasks"):
@@ -1438,10 +1428,7 @@ def _teardownCalendar(self, name=None, cal_id=None):
14381428
def _fixCalendar(self, **kwargs):
14391429
cal = self._fixCalendar_(**kwargs)
14401430
if self.cleanup_regime == "wipe-calendar":
1441-
## do we need a try-except-pass?
1442-
## (if so, consolidate)
1443-
for x in cal.search():
1444-
x.delete()
1431+
cal.delete(wipe=True)
14451432
return cal
14461433

14471434
def _fixCalendar_(self, **kwargs):

0 commit comments

Comments
 (0)