Skip to content

store: remove stale calendar events after date changes - #263

Closed
anish749 wants to merge 1 commit into
mainfrom
fix-calendar-stale-cleanup
Closed

store: remove stale calendar events after date changes#263
anish749 wants to merge 1 commit into
mainfrom
fix-calendar-stale-cleanup

Conversation

@anish749

Copy link
Copy Markdown
Owner

Cross-file dedup pass for calendar events in Maintain.

When an event moves dates or a multi-day event shrinks, stale copies
linger in old date files. Scans all date files per calendar, picks the
most recently updated version of each event, and removes copies from
files outside the event's current DatesForStorage range.

@anish749 anish749 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues to address:

  1. Path construction belongs in paths module. filepath.Join(ad.Path(), paths.GcalendarSubdir) in deduplicateCalendarEvents should be a method on AccountDir (e.g. ad.GcalendarDir() returning the path), keeping the store layer free of path construction. Same layering rule as the rest of the codebase.

  2. "Latest" event version uses string comparison on Runtime.Updated. This works for RFC 3339 timestamps lexicographically, but it's implicit. Consider parsing to time.Time for the comparison, or at minimum add a comment explaining why string comparison is safe here. Also need to handle the case where Updated is empty.

@anish749

Copy link
Copy Markdown
Owner Author

Superseded by #266 which takes a cleaner reshuffle approach.

@anish749 anish749 closed this Apr 19, 2026
@anish749
anish749 deleted the fix-calendar-stale-cleanup branch July 9, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant