In TaskAngel we sync tasks using your recommended sequence - adds, then deletes, then edits. But this has started giving 'invalid parent id' errors, in the following scenario:
1. Starting position: task B is a subtask of task A
2. Ungroup task B so it is no longer a subtask
3. Add task C as a subtask to task B
4. Sync, gives the error
The error happens because the add is trying to make task C as a subtask of B before B has been ungrouped from task A, because that is done by an edit, which is a later sync step.
We haven't had this error reported before. Perhaps you are doing more checks in the API now. Do you have a preferred method for resolving this scenario? Currently my best thought is to collect failed adds and retry them after all the edits have been done.
Yes, you could collect them and retry them after the edits happen.
What we do in our app is skip over any errors and essentially keep the task as dirty in the app and continue syncing the remainder of the stuff. Then, when the sync is complete, if there were any errors, we just immediately sync again. This will pick up any chicken-egg dependency problems.