From 15ae65512fad1fc45ce20b7b815c40a74a4d4597 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Sun, 8 Nov 2026 10:10:09 +0100 Subject: [PATCH 1/3] feat: probe a TZID that is a tz link name Bedework 5 refuses an event in Europe/Oslo, a link to Europe/Berlin since tzdata 2022b, with 403 "unknownTimezone", even with a matching VTIMEZONE. The new probe stores one with its VTIMEZONE and grades save-load.icalendar.tzid-link: full when kept, quirk when stored as Europe/Berlin, unsupported when another TZID comes back, ungraceful when refused. The last two count only where the same event in Europe/Berlin is stored, and in the unsupported case read back as Europe/Berlin, so a server renaming every TZID says nothing. Bedework 5 comes out ungraceful, Bedework 3 and Baikal full; the TODO entry had seen the refusal on Bedework 3 on 2026-10-26, which this probe does not reproduce. The entry goes. Its "without VTIMEZONE" variant is left out on purpose: a TZID with no VTIMEZONE is what save-load.icalendar.olson-tzid probes. The entry pointed at https://github.com/python-caldav/caldav-server-tester/issues/39, the vtimezone probe, which is closed. Prompt: ... continue working on getting all the conformance tests passing [in calendaring-client] Followup-Prompt: Go with [a caldav-server-tester probe, a caldav hint, and caldav rewriting a tz link name to its canonical zone before saving] Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox --- CHANGELOG.md | 1 + docs/TODO.md | 15 ---- src/caldav_server_tester/checks.py | 72 ++++++++++++++- src/caldav_server_tester/future_features.py | 6 ++ tests/test_tzid_link.py | 99 +++++++++++++++++++++ 5 files changed, 177 insertions(+), 16 deletions(-) create mode 100644 tests/test_tzid_link.py diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a95e9..f7365b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This release works with caldav 3.7.0: the tester carries the definitions of the - **`save-load.icalendar.attendee-once`** - whether each ATTENDEE of an event comes back once. Bedework 5 stores every ATTENDEE twice, as an exact copy (`quirk`, "stored twice"), which caldav will drop when it reads the data (a caldav change still to be released). caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. - **`url.encode-at.encoded.href`** - whether a calendar-multiget finds an object named by an href with `%40`, as a GET of that URL does. Robur does not decode the `%40` in the href and answers 404; the literal `@` finds the object. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. - **`search.recurrences.exception.in-calendar-data`** - whether a search returns a recurring event with its exceptions, as a GET has it. Bedework 3.10 and 5 return the master only. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. +- **`save-load.icalendar.tzid-link`** - whether an event whose TZID is a tz database link name (Europe/Oslo, a link to Europe/Berlin), sent with its VTIMEZONE, is stored with that TZID. Bedework 5 refuses it with 403 `unknownTimezone` (`ungraceful`); `quirk` where it is stored as Europe/Berlin, `unsupported` where another TZID comes back. A refusal or another TZID counts only where the same event in Europe/Berlin is stored and kept as such. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. ### Fixed diff --git a/docs/TODO.md b/docs/TODO.md index 0138700..4d2b3cb 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -482,21 +482,6 @@ If it is done, the generic shape is a hook in the test-server definition ("expire the change history now"), with the probe `unknown` wherever no hook is defined; Stalwart would be the only server with one. -# Bedework refuses TZIDs that are tzdata link names - -Bedework answers 403 `unknownTimezone` for a TZID that is a tzdata link name -(Europe/Oslo, Europe/Stockholm, Europe/Amsterdam, Europe/Kiev), even with a -matching VTIMEZONE in the object. Canonical names (Europe/Berlin, -Europe/Paris, America/New_York) are accepted. Seen 2026-10-26 on the -Bedework3 docker server. - -No probe or hint covers it. The `save-load.icalendar.vtimezone` probe -already sidesteps it by using Europe/Berlin, which is deliberate; only -Bedework 3 was tried, Bedework 5 was not. A probe would save an event with a -link-name TZID (with and without VTIMEZONE) next to a canonical-name control, -and grade the refusal `ungraceful`; it belongs with that probe -(https://github.com/python-caldav/caldav-server-tester/issues/39). - # `delete.if-match: broken` has no consumer The hint is set for Zimbra, SOGo, Bedework 3 and 5, and Posteo, but nothing diff --git a/src/caldav_server_tester/checks.py b/src/caldav_server_tester/checks.py index c51382b..904c9b5 100644 --- a/src/caldav_server_tester/checks.py +++ b/src/caldav_server_tester/checks.py @@ -5581,7 +5581,7 @@ class CheckVtimezone(_RoundTrip, Check): Checks whether the VTIMEZONE sent with an event comes back with it. CCS returns the event's TZID without the VTIMEZONE that defines it. - Europe/Berlin rather than a zone such as Europe/Oslo: Bedework refuses + Europe/Berlin rather than a zone such as Europe/Oslo: Bedework 5 refuses TZIDs that are tzdata link names, which would hide what is asked here. """ @@ -5631,6 +5631,76 @@ def _grade(self, raw): return self._graded("unsupported", f"the event comes back with TZID={tzid} but no VTIMEZONE for it") +class CheckTzidLink(_RoundTrip, Check): + """ + Checks whether an event whose TZID is a tz database link name, sent with + its VTIMEZONE, is stored with that TZID. Europe/Oslo has been a link to + Europe/Berlin since tzdata 2022b. Bedework 5 refuses it with 403 + unknownTimezone: its time zone service knows a zone only by the TZID + inside its definition, and a link's definition carries its target's. + + A refusal, or a TZID other than either coming back ("unsupported"), counts + only where the same event in Europe/Berlin is stored, and is read back as + Europe/Berlin in the second case. + """ + + depends_on = {PrepareCalendar} + LABEL = "tzid-link" + FEATURE = "save-load.icalendar.tzid-link" + features_to_be_checked = {FEATURE} + UID = "csc_tzid_link_event" + WHAT = "an event in Europe/Oslo" + LINK = "Europe/Oslo" + TARGET = "Europe/Berlin" + + def _body(self, tzid=LINK): + return self._ical(self.uid, vtimezone=CheckVtimezone.VTIMEZONE.replace(self.TARGET, tzid)) + + def _round_trip(self): + verdict = super()._round_trip() + support = verdict["support"] if isinstance(verdict, dict) else verdict + if support not in ("ungraceful", "unsupported"): + return verdict + ## The control: the same event in the zone the link points to + url = self._url(f"{self.uid}_control") + try: + status = self._status(self._put(url, self._body(self.TARGET))) + if status is None: + return self._graded("unknown", f"cannot test, an event in {self.TARGET} got no answer") + if not 200 <= status < 300: + return self._graded("unknown", f"cannot test, an event in {self.TARGET} is refused too ({status})") + if support == "ungraceful": + return verdict + response = self._answer(self.client.request, url) + if not self._ok(response): + return self._unreadable(self._status(response)) + tzid = self._tzid(response.raw) + if tzid != self.TARGET: + return self._graded( + "unknown", f"cannot test, every TZID is renamed: {self.TARGET} comes back as TZID={tzid}" + ) + return verdict + finally: + self._delete(url) + + @staticmethod + def _tzid(raw): + """The TZID of the event's DTSTART, or None""" + dtstart = next((line for line in component_lines(raw, "VEVENT") if line.upper().startswith("DTSTART")), "") + tzid = re.search(r";TZID=([^;:]*)", dtstart, re.IGNORECASE) + return tzid[1].strip('"') if tzid else None + + def _grade(self, raw): + tzid = self._tzid(raw) + if not tzid: + return self._graded("unknown", "cannot test, the event came back without a TZID") + if tzid == self.LINK: + return "full" + if tzid == self.TARGET: + return self._graded("quirk", f"stored as TZID={self.TARGET}, the zone {self.LINK} points to") + return self._graded("unsupported", f"the event comes back with TZID={tzid}") + + class CheckXProperty(_RoundTrip, Check): """ Checks whether an X- property (RFC 5545 section 3.8.8.2) is stored, in an diff --git a/src/caldav_server_tester/future_features.py b/src/caldav_server_tester/future_features.py index fa3a0b4..5cc2c9e 100644 --- a/src/caldav_server_tester/future_features.py +++ b/src/caldav_server_tester/future_features.py @@ -126,6 +126,12 @@ "default": {"support": "full"}, "links": ["https://datatracker.ietf.org/doc/html/rfc4791#section-9.9"], }, + ## caldav PR (feat/tzid-link) + "save-load.icalendar.tzid-link": { + "description": "An object whose TZID is a link name of the tz database (Europe/Oslo, a link to Europe/Berlin since tzdata 2022b; Asia/Calcutta, to Asia/Kolkata), sent with its VTIMEZONE, is stored with that TZID. 'ungraceful' when it is refused: Bedework 5 answers 403 with valid-calendar-object-resource and unknownTimezone, as its time zone service knows each zone by the TZID inside its definition only, and the definition of a link carries its target's. save() then sends the zone the link points to instead, which keeps every time since 1970 where it was (before 1970 a link may have had rules of its own); save(raw_data=...) does not. 'quirk' when the TZID is stored as the zone it points to, the behaviour saying so. 'unsupported' when it comes back as another TZID while an event in the zone it points to keeps its own.", + "default": {"support": "full"}, + "links": ["https://data.iana.org/time-zones/tz-link.html"], + }, } diff --git a/tests/test_tzid_link.py b/tests/test_tzid_link.py new file mode 100644 index 0000000..c26d019 --- /dev/null +++ b/tests/test_tzid_link.py @@ -0,0 +1,99 @@ +"""Whether a TZID that is a tz database link name is stored. + +Bedework 5 refuses Europe/Oslo (a link to Europe/Berlin since tzdata 2022b) +with 403 unknownTimezone, and stores Europe/Berlin. +""" + +import re +from unittest.mock import Mock + +import pytest +from caldav.lib.error import AuthorizationError + +from caldav_server_tester.checks import CheckTzidLink + +from .test_floating_event import RewritingServer +from .test_icalendar_roundtrip import _run + +FEATURE = CheckTzidLink.FEATURE + + +class RefusingLinks(RewritingServer): + """Refuses a body naming ``refused``: Bedework 5, where it is a link name.""" + + def __init__(self, refused="Europe/Oslo", answer=AuthorizationError("403 Forbidden"), **kwargs): + super().__init__(**kwargs) + self.refused = refused + self.answer = answer + self.sent = [] + + def put(self, url, body, headers=None): + self.sent.append(body) + if any(f"TZID={tzid}" in body or f"TZID:{tzid}" in body for tzid in self.refused.split()): + if isinstance(self.answer, Exception): + raise self.answer + return Mock(status=self.answer, headers={}) + return super().put(url, body, headers) + + +def test_kept_is_full_and_the_probe_sends_a_link_with_its_vtimezone(): + server = RefusingLinks(refused="nothing") + assert _run(CheckTzidLink, server)["support"] == "full" + [body] = server.sent + assert re.search(r"\r\nDTSTART;TZID=Europe/Oslo:", body) + assert "BEGIN:VTIMEZONE\r\nTZID:Europe/Oslo\r\n" in body + assert not server.objects + + +@pytest.mark.parametrize("answer", [AuthorizationError("403 Forbidden"), 403, 400]) +def test_refused_while_the_zone_it_points_to_is_stored_is_ungraceful(answer): + server = RefusingLinks(answer=answer) + verdict = _run(CheckTzidLink, server) + assert verdict["support"] == "ungraceful" + assert "Europe/Berlin" in server.sent[-1], "the control is the zone the link points to" + assert not server.objects + + +def test_refused_with_the_zone_it_points_to_too_says_nothing(): + verdict = _run(CheckTzidLink, RefusingLinks(refused="Europe/Oslo Europe/Berlin")) + assert verdict["support"] == "unknown" + + +def test_refused_with_no_answer_for_the_zone_it_points_to_is_unknown(): + server = RefusingLinks(refused="Europe/Oslo") + put = server.put + server.put = lambda url, body, headers=None: ( + Mock(status=503, headers={}) if "TZID=Europe/Berlin" in body else put(url, body, headers) + ) + verdict = _run(CheckTzidLink, server) + assert verdict["support"] == "unknown" + assert "no answer" in verdict["behaviour"] + assert not server.objects + + +def test_stored_as_the_zone_it_points_to_is_a_quirk(): + verdict = _run(CheckTzidLink, RewritingServer(rewrite=lambda body: body.replace("Europe/Oslo", "Europe/Berlin"))) + assert verdict["support"] == "quirk" + assert "Europe/Berlin" in verdict["behaviour"] + + +def test_unanswered_or_unreadable_is_unknown(): + assert _run(CheckTzidLink, RewritingServer(put_answer=503))["support"] == "unknown" + assert _run(CheckTzidLink, RewritingServer(get_status=500))["support"] == "unknown" + + +def test_stored_under_another_name_is_unsupported(): + server = RewritingServer(rewrite=lambda body: body.replace("Europe/Oslo", "Europe/Paris")) + verdict = _run(CheckTzidLink, server) + assert verdict["support"] == "unsupported" + assert "Europe/Paris" in verdict["behaviour"] + assert not server.objects + + +def test_every_tzid_renamed_says_nothing(): + """A server renaming every TZID says nothing about link names.""" + server = RewritingServer(rewrite=lambda body: re.sub(r"TZID([=:])Europe/", r"TZID\1/vendor/Europe/", body)) + verdict = _run(CheckTzidLink, server) + assert verdict["support"] == "unknown" + assert "/vendor/Europe/Berlin" in verdict["behaviour"] + assert not server.objects From 79c489efa6c9ddebaafe906253af56c2a3de64d3 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Sun, 8 Nov 2026 12:52:24 +0100 Subject: [PATCH 2/3] feat: probe a task start without a due Zimbra drops the DTSTART of a task that has no DUE, though RFC 5545 allows either alone, and keeps both where there is a DUE. The new probe stores such a task and grades save-load.todo.dtstart-without-due; where the DTSTART is dropped, the same task with its DUE tells the two cases apart in the behaviour. Zimbra 10.1 comes out unsupported (kept with a DUE), Baikal full. Prompt: ... continue working on getting all the conformance tests passing [in calendaring-client] Followup-Prompt: [add] a tester probe and new caldav hint [for the Zimbra behaviour of dropping a task's DTSTART without a DUE] Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox --- CHANGELOG.md | 1 + src/caldav_server_tester/checks.py | 46 ++++++++++++++++ src/caldav_server_tester/future_features.py | 6 ++ tests/test_todo_dtstart.py | 61 +++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 tests/test_todo_dtstart.py diff --git a/CHANGELOG.md b/CHANGELOG.md index f7365b4..82b9180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This release works with caldav 3.7.0: the tester carries the definitions of the - **`url.encode-at.encoded.href`** - whether a calendar-multiget finds an object named by an href with `%40`, as a GET of that URL does. Robur does not decode the `%40` in the href and answers 404; the literal `@` finds the object. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. - **`search.recurrences.exception.in-calendar-data`** - whether a search returns a recurring event with its exceptions, as a GET has it. Bedework 3.10 and 5 return the master only. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. - **`save-load.icalendar.tzid-link`** - whether an event whose TZID is a tz database link name (Europe/Oslo, a link to Europe/Berlin), sent with its VTIMEZONE, is stored with that TZID. Bedework 5 refuses it with 403 `unknownTimezone` (`ungraceful`); `quirk` where it is stored as Europe/Berlin, `unsupported` where another TZID comes back. A refusal or another TZID counts only where the same event in Europe/Berlin is stored and kept as such. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. +- **`save-load.todo.dtstart-without-due`** - whether a task with a DTSTART and no DUE keeps its DTSTART, and if not, whether a DUE beside it makes a difference. Zimbra drops it, but keeps it beside a DUE. caldav does not define this feature yet, so the tester adds its definition itself until a caldav release has it. ### Fixed diff --git a/src/caldav_server_tester/checks.py b/src/caldav_server_tester/checks.py index 904c9b5..2481fd4 100644 --- a/src/caldav_server_tester/checks.py +++ b/src/caldav_server_tester/checks.py @@ -5739,6 +5739,52 @@ def _grade(self, raw): return self._kept(raw, "ESTIMATED-DURATION") +class CheckTodoDtstartWithoutDue(_RoundTrip, Check): + """ + Checks whether a task with a DTSTART and no DUE is stored with its + DTSTART. RFC 5545 section 3.6.2 allows either alone. Zimbra drops the + DTSTART of such a task, and keeps both where there is a DUE. Where it is + dropped, the same task with its DUE says which of the two this is. + """ + + depends_on = {PrepareCalendar} + LABEL = "todo-dtstart" + FEATURE = "save-load.todo.dtstart-without-due" + features_to_be_checked = {FEATURE} + UID = "csc_todo_dtstart_without_due" + WHAT = "a task with a DTSTART and no DUE" + COMPONENTS = ("VTODO",) + + def _body(self): + return re.sub(r"\r\nDUE[^\r\n]*", "", self._ical(self.uid, todo=True)) + + def _grade(self, raw): + verdict = self._kept(raw, "DTSTART") + if verdict == "full": + return verdict + kept = self._kept_with_due() + if kept is None: + return verdict + return self._graded( + "unsupported", + "the DTSTART is dropped; with a DUE, both are kept" if kept else "the DTSTART is dropped, with a DUE too", + ) + + def _kept_with_due(self): + """Whether the same task with its DUE keeps its DTSTART; None where that cannot be told""" + uid = f"{self.uid}_control" + url = self._url(uid) + try: + if not self._ok(self._put(url, self._ical(uid, todo=True))): + return None + response = self._answer(self.client.request, url) + if not self._ok(response): + return None + return self._kept(response.raw, "DTSTART") == "full" + finally: + self._delete(url) + + class CheckTodoAttendee(_RoundTrip, Check): """ Checks whether a task with an ATTENDEE is stored with it. Ox answers the diff --git a/src/caldav_server_tester/future_features.py b/src/caldav_server_tester/future_features.py index 5cc2c9e..6e339a0 100644 --- a/src/caldav_server_tester/future_features.py +++ b/src/caldav_server_tester/future_features.py @@ -132,6 +132,12 @@ "default": {"support": "full"}, "links": ["https://data.iana.org/time-zones/tz-link.html"], }, + ## caldav PR (feat/todo-dtstart-hint) + "save-load.todo.dtstart-without-due": { + "description": "A task with a DTSTART and no DUE (RFC 5545 section 3.6.2 allows either alone) is stored with its DTSTART. 'unsupported' when the DTSTART is dropped, the behaviour saying whether it is kept beside a DUE: Zimbra drops it, but keeps it where the task also has a DUE.", + "default": {"support": "full"}, + "links": ["https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.2"], + }, } diff --git a/tests/test_todo_dtstart.py b/tests/test_todo_dtstart.py new file mode 100644 index 0000000..1bb417b --- /dev/null +++ b/tests/test_todo_dtstart.py @@ -0,0 +1,61 @@ +"""Whether a task with a DTSTART and no DUE keeps its DTSTART. + +Zimbra drops it; with a DUE it keeps both. +""" + +import re + +from caldav_server_tester.checks import CheckTodoDtstartWithoutDue + +from .test_floating_event import RewritingServer +from .test_icalendar_roundtrip import TASKS, _run + + +def _drop_dtstart(body): + return re.sub(r"DTSTART[^\r\n]*\r\n", "", body) + + +def test_kept_is_full_and_the_probe_sends_a_task_without_due(): + sent = [] + server = RewritingServer(rewrite=lambda body: sent.append(body) or body) + assert _run(CheckTodoDtstartWithoutDue, server)["support"] == "full" + [body] = sent + assert "BEGIN:VTODO" in body and "\r\nDTSTART:" in body + assert "DUE" not in body + assert not server.objects + + +def test_dropped_only_without_a_due_is_unsupported(): + """Zimbra: the control, the same task with its DUE, keeps both.""" + server = RewritingServer(rewrite=lambda body: body if "\r\nDUE" in body else _drop_dtstart(body)) + verdict = _run(CheckTodoDtstartWithoutDue, server) + assert verdict == {"support": "unsupported", "behaviour": "the DTSTART is dropped; with a DUE, both are kept"} + assert not server.objects + + +def test_dropped_with_a_due_too_says_so(): + server = RewritingServer(rewrite=_drop_dtstart) + verdict = _run(CheckTodoDtstartWithoutDue, server) + assert verdict == {"support": "unsupported", "behaviour": "the DTSTART is dropped, with a DUE too"} + assert not server.objects + + +def test_refused_is_ungraceful(): + assert _run(CheckTodoDtstartWithoutDue, RewritingServer(put_answer=403))["support"] == "ungraceful" + + +def test_the_task_goes_to_the_task_calendar(): + server = RewritingServer() + seen = [] + put = server.put + server.put = lambda url, body, headers=None: seen.append(url) or put(url, body, headers) + _run(CheckTodoDtstartWithoutDue, server) + assert seen and all(url.startswith(TASKS) for url in seen) + + +def test_not_probed_where_tasks_cannot_be_stored(): + sent = [] + _run( + CheckTodoDtstartWithoutDue, RewritingServer(rewrite=lambda body: sent.append(body) or body), todo="unsupported" + ) + assert sent == [] From 54522b96d30758356952f1fa0d893ff06405cc83 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Sun, 15 Nov 2026 13:21:39 +0100 Subject: [PATCH 3/3] test: keep a system pytest-asyncio out of the run With filterwarnings = ["error"], a system-wide pytest-asyncio turns its "asyncio_default_fixture_loop_scope is unset" deprecation warning into a fatal error. Setting that option instead would make pytest without the plugin (as in CI) fail on an unknown config option, so disable the plugin; there are no async tests. Prompt: Check tmp-handover-2026-11-15T125003-197a233b.md - add the asyncio_default_fixture_loop_scope fix to pyproject.toml in the PR#62. I will push it manually, no need with a full review procedure for this [the handover file is a session note; PR#62 is https://github.com/python-caldav/caldav-server-tester/pull/62] Assisted-By: Claude Opus 5.5 --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 005629b..17633bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,6 +102,9 @@ known-first-party = ["caldav_server_tester"] [tool.pytest.ini_options] testpaths = ["tests"] filterwarnings = ["error"] +# No async tests here; a pytest-asyncio installed system-wide would +# otherwise fail the run with a deprecation warning made fatal above. +addopts = "-p no:asyncio" markers = [ "slow: marks tests as slow (deselect with '-m \"not slow\"')", ]