FossifyOrg / Calendar

A simple calendar with events, customizable widgets and no ads.
https://www.fossify.org
GNU General Public License v3.0
637 stars 51 forks source link

Repeated events from Google calendar with items deleted a while ago don't appear as deleted in Calendar #267

Open lf- opened 1 month ago

lf- commented 1 month ago

Checklist

Affected app version

1.0.3

Affected Android/Custom ROM version

14 (AP2A.240605.024)

Affected device model

Pixel 6

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug

I'm really sorry but this is not consistently reproducible. I tried reproducing it by making a new event and then deleting instances of the repeated event in Google Calendar.

The situation that was implicated in this is:

  1. Synced calendar "CalDAV" (that is, the system calendar feature) from Google Calendar
  2. Old repeated event that's been there for a year
  3. Delete two instances of the event in Google calendar before installing Fossify Calendar on the phone
  4. The deleted event instances still appear in Fossify Calendar.

Deleting the excess events from inside Fossify Calendar will cause them to persistently vanish even after deleting the app and reinstalling it, so whatever it does unhaunts the event properly.

I'm going to try to export the calendar from both sides and see if I can diff the broken events. But I'm terribly sorry it's so hard to reproduce.

I've attempted the following reproducer and failed:

  1. Set up synced calendar in Fossify.
  2. Create repeated event on synced calendar from Google Calendar app
  3. Delete two instances from Google Calendar
  4. Hopefully (but unsuccessfully) observe that the thing happens.

I've not yet tried doing the thing while the app is deleted.

Expected behavior

I expect the exceptions to repeated events to sync their removal status correctly from Google Calendar synced calendars.

Actual behavior

Certain exceptions to repeated events aren't correctly synchronized to Fossify Calendar.

Screenshots/Screen recordings

Can't sufficiently anonymize it, sorry. Imagine a calendar with weekly events with ones in weeks that you deleted earlier.

Additional information

No response

lf- commented 1 month ago

I have found the cause of this bug. It's that the exclusion dates aren't properly considering the timezone of the calendar and instead are processed in device timezone. So if you have an event in your home timezone and then view it while 9h away such that they cross a date boundary, the exclusions get missed.

Consider the following event:

BEGIN:VEVENT
SUMMARY:the-event
UID:Caldav-13-925
X-FOSSIFY-CATEGORY-COLOR:-6299161
CATEGORIES:redacted@redacted.redacted
LAST-MODIFIED:19700101T000000Z
TRANSP:OPAQUE
DTSTART:20231005T000500Z
DTEND:20231005T010500Z
X-FOSSIFY-MISSING-YEAR:0
DTSTAMP:20240708T141428Z
STATUS:CONFIRMED
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
BEGIN:VALARM
DESCRIPTION:Herinnering
ACTION:DISPLAY
TRIGGER:-P0DT0H10M0S
END:VALARM
EXDATE:20240704
EXDATE:20240711
EXDATE:20240718
EXDATE:20240725
------- NOTE!! THESE ONES WERE ADDED BY FOSSIFY CALENDAR WHEN I DELETED THOSE EVENT INSTANCES ----------
EXDATE:20240710
EXDATE:20240717
EXDATE:20240724
END:VEVENT

Compare to the Google Calendar export (I cannot confirm that this is what is actually what the app gets from the system calendar service but you note it has timezones all over it):

BEGIN:VEVENT
DTSTART;TZID=America/Vancouver:20231004T170500
DTEND;TZID=America/Vancouver:20231004T180500
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=America/Vancouver:20240703T170500
EXDATE;TZID=America/Vancouver:20240710T170500
EXDATE;TZID=America/Vancouver:20240717T170500
EXDATE;TZID=America/Vancouver:20240724T170500
DTSTAMP:20240708T142611Z
UID:meow@google.com
CREATED:20230731T215015Z
LAST-MODIFIED:20240702T194413Z
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:the-event
TRANSP:OPAQUE
END:VEVENT