Repository navigation
Overhaul of merge conflict tests - #414
Open
lukaskubanek wants to merge 23 commits into
Open
lukaskubanek wants to merge 23 commits into
lukaskubanek wants to merge 23 commits into
Conversation
lukaskubanek
added a commit
to structuredpath/sqlite-data
that referenced
this pull request
Mar 26, 2026
Introduce Post table type Add differentFieldsChange_conflictOnSend_clientNewer test Add differentFieldsChange_conflictOnSend_serverNewer test Remove replaced tests Add differentFieldsChange_conflictOnFetch_clientNewer test Add differentFieldsChange_conflictOnFetch_serverNewer test Add convergence assertions for local state Remove replaced test Add sameFieldChange_conflictOnSend_retryBeforeFetch_* tests Add sameFieldChange_conflictOnSend_fetchBeforeRetry_* tests Add sameFieldChange_conflictOnFetch_clientNewer test Add sameFieldChange_conflictOnFetch_serverNewer test Remove replaced tests Add sameFieldChangeAndRemoval_* tests Update test for updating nullable fields Combine local database assertions into a single join query Add sameFieldChange_conflictOnSend_equalTimestamps test Add sameFieldRemoval_conflictOnSend_clientNewer test Add sameFieldRemoval_conflictOnSend_serverNewer test Improve synced row query asserts
This was referenced Jul 28, 2026
lukaskubanek
force-pushed
the
merge-conflict-tests
branch
from
November 4, 2026 14:17
42a5682 to
e7271a1
Compare
lukaskubanek
force-pushed
the
merge-conflict-tests
branch
from
November 11, 2026 10:40
32ade2e to
5f45336
Compare
lukaskubanek
marked this pull request as ready for review
November 11, 2026 13:27
Contributor
Author
|
@mbrandonw Now that #574 landed and the tests exercise the same logic as production, I was able to submit this PR for review. It’s now rebased onto |
This was referenced Nov 11, 2026
3 of 5 tasks
Contributor
Author
lukaskubanek
added a commit
to structuredpath/sqlite-data
that referenced
this pull request
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
The scenarios in this PR rely on
MockCloudDatabasepopulatingCKRecord.modificationDate, which landed in #574. Without it the tests exercise different logic than production.Summary
This PR replaces the existing merge conflict tests in
MergeConflictTests.swiftwith a new test suite that covers a broader set of scenarios across multiple dimensions:The new tests expose three issues in the merge conflict resolution logic. These are temporarily marked with
withKnownIssue, as the main goal of this PR is to document the current behavior, rather than immediately fixing the bugs.Improvements
Posttable type (standalone, no parent entity required) instead ofReminder, which depends onRemindersList.container.privateCloudDatabasedirectly, reducing boilerplate compared to the full container, as the shared database isn’t interesting for these tests.t=30,t=60) for client modification instead of relative increments. This is now aligned with howCKRecords are being treated.Bugs Identified
The test suite revealed the following issues in the implementation:
Overview
differentFieldsChange_conflictOnSend_clientNewerisPublished@ t=60title@ t=30serverRecordUpdatedBeforeClientRecorddifferentFieldsChange_conflictOnSend_serverNewerisPublished@ t=30title@ t=60clientRecordUpdatedBeforeServerRecorddifferentFieldsChange_conflictOnFetch_clientNewerisPublished@ t=60title@ t=30serverAndClientEditDifferentFieldsdifferentFieldsChange_conflictOnFetch_serverNewerisPublished@ t=30title@ t=60differentNullableFieldsChange_conflictOnFetch_clientNewerpriority@ t=60dueDate@ t=30mergeWithNullableFieldssameFieldChange_conflictOnSend_retryBeforeFetch_clientNewertitle@ t=60title@ t=30sameFieldChange_conflictOnSend_retryBeforeFetch_serverNewertitle@ t=30title@ t=60sameFieldChange_conflictOnSend_fetchBeforeRetry_clientNewertitle@ t=60title@ t=30serverRecordEditedBeforeClientButProcessedAfterClientsameFieldChange_conflictOnSend_fetchBeforeRetry_serverNewertitle@ t=30title@ t=60sameFieldChange_conflictOnSend_equalValues_clientNewertitle@ t=60title@ t=30title@ t=60title@ t=30sameFieldChange_conflictOnSend_equalValues_serverNewertitle@ t=30title@ t=60title@ t=60title@ t=60sameFieldChange_conflictOnSend_equalTimestampstitle@ t=60title@ t=60sameFieldChange_conflictOnFetch_clientNewertitle@ t=60title@ t=30serverRecordEditedAndProcessedBeforeClientsameFieldChange_conflictOnFetch_serverNewertitle@ t=30title@ t=60serverRecordEditedAfterClientButProcessedBeforeClient(inverts its expectation, the server should win)sameFieldChangeAndRemoval_conflictOnSend_clientNewerbody@ t=60body@ t=30sameFieldChangeAndRemoval_conflictOnSend_serverNewerbody@ t=30body@ t=60sameFieldRemoval_conflictOnSend_clientNewerbody@ t=60body@ t=30body@ t=60body@ t=30sameFieldRemoval_conflictOnSend_serverNewerbody@ t=30body@ t=60body@ t=60body@ t=60Next Steps