Bug 447966

Summary: Moved single appointment from recurring event is not shown
Product: [Frameworks and Libraries] Akonadi Reporter: Tobias Kaminsky <tobias>
Component: DAV ResourceAssignee: kdepim bugs <pim-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dev, dominique.michel
Priority: NOR    
Version First Reported In: 5.19.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.31
Sentry Crash Report:
Attachments: General rule
Moved event (06.01.)

Description Tobias Kaminsky 2022-01-05 10:26:22 UTC
Created attachment 145125 [details]
General rule

SUMMARY
Move one event of an recurring appointment and it is not shown.

Similar to https://bugs.kde.org/show_bug.cgi?id=328585


STEPS TO REPRODUCE
1. create an recurring event, e.g. every second Sunday of December
2. moving 13.12.21 to 06.01 by editing only this specific entry (done via business calendar on Android, synced with DavX5 to Nextcloud; not sure if this is needed info)


OBSERVED RESULT
See that Thunderbird shows this moved event on 06.01, but korganizer and kalendar not

EXPECTED RESULT
Moved event should be shown

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
Kontact 5.19.0 (21.12.0) via Arch
KDE Plasma Version: 
KDE Frameworks Version: 5.89.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
As an attachement: 06.01. and general rule
Comment 1 Tobias Kaminsky 2022-01-05 10:26:48 UTC
Created attachment 145126 [details]
Moved event (06.01.)
Comment 2 Ferenc Lengyel 2026-09-21 19:01:46 UTC
Still present with Merkuro 26.08.1, KCalendarCore 6.30.0 (Arch/CachyOS). Not specific to the DAV resource: reproduced with an Akonadi iCal file resource subscribed to a Google Calendar public .ics feed.

Data: a weekly series (RRULE:FREQ=WEEKLY;BYDAY=MO, 16:00) with one exception, RECURRENCE-ID 2026-10-26T16:00 Europe/Budapest, DTSTART 2026-10-13T09:00. Akonadi stores the exception as its own item and it is correct in akonadiconsole.

Observed in Merkuro: the moved occurrence is missing on 13 October from the week, work week, 3-day and day views. It appears in the October month view, because that view's range also contains 26 October.

Cause: KCalendarCore OccurrenceIterator, setupIterator() in src/occurrenceiterator.cpp:
https://invent.kde.org/frameworks/kcalendarcore/-/blob/2ad30ad3a286d90f84bdd963a9ea905701d82de9/src/occurrenceiterator.cpp#L104-162

Incidences with a RECURRENCE-ID are skipped at the top of the loop. Exceptions are added back only while expanding the parent's recurrence->timesInInterval(start, end), matched by RECURRENCE-ID. So an exception is emitted only when its original date is inside the requested range. One moved into the range from outside it is never returned.

Merkuro's IncidenceOccurrenceModel uses OccurrenceIterator for all its views, which explains the difference between the month view and the others. Same symptom as bug 328585 (KOrganizer agenda view, closed as unmaintained) and probably bug 507088.

Suggested product/component: frameworks-kcalendarcore.

Possible fix: after expanding the parent, also check the parent's exceptions (calendar.instances(inc)) that were not matched, and emit the ones whose own DTSTART/DTEND overlaps [start, end].
Comment 3 Dominique 2026-10-09 12:58:49 UTC
Hello 👋
I managed to reproduce the issue and confirm the diagnosis made by Ferenc Lengyel.

I have been working on a fix for this bug here https://invent.kde.org/frameworks/kcalendarcore/-/merge_requests/262 along with a test covering th issue.
After some manual testing, the problem seems solved on my machine, I hope it's goint to be merged soon.
Comment 4 Dominique 2026-10-11 20:01:22 UTC
Git commit e978dd3385760dd5cb5e6bf389e3957795d14d43 by Dominique MICHEL.
Committed on 11/10/2026 at 19:47.
Pushed by aloeil into branch 'master'.

Fix far event exception not being returned in iterator

When an event has an exception and that exception is far from it's
original occurence, it could not appear in clients.
The filtering was only replacing occurences with exceptions, but if an
exception was moved far from it's occurence, it was not visible.

Now we show any exception that are included in the range.

M  +45   -0    autotests/testoccurrenceiterator.cpp
M  +1    -0    autotests/testoccurrenceiterator.h
M  +18   -1    src/occurrenceiterator.cpp

https://invent.kde.org/frameworks/kcalendarcore/-/commit/e978dd3385760dd5cb5e6bf389e3957795d14d43