Skip to content

fix(desktop,mobile): locale-safe handling of missing CloudKit record types#331

Open
joshuaferris wants to merge 1 commit intodongdongbh:mainfrom
joshuaferris:fix/cloudkit-locale-safe
Open

fix(desktop,mobile): locale-safe handling of missing CloudKit record types#331
joshuaferris wants to merge 1 commit intodongdongbh:mainfrom
joshuaferris:fix/cloudkit-locale-safe

Conversation

@joshuaferris
Copy link
Copy Markdown
Contributor

@joshuaferris joshuaferris commented Mar 29, 2026

Summary

  • Fixes first-run CloudKit sync failing on non-English macOS installs
  • Replaces locale-dependent localizedDescription string match ("Did not find record type") with NSUnderlyingError code 2003 (UNKNOWN_RECORD_TYPE)
  • CKErrorUnknownItem handling unchanged

Split out from #326 per review feedback.

Test plan

  • First-run CloudKit sync on English macOS — record types auto-created on write
  • First-run CloudKit sync on non-English macOS — same behavior, no error
  • Subsequent syncs with existing schema — no regression

🤖 Generated with Claude Code

…types

On first sync, CloudKit record types don't exist yet in the container
schema. The macOS ObjC bridge previously matched the English text
"Did not find record type" in localizedDescription, which fails on
non-English installs.

Changes:
- macOS: replace locale-dependent string match with NSUnderlyingError
  code check (2003 = UNKNOWN_RECORD_TYPE), named constant with
  provenance comment, isKindOfClass guard on underlying error
- iOS: add the same missing-record-type handling to fetchAllRecords
  (was missing entirely — first sync would fail on iOS too)
- Remove dead CKPartialErrorsByItemIDKey fallback that could never
  trigger on a CKQueryOperation error path

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@joshuaferris joshuaferris force-pushed the fix/cloudkit-locale-safe branch from 5338639 to 1960738 Compare March 29, 2026 16:35
Copy link
Copy Markdown
Owner

@dongdongbh dongdongbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocked on validation

  • The locale-safe direction looks right, but this PR changes native CloudKit behavior on both macOS and iOS and I cannot validate first-run schema creation from the current environment.
  • Please test first-run CloudKit sync on non-English macOS and on iOS with an empty Development schema, then report the result in this PR.
  • If the mobile change stays, please update the PR scope/title to reflect that it also changes iOS behavior.

@joshuaferris joshuaferris changed the title fix(desktop): locale-safe handling of missing CloudKit record types fix(desktop,mobile): locale-safe handling of missing CloudKit record types Mar 30, 2026
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.

2 participants