Skip to content

Extract sync/identity field builders from DmfsTaskBuilder#358

Open
sunkup wants to merge 2 commits into
mainfrom
340-1-sync-identity-builders
Open

Extract sync/identity field builders from DmfsTaskBuilder#358
sunkup wants to merge 2 commits into
mainfrom
340-1-sync-identity-builders

Conversation

@sunkup
Copy link
Copy Markdown
Member

@sunkup sunkup commented May 12, 2026

Closes #353. Part of #340.

Extract UidBuilder, SyncIdBuilder, ETagBuilder, SyncFlagsBuilder, SequenceBuilder, and DirtyBuilder from the inline code in DmfsTaskBuilder.buildTask(). Each builder is added to the fieldBuilders array and the corresponding withValue() calls are removed from the orchestrator.

Each builder has a corresponding unit test.

@sunkup sunkup requested a review from Copilot May 12, 2026 10:22
@sunkup sunkup self-assigned this May 12, 2026
@sunkup sunkup added the refactoring Quality improvement of existing functions label May 12, 2026
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

Extracts several dmfs task “sync/identity” column writers from DmfsTaskBuilder into dedicated DmfsTaskFieldBuilder implementations, moving buildTask() toward a thin orchestrator pattern (as part of the broader per-field builder migration).

Changes:

  • Introduced per-column builders for UID, sync-id, ETag, flags, sequence, and dirty columns.
  • Updated DmfsTaskBuilder.buildTask() to run a fieldBuilders pipeline into an Entity, then apply it via withValues().
  • Added unit tests covering each new builder’s mapping behavior.

Reviewed changes

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

Show a summary per file
File Description
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/DmfsTaskBuilder.kt Wires new field builders into the task row build flow and removes inline withValue() calls for extracted fields.
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/builder/UidBuilder.kt Writes Tasks._UID into the task entity.
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/builder/SyncIdBuilder.kt Writes Tasks._SYNC_ID from the builder’s constructor value.
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/builder/ETagBuilder.kt Writes dmfs task ETag into DmfsTask.COLUMN_ETAG.
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/builder/SyncFlagsBuilder.kt Writes sync flags into DmfsTask.COLUMN_FLAGS.
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/builder/SequenceBuilder.kt Writes Tasks.SYNC_VERSION from the task’s sequence (defaulting as implemented).
lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/builder/DirtyBuilder.kt Resets Tasks._DIRTY to 0 on create/update.
lib/src/test/kotlin/at/bitfire/synctools/mapping/tasks/builder/UidBuilderTest.kt Unit tests for UID mapping behavior.
lib/src/test/kotlin/at/bitfire/synctools/mapping/tasks/builder/SyncIdBuilderTest.kt Unit tests for _SYNC_ID mapping behavior.
lib/src/test/kotlin/at/bitfire/synctools/mapping/tasks/builder/ETagBuilderTest.kt Unit tests for ETag mapping behavior.
lib/src/test/kotlin/at/bitfire/synctools/mapping/tasks/builder/SyncFlagsBuilderTest.kt Unit tests for flags mapping behavior.
lib/src/test/kotlin/at/bitfire/synctools/mapping/tasks/builder/SequenceBuilderTest.kt Unit tests for sequence → SYNC_VERSION mapping behavior.
lib/src/test/kotlin/at/bitfire/synctools/mapping/tasks/builder/DirtyBuilderTest.kt Unit tests for DIRTY reset behavior.

Comment thread lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/DmfsTaskBuilder.kt Outdated
Extract UidBuilder, SyncIdBuilder, ETagBuilder, SyncFlagsBuilder,
SequenceBuilder, and DirtyBuilder from the inline code in
DmfsTaskBuilder.buildTask(). Each builder is added to fieldBuilders and
the corresponding withValue() calls are removed from DmfsTaskBuilder.

# Conflicts:
#	lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/DmfsTaskBuilder.kt
@sunkup sunkup force-pushed the 340-1-sync-identity-builders branch from a30488c to 5fee893 Compare May 13, 2026 10:20
@sunkup sunkup force-pushed the 340-1-sync-identity-builders branch from 5fee893 to 45f6f00 Compare May 13, 2026 10:58
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.

DmfsTask: extract sync/identity field builders

2 participants