You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PKSyncManager currently uses NSManagedObjectContextWillSaveNotification to save changes to managed objects into the Dropbox datastore. According to this article, CoreData validations run after the WillSave notification is fired. Thus, you could have invalid data on a managed object, save the object, then PKSyncManager would pick up the changes and save them to the Dropbox datastore. Soon after, CoreData validations would fail for the object, but you've already saved the bad data to the Dropbox data store.
Is there a reason that PKSyncManager doesn't just use NSManagedObjectContextDidSaveNotification, which fires after coredata validations?
Note I haven't seen any problems like this in our app, it's just something I thought of that could theoretically happen, and I don't have time right now to actually try to write a failing test.
The text was updated successfully, but these errors were encountered:
An update to this. I just wrote a unit test that shows that updateDatastoreWithManagedObject: gets called on PKSyncManager when an NSManagedObject with validation errors gets saved.
PKSyncManager
currently usesNSManagedObjectContextWillSaveNotification
to save changes to managed objects into the Dropbox datastore. According to this article, CoreData validations run after theWillSave
notification is fired. Thus, you could have invalid data on a managed object, save the object, thenPKSyncManager
would pick up the changes and save them to the Dropbox datastore. Soon after, CoreData validations would fail for the object, but you've already saved the bad data to the Dropbox data store.Is there a reason that
PKSyncManager
doesn't just useNSManagedObjectContextDidSaveNotification
, which fires after coredata validations?Note I haven't seen any problems like this in our app, it's just something I thought of that could theoretically happen, and I don't have time right now to actually try to write a failing test.
The text was updated successfully, but these errors were encountered: