From 0ddb47d393b3ad180de737aa15c041a52066b684 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Fri, 6 Nov 2026 17:17:08 +0100 Subject: [PATCH 1/2] fix: native ids are emulated on SOGo When the client picks an object's name, creating it must not overwrite another object already stored under that name. The PUT carries If-None-Match: * for that, but SOGo and Zimbra ignore the header, and identity.client-native-id was still declared full there. On SOGo it is now emulated: caldav 3.7 checks the name with a GET before the PUT, which leaves a short window for a race. caldav only does that where the server refuses a second object with the same UID and keeps the names it is given; on other servers ignoring the header the feature is unsupported. Zimbra was unsupported already, since it renames every object to its UID. Prompt: Continue working on tmp-handover-sogo-fixes-2026-10-23.md [a handover document: make the conformance suite pass on SOGo, by fixing calendaring rather than filing issues] Followup-Prompt: (answer to a clarifying question) caldav [the check for an object already at the URL goes into caldav, not calendaring] Followup-Prompt: investigate the local branches that contains (sic) orphaned work. Followup-Prompt: (...) native-id-emulated sounds like it deserves a PR. So make one PR combining those two, perhaps? Assisted-By: Claude Opus 5.5 Reviewed-by: Tobias Brox --- news/+native-id-if-none-match.bugfix.rst | 1 + src/calendaring/_caldav_features.py | 15 +++++++++++++ tests/test_caldav_features.py | 27 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 news/+native-id-if-none-match.bugfix.rst diff --git a/news/+native-id-if-none-match.bugfix.rst b/news/+native-id-if-none-match.bugfix.rst new file mode 100644 index 0000000..0697b1b --- /dev/null +++ b/news/+native-id-if-none-match.bugfix.rst @@ -0,0 +1 @@ +On SOGo, which ignores ``If-None-Match: *``, ``identity.client-native-id`` is now declared ``emulated``: caldav looks the name up before creating an object there, so a create under a name already taken is refused, with a short window between the look-up and the write. diff --git a/src/calendaring/_caldav_features.py b/src/calendaring/_caldav_features.py index df9c0ee..4a47d05 100644 --- a/src/calendaring/_caldav_features.py +++ b/src/calendaring/_caldav_features.py @@ -152,6 +152,21 @@ def _table(features: Any) -> dict[Feature, Any]: notes.append("made for one component only, the first in sorted order") if notes: table[Feature.CREATE_COLLECTION] = {"level": L, "note": "; ".join(notes)} + if _level(features, "save.if-none-match") is U: # the server overwrites a name already taken + # caldav then GETs the name before the PUT where a duplicate UID is refused and names are kept (SOGo), + # and otherwise searches by UID, which leaves the name unguarded + if str(features.is_supported("save.no-uid-conflict", str)) in {"full", "quirk", "ungraceful"} and ( + features.is_supported("save-load.stable-url") + ): + table[Feature.IDENTITY_CLIENT_NATIVE_ID] = { + "level": E, + "note": "caldav looks the name up before the PUT, racily", + } + else: + table[Feature.IDENTITY_CLIENT_NATIVE_ID] = { + "level": U, + "note": "the server overwrites an object under a name already taken", + } return table diff --git a/tests/test_caldav_features.py b/tests/test_caldav_features.py index 3e33a2b..f02f7ae 100644 --- a/tests/test_caldav_features.py +++ b/tests/test_caldav_features.py @@ -357,6 +357,33 @@ def test_a_calendar_does_not_hold_what_the_server_refuses_to_store() -> None: assert stored_components(features(), listed) == listed # unhinted: nothing known +def test_a_name_is_checked_before_the_put_where_the_server_ignores_if_none_match() -> None: + # SOGo: caldav GETs the name first, as the server refuses a duplicate UID and keeps the name + ignoring = {"save-load": {"support": "full"}, "save.if-none-match": {"support": "unsupported"}} + refusing = {"save.no-uid-conflict": {"support": "quirk", "status": 409, "precondition": False}} + server = features({**ignoring, **refusing}) + table = collection_capabilities(server, ALL) + assert table.level(Feature.IDENTITY_CLIENT_NATIVE_ID) is Support.EMULATED + assert "before" in (table[Feature.IDENTITY_CLIENT_NATIVE_ID].note or "") + assert ( + collection_capabilities(hinted(save_load="full"), ALL).level(Feature.IDENTITY_CLIENT_NATIVE_ID) is Support.FULL + ) + # Zimbra ignores it too, but renames every object: no native id at all + renaming = features( + { + "save-load": {"support": "full"}, + "save.if-none-match": {"support": "unsupported"}, + "save-load.stable-url": {"support": "unsupported", "forces_uid_ics": True}, + } + ) + assert collection_capabilities(renaming, ALL).level(Feature.IDENTITY_CLIENT_NATIVE_ID) is Support.UNSUPPORTED + # Not known to refuse a duplicate UID: caldav searches by UID, which leaves the name unguarded + searching = features(ignoring) + assert collection_capabilities(searching, ALL).level(Feature.IDENTITY_CLIENT_NATIVE_ID) is Support.UNSUPPORTED + unstable = features({**ignoring, **refusing, "save-load.stable-url": {"support": "unsupported"}}) + assert collection_capabilities(unstable, ALL).level(Feature.IDENTITY_CLIENT_NATIVE_ID) is Support.UNSUPPORTED + + def test_a_calendar_is_made_lossily_where_the_server_ignores_the_component_set() -> None: server = hinted(save_load="full", create_calendar="full") assert backend_capabilities(server).level(Feature.CREATE_COLLECTION) is Support.FULL From 3bd05a549ee639c539da587e5ce12f5c122f5453 Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Fri, 30 Oct 2026 21:30:53 +0100 Subject: [PATCH 2/2] docs(roadmap): tick the shared config file in 1.4 caldav reads its configuration through calendaring-config since 3.6.0, which closed caldav issue 786, and the file name follows the proposal: $XDG_CONFIG_HOME/pycal/calendar.yaml first, caldav's old paths as fallbacks. The box still said caldav had yet to adopt it. https://github.com/python-caldav/caldav/pull/804 Prompt: Please check all the checkboxes that should be checked [in the NLnet-funded roadmaps, while drafting payment requests] Assisted-By: Claude Opus 5.5 (Claude Code) Reviewed-by: Tobias Brox --- docs/design/ROADMAP.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/design/ROADMAP.md b/docs/design/ROADMAP.md index ff87401..6410ba3 100644 --- a/docs/design/ROADMAP.md +++ b/docs/design/ROADMAP.md @@ -392,13 +392,16 @@ therefore has a committed downstream consumer and should not be trimmed. - [x] Config file discovery (XDG paths, explicit path, environment) - [x] Credential handling: keyring integration, and never requiring secrets in plaintext config -- [ ] Settle the shared file with the caldav and calendaring-jmap +- [x] Settle the shared file with the caldav and calendaring-jmap maintainers: see [CONFIGURATION_PROPOSAL.md](CONFIGURATION_PROPOSAL.md). The parser is now a package of its own, - [calendaring-config](https://github.com/pycalendar/calendaring-config); - caldav has yet to adopt it - ([caldav issue #786](https://github.com/python-caldav/caldav/issues/786)), - and the file name is still open. + [calendaring-config](https://github.com/pycalendar/calendaring-config), + and caldav reads its configuration through it since 3.6.0 + ([caldav PR #804](https://github.com/python-caldav/caldav/pull/804), + closing [caldav issue #786](https://github.com/python-caldav/caldav/issues/786)). + `$XDG_CONFIG_HOME/pycal/calendar.yaml` is searched first, with caldav's + old paths as fallbacks. calendaring-jmap keeps its own flat file for + standalone use, and gets its section passed from calendaring. - [x] Check existing conventions first — `caldav`, `plann`, `vdirsyncer`, `khal`, etc — rather than inventing a fifth format (probably build on the caldav format) - [x] Leave room for backends beyond the funded ones without format changes: