CloudKit corruption using NSPersistentCloudKitContainer

After many months/years of trying to create my own CoreData/iCloud sync engine, and getting about 90% of the way there; I gave up and started using NSPersistentCloudKitContainer, forcing us to drop support for iOS 12-.
At first all seemed fine, however, today it all went horribly wrong (still investigating why) I now have 'duplicate' CKRecords of single ManagedObjects in CloudKit, and (it seems, although still tracking down the model) disconnected 'references'.
Having looked at CloudKit Dashboard is seems that NSPersistentCloudKitContainer does not use ANY references, but simply a String of the UUID of the referenced CKRecord. I can only presume that this is a workaround to prevent Referencing a (not yet) non-existent CKRecord.
So, this presents several questions:
  1. Is the lack of CKReference by design, or a bug?

  2. What defensive programming is in place to prevent duplications or corrupt references when using Stringly-Typed pseudo-references?

  3. Is there a way to inform the NSPersistentCloudKitContainer that a CKRecordFieldKey is unique?

  4. Is it 'safe' to 'correct' the CloudKit RecordZone in order to fix the corruption?

3a. I am curious that CloudKit does not support the UUID type?!



Replies

CKReference is limited to 750 total objects so it would not work for Core Data.
Ah yes! I’d forgotten that restriction. Moreover, CK doesn’t support many-many, so I guess it’s a unified work-around.
Still surprised/confused/annoyed that PersistentCloudKitContainer doesn’t support UUID types; surely this would be a gift. If the manObj has a UUID use it, if not, generate the CD-Identifier. ¯\_(ツ)_/¯