Skip to content

Fix crash when CloudKit returns records without fields#11

Open
asabirov wants to merge 1 commit intosync/upstream-mainfrom
fix/handle-missing-fields-v2
Open

Fix crash when CloudKit returns records without fields#11
asabirov wants to merge 1 commit intosync/upstream-mainfrom
fix/handle-missing-fields-v2

Conversation

@asabirov
Copy link
Copy Markdown
Owner

@asabirov asabirov commented Apr 8, 2026

Problem

CloudKit's records/lookup can return records without a fields key (not-found/deleted records), causing a keyNotFound decoding crash.

Fix

  • Custom Decodable init for CKRecord that defaults fields to [:] when missing
  • Filter out fieldless records in lookupRecords so get correctly falls through to uniqueIdentifier search
  • 7 unit tests covering decoding and BearNote edge cases

Add custom CKRecord decoder that handles missing/empty fields gracefully
instead of crashing on decode. Add tests for record decoding edge cases.

(reimplements PR #3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant