[jtx rewrite] Add Handlers for Recurrence Fields#410
Conversation
There was a problem hiding this comment.
Pull request overview
Adds recurrence-field mapping from jtx Board rows to ical4j components as part of the ongoing jtx rewrite, plus unit tests to validate the new handler behavior.
Changes:
- Introduces
RecurrenceFieldsHandlerto mapRRULE,RDATE,EXDATE, and exceptionRECURRENCE-ID. - Registers the new handler in
JtxObjectHandler. - Adds
RecurrenceFieldsHandlerTestcovering multiple timezone/all-day/floating scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/src/main/kotlin/at/bitfire/synctools/mapping/jtx/JtxObjectHandler.kt | Registers the new recurrence handler; currently gates exception mapping based only on RRULE. |
| lib/src/main/kotlin/at/bitfire/synctools/mapping/jtx/handler/RecurrenceFieldsHandler.kt | Implements mapping from jtx recurrence columns to iCal properties (main + exceptions). |
| lib/src/test/kotlin/at/bitfire/synctools/mapping/jtx/handler/RecurrenceFieldsHandlerTest.kt | Adds unit tests for RRULE/RDATE/EXDATE/RECURID across timezone modes. |
Comments suppressed due to low confidence (1)
lib/src/main/kotlin/at/bitfire/synctools/mapping/jtx/handler/RecurrenceFieldsHandler.kt:115
- issue (blocking): Invalid
DTSTART_TIMEZONEvalues should fall back to UTC instead of dropping RDATE/EXDATE.
JtxContract.JtxICalObject.DTSTART_TIMEZONE documents that invalid timezone IDs must be ignored and interpreted as UTC. Currently, ZoneId.of(dtstartTimezone) can throw and causes the whole RDATE/EXDATE mapping to be skipped (caught in processMain). Handle invalid/unknown timezone IDs inside timestampsToDateList() and fall back to UTC so recurrence sets are still preserved.
else ->
DateList(timestamps.map {
ZonedDateTime.ofInstant(Instant.ofEpochMilli(it), ZoneId.of(dtstartTimezone))
})
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
lib/src/main/kotlin/at/bitfire/synctools/mapping/jtx/handler/RecurrenceFieldsHandler.kt:75
- issue (blocking): EXDATE mapping has the same missing-parameter problem as RDATE.
When timestampsToDateList() returns ZonedDateTime or LocalDate, the resulting ExDate(DateList(...)) should carry TZID or VALUE=DATE respectively; otherwise the iCalendar semantics can change (timezone dropped, dates interpreted as DATE-TIME).
values.getAsString(JtxContract.JtxICalObject.EXDATE)?.takeIf { it.isNotBlank() }?.let { exdateString ->
try {
val timestamps = JtxContract.getLongListFromString(exdateString)
if (timestamps.isNotEmpty()) {
to += ExDate(timestampsToDateList(timestamps, dtstartTimezone))
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Added
RecurrenceFieldsHandlerand tests.