First, my feedback number: FB13329733.
I took one of my DTS tickets and requested some help on this issue.
This seems to be an actual bug in CoreData:
Every Core Data CloudKit store has several tables to store the synchronization state, and ANSCKRECORDMETADATA is one of them. It stores the maps between Core Data entities and CloudKit record types, and has a unique constraint on its ZENTITYID and ZENTITYPK attributes.
When migrating an existing store, Core Data analyzes the source and destination model versions, and updates the tables so they reflect the new model version. The constraint conflict, I reported, was triggered in the process.
The issue doesn’t happen when I use NSPersistentContainer because Core Data doesn’t migrate the tables when CloudKit doesn’t get involved.
The migration process is completely internal to Core Data, and there is no supported way for developers to impact the behavior.
The DTS engineer couldn't provide me with more details except the notice that the issue has been forwarded to the CoreData team.