@@ -79,6 +79,26 @@ def _reachable(host: str, port: int) -> bool:
7979)
8080
8181
82+ def _xfail_cyrus_in_calendar (request , server ) -> None :
83+ """Mark the current test ``xfail`` when running against Cyrus.
84+
85+ Current Cyrus rejects the spec-correct singular ``inCalendar`` query
86+ filter this client sends (see issue #91); not a client bug, so not
87+ worked around. Any test whose only Cyrus-side failure is this calls
88+ this instead of hardcoding an assertion against non-compliant behavior.
89+ A class-level ``@_sync_servers`` parametrize mark can't carry a
90+ per-param xfail for just one test in a mixed class, so this is applied
91+ dynamically from inside the test body instead.
92+ """
93+ if server == "cyrus" :
94+ request .node .add_marker (
95+ pytest .mark .xfail (
96+ reason = "Cyrus rejects the spec-correct singular inCalendar filter, see #91" ,
97+ raises = JMAPMethodError ,
98+ )
99+ )
100+
101+
82102_DEFAULT_ICAL_START = datetime (2026 , 6 , 1 , 10 , 0 , 0 , tzinfo = timezone .utc )
83103
84104
@@ -176,9 +196,9 @@ def _invite_ical(
176196 partstat : str = "NEEDS-ACTION" ,
177197) -> str :
178198 """``role``/``partstat`` default to REQ-PARTICIPANT/NEEDS-ACTION, mapping
179- to ``roles: {"attendee": true}``, confirmed live to be dropped by both
180- Cyrus and Stalwart . Pass ``role="CHAIR"`` for a role that survives on
181- both servers instead ."""
199+ to ``roles: {"attendee": true}``. Confirmed live that Stalwart drops
200+ this role on read-back; current Cyrus keeps it . Pass ``role="CHAIR"``
201+ for a role that survives on both servers."""
182202 extra_lines = (
183203 f"ORGANIZER:mailto:{ organizer_email } \r \n "
184204 f"ATTENDEE;ROLE={ role } ;PARTSTAT={ partstat } ;RSVP=TRUE:mailto:{ attendee_email } \r \n "
@@ -554,6 +574,7 @@ def test_share_calendar_grants_visible_to_second_account(
554574
555575 def test_add_event_to_shared_calendar_targets_owner_account (
556576 self ,
577+ request ,
557578 calendar_management_client ,
558579 second_account_client ,
559580 second_account_id ,
@@ -565,6 +586,7 @@ def test_add_event_to_shared_calendar_targets_owner_account(
565586 event under the owner's account rather than the sharee's own. This
566587 is the fix for a gap where a calendar fetched from someone else's
567588 account silently routed writes back to the caller's own account."""
589+ _xfail_cyrus_in_calendar (request , server )
568590 cal_id = calendar_management_client .create_calendar ("Write Shared Integration Calendar" )
569591 try :
570592 calendar_management_client .share_calendar (
@@ -589,6 +611,7 @@ def test_add_event_to_shared_calendar_targets_owner_account(
589611
590612 def test_edit_and_delete_event_on_shared_calendar_targets_owner_account (
591613 self ,
614+ request ,
592615 calendar_management_client ,
593616 second_account_client ,
594617 second_account_id ,
@@ -598,6 +621,7 @@ def test_edit_and_delete_event_on_shared_calendar_targets_owner_account(
598621 """save() and delete_event() must route through the calendar's owning
599622 account too, the same way add_event() does. Both take the object's
600623 parent._account_id, not the sharee's own session account."""
624+ _xfail_cyrus_in_calendar (request , server )
601625 cal_id = calendar_management_client .create_calendar ("Edit Shared Integration Calendar" )
602626 try :
603627 calendar_management_client .share_calendar (
@@ -902,7 +926,8 @@ def test_event_delete(self, event_client, event_calendar_id):
902926 with pytest .raises (JMAPMethodError ):
903927 event_client .get_event (event_id )
904928
905- def test_event_query_time_range (self , event_client , event_calendar_id ):
929+ def test_event_query_time_range (self , request , event_client , event_calendar_id , server ):
930+ _xfail_cyrus_in_calendar (request , server )
906931 title = "Query Range Test Event"
907932 event_id , _ , _ = event_client .create_event (
908933 event_calendar_id , _minimal_event (title , calendar_id = event_calendar_id )
@@ -1606,6 +1631,10 @@ async def test_event_delete(self, async_client, async_calendar_id):
16061631 await async_client .get_event (event_id )
16071632
16081633 @pytest .mark .asyncio
1634+ @pytest .mark .xfail (
1635+ reason = "Cyrus rejects the spec-correct singular inCalendar filter, see #91" ,
1636+ raises = JMAPMethodError ,
1637+ )
16091638 async def test_event_query_time_range (
16101639 self , async_client , async_calendar_id , async_created_event_id
16111640 ):
@@ -2091,8 +2120,15 @@ class TestRicherEventSearchIntegration:
20912120 """
20922121
20932122 def test_has_attachment_true_finds_event_with_attachment (
2094- self , event_client , event_calendar_id , server
2123+ self , request , event_client , event_calendar_id , server
20952124 ):
2125+ # Cyrus used to drop rel: "enclosure" on read-back, so this event
2126+ # would never match has_attachment=True there; confirmed live that
2127+ # the current pinned Cyrus image no longer has that bug, so both
2128+ # servers are expected to match now. Still xfails on Cyrus because
2129+ # search_events itself fails first on the inCalendar regression
2130+ # (#91), before has_attachment ever gets evaluated client-side.
2131+ _xfail_cyrus_in_calendar (request , server )
20962132 event_id , _ , _ = event_client .create_event (
20972133 event_calendar_id , ical_to_jscal (_attachment_ical (), calendar_id = event_calendar_id )
20982134 )
@@ -2101,16 +2137,7 @@ def test_has_attachment_true_finds_event_with_attachment(
21012137 calendar_id = event_calendar_id , has_attachment = True
21022138 ).events
21032139 matched = any (r .id == event_id for r in results )
2104- if server == "cyrus" :
2105- # Cyrus drops rel: "enclosure" on read-back, seen against a
2106- # running instance, so has_attachment=True cannot find this event there.
2107- assert not matched , (
2108- f"{ server } : expected has_attachment=True to miss this event "
2109- "(known rel: enclosure drop); it matched instead, meaning "
2110- "the Cyrus bug this test documents may have been fixed."
2111- )
2112- else :
2113- assert matched , f"{ server } : has_attachment=True did not find the event."
2140+ assert matched , f"{ server } : has_attachment=True did not find the event."
21142141 finally :
21152142 event_client .delete_event (event_id )
21162143
@@ -2131,12 +2158,13 @@ def test_has_attachment_false_excludes_event_with_attachment_on_stalwart(
21312158 event_client .delete_event (event_id )
21322159
21332160 def test_chair_participant_matches_email_status_and_role_filters (
2134- self , event_client , event_calendar_id , owner_email , server
2161+ self , request , event_client , event_calendar_id , owner_email , server
21352162 ):
21362163 """One CHAIR/ACCEPTED participant, so a single seeded event
21372164 exercises participant_email, participation_status, and
21382165 participant_role together instead of three near-identical
21392166 create/search/delete sequences."""
2167+ _xfail_cyrus_in_calendar (request , server )
21402168 chair_email = "chair-filter-test@example.com"
21412169 event_id , _ , _ = event_client .create_event (
21422170 event_calendar_id ,
@@ -2168,12 +2196,14 @@ def test_chair_participant_matches_email_status_and_role_filters(
21682196 event_client .delete_event (event_id )
21692197
21702198 def test_participant_role_attendee_confirmed_dropped (
2171- self , event_client , event_calendar_id , owner_email , server
2199+ self , request , event_client , event_calendar_id , owner_email , server
21722200 ):
2173- """Locks in the confirmed-live finding that both Cyrus and Stalwart
2174- drop the "attendee" role from a participant's roles map: this
2175- assertion should start failing, not silently pass, the day either
2176- server stops doing that."""
2201+ """Locks in the confirmed-live finding that Stalwart drops the
2202+ "attendee" role from a participant's roles map: this assertion
2203+ should start failing, not silently pass, the day it stops doing
2204+ that. Current Cyrus keeps the role and matches correctly, confirmed
2205+ live, so this is Stalwart-specific, not a shared server quirk."""
2206+ _xfail_cyrus_in_calendar (request , server )
21772207 attendee_email = "attendee-role-gap-test@example.com"
21782208 event_id , _ , _ = event_client .create_event (
21792209 event_calendar_id ,
@@ -2183,16 +2213,20 @@ def test_participant_role_attendee_confirmed_dropped(
21832213 results = event_client .search_events (
21842214 calendar_id = event_calendar_id , participant_role = "attendee"
21852215 ).events
2186- assert not any (r .id == event_id for r in results ), (
2187- f"{ server } : participant_role='attendee' matched the seeded "
2188- "participant; the confirmed-live role-drop bug this test "
2189- "documents may have been fixed server-side."
2190- )
2216+ matched = any (r .id == event_id for r in results )
2217+ if server == "stalwart" :
2218+ assert not matched , (
2219+ f"{ server } : participant_role='attendee' matched the seeded "
2220+ "participant; the confirmed-live role-drop bug this test "
2221+ "documents may have been fixed server-side."
2222+ )
2223+ else :
2224+ assert matched , f"{ server } : participant_role='attendee' did not find the event."
21912225 finally :
21922226 event_client .delete_event (event_id )
21932227
21942228 def test_search_events_limit_caps_page_and_total_reflects_full_count (
2195- self , event_client , event_calendar_id , server
2229+ self , request , event_client , event_calendar_id , server
21962230 ):
21972231 """Confirmed live this session: Cyrus includes total unconditionally
21982232 in CalendarEvent/query responses, even when calculateTotal was never
@@ -2201,6 +2235,7 @@ def test_search_events_limit_caps_page_and_total_reflects_full_count(
22012235 against a real server's response unless calculate_total=True was
22022236 actually passed, not merely whether the server happened to include
22032237 one."""
2238+ _xfail_cyrus_in_calendar (request , server )
22042239 event_ids = [
22052240 event_client .create_event (
22062241 event_calendar_id ,
0 commit comments