google / ground-android

Ground mobile data collection app for Android
http://groundplatform.org
Apache License 2.0
244 stars 119 forks source link

Non-unique IDs for tasks in different jobs cause tasks to be overwritten in local DB #2484

Open gino-m opened 6 months ago

gino-m commented 6 months ago

This leads to various odd behaviors, like jobs not showing up as "free form" data collection, or jobs having no tasks.

Instead, we should avoid using UUID as PKs in the local db. Instead, we can generate unique numeric IDs, or prevent non-unique IDs in the local DB.

This problem will go away if we serialize the survey as a binary proto in the local db.

scolsen commented 3 months ago

Note from Gino: we should work toward using protos in the local db as well. It would be more valuable to fix this temporarily via destructive changes and to work toward leveraging protos instead.

gino-m commented 3 months ago

I propose the following solution long-term:

gino-m commented 3 months ago

@scolsen Using protos everywhere is a much larger project. A patch is low priority here since this is a degenerate case which would only happen if someone accidentally manually adds to jobs with the same IDs. Moving to Icebox.

kenstershiro commented 1 month ago

Unassigning @scolsen and removing from the current iteration, based on latest comments

gino-m commented 3 weeks ago

@scolsen @anandwana001 Can you confirm that tasks with the same ID in different jobs will no longer break the local db?

gino-m commented 5 days ago

Simple solution: use both survey and job UUID when syncing in local db.

gino-m commented 5 days ago

Demoting to P2 since this won't happen unless we add a duplicate job ID by hand server side.