Repository navigation
Conversation
upsertFromServerRecord stored every fetched record as lastKnownServerRecord, even when it was older than the stored one. A fetch that started before a save finished could deliver the pre-save record, and the next save of it then failed with .serverRecordChanged. Apply the same check as refreshLastKnownServerRecord: replace the stored record only when the fetched record's modification date is at least as new. Fixes pointfreeco#585. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #585.
upsertFromServerRecordstored every fetched record aslastKnownServerRecord, even when it was older than the stored one. A fetch that started before a save finished could deliver the pre-save record, and the next save of it then failed with.serverRecordChanged.This applies the same check as
refreshLastKnownServerRecord: the stored record is replaced only when the fetched record's modification date is at least as new. That applies to both placesupsertFromServerRecordwrites it.The new test
fetchedOlderRecordDoesNotReplaceLastKnownServerRecordsaves a list twice, then delivers the first copy as a fetched change. It fails without the fix.One thing left as is: the fetched record's row data is still merged into the table. Plain fields keep their newer values through the per-field timestamps (the test checks this), but an asset column could still revert if the stored record's asset file is missing (the path in #584). Returning before the row update would avoid that but changes more, so I left it out. Happy to add it if you'd like.
Tested with
swift test --traits SQLiteDataTaggedin debug and release, and the Reminders and SyncUps example tests, on Xcode 27.1.🤖 Generated with Claude Code