-
Notifications
You must be signed in to change notification settings - Fork 3
Make parsing and assumptions about UID/RECURRENCE-ID explicit #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ba1052c to
f8d18db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request centralizes iCalendar parsing and makes UID/RECURRENCE-ID handling explicit across the library and tests.
- Introduces
ICalendarParserfor preprocessing and wrapping parse errors. - Adds
CalendarUidSplitterandAssociatedComponentsto group and validate events by UID and RECURRENCE-ID. - Refactors higher-level consumers (
ICalendar,Event,AndroidEvent) to use the new parser and splitter, and standardizes exception types.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ICalendarParser.kt | New parser class applying ICalPreprocessor with explicit error wrapping. |
| CalendarUidSplitter.kt | Splits components by UID/RECURRENCE-ID and filters by highest sequence. |
| AssociatedComponents.kt | Data class enforcing main/exception UID constraints. |
| Ical4jHelpers.kt | Helper factories and extension properties for CalendarComponent. |
| ICalendar.kt | Switched to ICalendarParser and unified exception types. |
| Event.kt & AndroidEvent.kt | Updated to use new parser/splitter and InvalidLocalResourceException. |
| lib/src/test/... (multiple) | New unit tests covering parser, splitter, and associated components. |
| build.gradle.kts & libs.versions.toml | Added MockK dependency for new parser tests. |
Comments suppressed due to low confidence (1)
lib/src/main/kotlin/at/bitfire/synctools/icalendar/Ical4jHelpers.kt:18
- [nitpick] Add KDoc describing the purpose and expected usage of this helper function to improve discoverability and maintenance.
fun<T: CalendarComponent> componentListOf(vararg components: T) =
lib/src/main/kotlin/at/bitfire/synctools/icalendar/CalendarUidSplitter.kt
Show resolved
Hide resolved
sunkup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me a while to understand, but I think the functionality from the original Event.eventsFromReader is preserved and it's a lot cleaner and safer now!
For: bitfireAT/davx5-ose#1554
Currently iCalendar parsing and UID/RECURRENCE-ID splitting is done in the
Eventdata class, where it does not belong to. This PRICalendarParser(+ tests),CalendarUidSplitter(+ tests),AssociatedComponentsto associate a main event and its exceptions (+ tests).There's a FIXME in the code, but it keeps current behavior and fixing that is not in the scope of this PR. I just added the comment to mark that code as bad.
CC @sunkup: Please have a look and comment especially if the "whole thing" that it does is unclear. I tried to add as good KDoc as possible. I however understand that it's hard to review this PR when its taken out of the whole refactoring context.