Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

[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.

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

FileDescription
lib/src/main/kotlin/at/bitfire/synctools/mapping/jtx/JtxObjectHandler.ktRegisters the new recurrence handler; currently gates exception mapping based only on RRULE.
lib/src/main/kotlin/at/bitfire/synctools/mapping/jtx/handler/RecurrenceFieldsHandler.ktImplements mapping from jtx recurrence columns to iCal properties (main + exceptions).
lib/src/test/kotlin/at/bitfire/synctools/mapping/jtx/handler/RecurrenceFieldsHandlerTest.ktAdds 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))
})

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

refactoringQuality 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

@ArnyminerZ