I have 3 projects in superproductivity. Suddenly, all active tasks for project 2 are deleted. Instead, copies of all active tasks from project 3 have been added to project 2. The archive is not affected.
I have created a task backup and am currently analysing and trying to fix the application's state.
This jq command shows best, what's wrong with the state:
$ jq '.task.__eYSLKa7.entities[].projectId' super-productivity-backup\ \(8\).json
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"Wlu8pv_lh"
"__eYSLKa7"
That last task (which has the correct project id) has been added today, after the problem occured.
For comparison the same command on the archived tasks of the project:
$ jq '.taskArchive.__eYSLKa7.entities[].projectId' super-productivity-backup\ \(8\).json
"__eYSLKa7"
"__eYSLKa7"
"__eYSLKa7"
"__eYSLKa7"
"__eYSLKa7"
[...]
"__eYSLKa7"
"Wlu8pv_lh"
"Wlu8pv_lh"
"__eYSLKa7"
The two invalid project ids are from tasks that I have closed today - also after occurence of the issue.
My plan is, to restore task.__eYSLKa7 from a backup that's not yet affected (I have found the backup from 08/02/2020 to be alright). Is there anything that could go wrong or that I should be aware of?
No idea
Update: From a first glance, my attempt to fix this seems to have worked. If anyone else comes across the same issue, I can share the detailed process (just mention me).
Here's the command to copy the tasks from an older backup over the faulty entries (using jq):
jq --arg PROJECTID "affectedProjectId" --argfile INTACT_BACKUP intact-backup.json '. | .task[$PROJECTID] = $INTACT_BACKUP.task[$PROJECTID]' broken-backup.json > fixed.json
Thank you very much! This seems to be some race condition which only occurs very rarely. It happened to me before, but I wasn't able to find the root of this issue and it didn't happen again. I look into it once more.
I think I found the source of this issue. There is a moment when the project id has already changed, but all the related data is not yet loaded from the database. I am publishing a fix soon.
Awesome, thanks