syncall icon indicating copy to clipboard operation
syncall copied to clipboard

[BUG] fails to synchronize created-done tasks to asana

Open sfischme opened this issue 11 months ago • 4 comments

Describe the bug

Syncing tasks that were created in taskwarrior and marked as done before an initial sync to asana cause subsequent syncs to crash.

To Reproduce

  1. Create a task in taskwarrior
  2. Mark the task as done
  3. Sync tasks with asana

Expected Behavior

The task should appear in asana, and should be marked as completed.

Versions

Linux archlinux 6.13.4-arch1-1 Python 3.13.2

syncall installed via pip, version 1.8.6

Requirement already satisfied: syncall in ./lib/python3.13/site-packages (1.8.6)
Requirement already satisfied: PyYAML<5.4.0,>=5.3.1 in ./lib/python3.13/site-packages (from syncall) (5.3.1)
Requirement already satisfied: bidict<0.22.0,>=0.21.2 in ./lib/python3.13/site-packages (from syncall) (0.21.4)
Requirement already satisfied: bubop==0.1.12 in ./lib/python3.13/site-packages (from syncall) (0.1.12)
Requirement already satisfied: click<9.0,>=8.0 in /usr/lib/python3.13/site-packages (from syncall) (8.1.8)
Requirement already satisfied: item-synchronizer<2.0.0,>=1.1.5 in ./lib/python3.13/site-packages (from syncall) (1.1.5)
Requirement already satisfied: loguru<0.6.0,>=0.5.3 in ./lib/python3.13/site-packages (from syncall) (0.5.3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.8.1 in /usr/lib/python3.13/site-packages (from syncall) (2.9.0)
Requirement already satisfied: rfc3339<7.0,>=6.2 in ./lib/python3.13/site-packages (from syncall) (6.2)
Requirement already satisfied: typing<4.0.0,>=3.7.4 in ./lib/python3.13/site-packages (from syncall) (3.7.4.3)
Requirement already satisfied: tqdm<5.0.0,>=4.66.1 in /usr/lib/python3.13/site-packages (from bubop==0.1.12->syncall) (4.67.1)
Requirement already satisfied: six>=1.5 in /usr/lib/python3.13/site-packages (from python-dateutil<3.0.0,>=2.8.1->syncall) (1.17.0)

additional info

17:51:19.05 | DEBUG    	| Initializing Taskwarrior instance using config file: /home/reallyme/.taskrc
17:51:19.05 | DEBUG    	| Using a custom configuration file ... -> 0011001100110__None__asana__None.yaml
17:51:19.05 | DEBUG    	| Initialising preferences manager -> /home/reallyme/.config/syncall
17:51:19.05 | INFO     	| Loading preferences...
17:51:19.18 | INFO     	| Initializing Taskwarrior...
17:52:53.69 | DEBUG    	| Using the following filter to fetch TW tasks: ( +asana )
17:52:54.02 | INFO     	| Detecting changes from Asana...
17:52:54.14 | DEBUG    	| 

New Items:      0
Modified Items: 0
Deleted Item:   0

17:52:54.14 | INFO     	| Detecting changes from Tw...
17:52:54.30 | DEBUG    	| 

New Items:      1
	00110011-0011-0011-0011-001100110011
Modified Items: 0
Deleted Item:   0

17:52:54.30 | DEBUG    	| Fetching Tw item for id -> 00110011-0011-0011-0011-001100110011
17:52:54.30 | INFO     	| [Tw] Inserting item [buggy heck] at Asana...
17:52:54.99 | ERROR    	| [Asana Inserter] Operation failed.
17:52:54.99 | DEBUG    	| [Asana Inserter] Operation failed.
Traceback (most recent call last):

  File "/home/reallyme/.local/bin//tw_asana_sync", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/home/reallyme/.local/lib/python3.13/site-packages/syncall/scripts/tw_asana_sync.py", line 233, in main
    aggregator.sync()
  File "/home/reallyme/.local/lib/python3.13/site-packages/syncall/aggregator.py", line 200, in sync
    self._synchronizer.sync(changes_A=changes_A, changes_B=changes_B)
  File "/home/reallyme/.local/lib/python3.13/site-packages/item_synchronizer/synchronizer.py", line 153, in sync
    return self._sync(changes_A=changes_A, changes_B=changes_B)
  File "/home/reallyme/.local/lib/python3.13/site-packages/item_synchronizer/synchronizer.py", line 179, in _sync
    self._sync_new_items(changes_A=changes_A, changes_B=changes_B)
  File "/home/reallyme/.local/lib/python3.13/site-packages/item_synchronizer/synchronizer.py", line 171, in _sync_new_items
    inserted_id = self._convert_n_insert(id_, insert_to_side)
  File "/home/reallyme/.local/lib/python3.13/site-packages/item_synchronizer/synchronizer.py", line 117, in _convert_n_insert
    new_id: ID = inserter(converted_item)
> File "/home/reallyme/.local/lib/python3.13/site-packages/item_synchronizer/synchronizer.py", line 84, in wrapper
    return fn(*args, **kargs)
  File "/home/reallyme/.local/lib/python3.13/site-packages/syncall/aggregator.py", line 225, in inserter_to
    item_created = item_side.add_item(item)
  File "/home/reallyme/.local/lib/python3.13/site-packages/syncall/asana/asana_side.py", line 120, in add_item
    return AsanaTask.from_raw_task(self._client.tasks.create_task(raw_task))
  File "/home/reallyme/.local/lib/python3.13/site-packages/asana/resources/gen/tasks.py", line 102, in create_task
    return self.client.post(path, params, **options)
  File "/home/reallyme/.local/lib/python3.13/site-packages/asana/client.py", line 204, in post
    return self.request('post', path, data=body, headers=headers, **options)
  File "/home/reallyme/.local/lib/python3.13/site-packages/asana/client.py", line 93, in request
    raise STATUS_MAP[response.status_code](response)

asana.error.InvalidRequestError: Invalid Request: completed_at: Cannot write this property

sfischme avatar Feb 27 '25 22:02 sfischme

Here is the data that gets sent in the post request to asana:

Data (it has the correct workspace id):

{'data': {'completed': True, 'name': 'buggy heck', 'completed_at': '2025-02-27T22:49:54.000+00:00', 'due_at': None, 'assignee': 'me', 'workspace': '<correct-workspace-id>'}, 'options': {'client_name': 'syncall'}}

Headers:

{'content-type': 'application/json'}

sfischme avatar Feb 27 '25 23:02 sfischme

The insertion is working:

Data (it has the correct workspace id):

{'data': {'completed': False, 'name': 'buggy heck', 'completed_at': None, 'due_at': None, 'assignee': 'me', 'workspace': '<correct-workspace-id>'}, 'options': {'client_name': 'syncall'}}

Headers:

{'content-type': 'application/json'}

After the insertion, an update to completed works as well. The problem seems to be an insertion with completed and completed_at set.

sfischme avatar Feb 28 '25 02:02 sfischme

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 29 '25 15:04 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar May 05 '25 15:05 github-actions[bot]