Skip to content

Commit ca8efa1

Browse files
tobixenclaude
andcommitted
feat: check for missing initial recurrence-id
RFC 4791 §9.6.5: non-initial expanded instances MUST include RECURRENCE-ID; the initial instance MAY omit it. Add a check that queries a range covering both a regular occurrence (Feb 12) and an exception (Feb 13) with server-side expand, then reports whether the initial instance includes RECURRENCE-ID. It was finally decided to add this as annotation in the behaviour field of the search.recurrences.expanded.event. The only known instance was Cyrus, but the behaviour was modified shortly after writing this test. I'm not sure what the author of the RFC have been thinking about here - in my head it does not make sense to specifically allow the first recurrence in an expanded recurrence set to be without a RECURRENCE-ID. AI-generated. prompt: make a test in caldav-server-tester to verify the cyrus expansion quirk; also check if there is any other places in the caldav library that needs fixing to reflect that the first instance in a recurrence set may be missing the RECURRENCE-ID prompt: the checking should still be done, behaviour should still mark this behaviour, only that it should state supported instead of quirk prompt: search.recurrences.expanded.recurrence-id was added in one of the last commits, it is not defined in compatibility_hints.py in the caldav project and should not exist. Please clean up. The correct behaviour of the checker is to add a behaviour field to search.recurrences.expanded if the first recurrence is missing the recurrence-id field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 873398d commit ca8efa1

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/caldav_server_tester/checks.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,30 @@ def _run_check(self):
13651365
== datetime(2000, 2, 13, 12, tzinfo=utc),
13661366
)
13671367

1368+
## RFC 4791 §9.6.5: non-initial expanded instances MUST include RECURRENCE-ID;
1369+
## the initial instance MAY omit it. Query a range covering both the regular
1370+
## Feb 12 occurrence and the Feb 13 exception to detect servers that omit
1371+
## RECURRENCE-ID on the initial instance, and annotate the expanded.event feature.
1372+
multi = cal.search(
1373+
start=datetime(2000, 2, 12, tzinfo=utc),
1374+
end=datetime(2000, 2, 14, tzinfo=utc),
1375+
event=True,
1376+
server_expand=True,
1377+
post_filter=False,
1378+
)
1379+
if len(multi) == 2:
1380+
initial = next(
1381+
(e for e in multi if e.component["dtstart"] == datetime(2000, 2, 12, 12, 0, 0, tzinfo=utc)),
1382+
None,
1383+
)
1384+
if initial is not None and getattr(initial.component.get("RECURRENCE-ID"), "dt", None) is None:
1385+
self.set_feature(
1386+
"search.recurrences.expanded.event",
1387+
{
1388+
"behaviour": "initial occurrence lacks RECURRENCE-ID; RFC 4791 §9.6.5 permits this — clients must fall back to DTSTART"
1389+
},
1390+
)
1391+
13681392

13691393
class CheckCaseSensitiveSearch(Check):
13701394
"""

0 commit comments

Comments
 (0)