bgregos / foreground

Simple Android personal task manager with Taskwarrior integration
Apache License 2.0
255 stars 16 forks source link

Taskd tx.data file invalid after modifying task with dependencies in Foreground #162

Open me-and opened 1 year ago

me-and commented 1 year ago

If I have a task that has dependencies, and I complete the task using Foreground, my other Taskwarrior clients stop being able to sync to my taskd server, and instead start reporting "Unrecognized Taskwarrior file format or blank line in data."

Looking at the tx.data file, I see the following (whitespace added for clarity):

{
  "description":"test2",
  "uuid":"73ecca6c-f6c2-4abb-ad35-80a5a8884eba",
  "project":"",
  "status":"completed",
  "priority":"",
  "modified":"20230616T214045Z",
  "end":"20230616T214045Z",
  "entry":"20230616T213531Z",
  "tags":["inbox"],
  "annotations":[],
  "depends":"[\"dcc67934-6230-46e2-aa04-846d31efd329\"]"
}

Note the depends entry; that should be "depends":["dcc67934-6230-446e2-aa04-846d31efd329"].

The above test case was created with the following (the inbox tagging is a custom hook I have):

$ taskd add user adam test
New user key: e65cfbf7-9183-424b-8d54-46798c3afe76
Created user 'test' for organization 'adam'

$ TASKDATA=/tmp/task task rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76 add test
TASKDATA override: /tmp/task
Created task 1.
Configuration override rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76
Tagged test as inbox

$ TASKDATA=/tmp/task task rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76 add test2 depends:1
TASKDATA override: /tmp/task
Created task 2.
Configuration override rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76
Tagged test2 as inbox

$ TASKDATA=/tmp/task task rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76 sync init
Please confirm that you wish to upload all your tasks to the Taskserver (yes/no) y
TASKDATA override: /tmp/task
Syncing with host:port

Configuration override rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76
Sync successful.  2 changes uploaded.

<Clear all data from the Foreground app, set it up to sync to the new test user, complete the "test2" task, sync again>

$ TASKDATA=/tmp/task task rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76 sync
TASKDATA override: /tmp/task
Configuration override rc.taskd.credentials:adam/test/e65cfbf7-9183-424b-8d54-46798c3afe76
Unrecognized Taskwarrior file format or blank line in data.

This seems similar to #110 to me, but that issue has been fixed.

I'm running a self-hosted taskd 1.2.0 instance, compiled from source, on a Raspberry Pi running Debian Bookworm. The task client is the Debian packaged version 2.6.2+dfsg-1, on the same machine. The Foreground client is version 1.5.5 from the Google Play Store on a Fairphone 4 running stock Android 12.

Sudneo commented 1 year ago

I am experiencing the same exact error with version 1.6.1 of foreground as well.

Marking a task with a dependency causes the tx.data to have the depends key such as:

"depends":"[\"30800057-5230-4d8f-8baf-95f0e13d2f2b\"]"

Manually changing to

"depends":["30800057-5230-4d8f-8baf-95f0e13d2f2b"]

Fixes the issue.