Skip to content

[jtx rewrite] Add Handlers for Recurrence Fields#410

Open
ArnyminerZ wants to merge 8 commits into
mainfrom
409-jtx-rewrite-add-handlers-for-recurrence-fields
Open

[jtx rewrite] Add Handlers for Recurrence Fields#410
ArnyminerZ wants to merge 8 commits into
mainfrom
409-jtx-rewrite-add-handlers-for-recurrence-fields

Conversation

@ArnyminerZ
Copy link
Copy Markdown
Member

Added RecurrenceFieldsHandler and tests.

@ArnyminerZ ArnyminerZ self-assigned this May 21, 2026
@ArnyminerZ ArnyminerZ added the refactoring Quality improvement of existing functions label May 21, 2026
@ArnyminerZ ArnyminerZ linked an issue May 21, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 RecurrenceFieldsHandler to map RRULE, RDATE, EXDATE, and exception RECURRENCE-ID.
  • Registers the new handler in JtxObjectHandler.
  • Adds RecurrenceFieldsHandlerTest covering 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_TIMEZONE values 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))
                })

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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))
                }

ArnyminerZ and others added 2 commits May 21, 2026 11:25
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@ArnyminerZ ArnyminerZ requested a review from cketti May 21, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jtx rewrite] Add handlers for recurrence fields

2 participants