christopherjwhite / org-toodledo

Emacs enhancement for syncing org-mode tasks with Toodledlo
83 stars 16 forks source link

Workaround for parent/child limitations? #5

Closed mrvdb closed 12 years ago

mrvdb commented 12 years ago

Is there a workaround which allows me to complete a sync for an org file which has more than 2 levels of TODO items? For example by completely ignoring the parent/child relation.

I have no problem running on a slightly modified version locally, but need a little nudge in the proper direction for it.

christopherjwhite commented 12 years ago

Hi Marcel,

You can have multiple levels of heirarchy, as long as there are not more than 2 levels of TODOs.

For example, the following will work fine:

But the following behavior is not well defined (I'm not sure what it will do....):

I see two possibilities:

A) Do not turn "Level 1" into a todo item in toodledo.com. The toodledo server has a limitation of just 1 level of depth, so that's part of the reason for the limitation.

B) Flatten it out so that "Level 1" and "Level 2" show up as top level items in toodledo.com.

How would you like it to behave? Any other suggestions on how it should be handled?

...cj

On Thu, 5 Jan 2012 08:08:23 -0800 Marcel van der Boom reply@reply.github.com wrote:

Is there a workaround which allows me to complete a sync for an org file which has more than 2 levels of TODO items? For example by completely ignoring the parent/child relation.

I have no problem running on a slightly modified version locally, but need a little nudge in the proper direction for it.


Reply to this email directly or view it on GitHub: https://github.com/christopherjwhite/org-toodledo/issues/5

mrvdb commented 12 years ago

Option 'B' sounds the least intrusive to me, in the sense that the least amount of information gets lost in the synchronisation while keeping the information that is synced correct as such. I personally could totally live with a flattened list.

Anything is better than the current behaviour, which I deduce to be "it stops syncing halfway with a cryptic error", but perhaps this is dependent on the exact structure of the org file involved.

I have not used toodledo for a long period of time, so I'm not sure how to handle the relationships between tasks. The 'folders' in toodledo could take a role in grouping tasks, but that might get even messier.

Flattening sounds like the best option to me and grow the system into a 'trusted system' from there.

christopherjwhite commented 12 years ago

Such "flattening" was already supported if you didn't have a pro-account, so I just added a customization variable org-toodledo-flatten-all-tasks that should do the same. Give that a try and let me know if it works.

mrvdb commented 12 years ago

Reran this, but still getting the same behaviour as before. When running this on my real org file the Message buffer contains:

Contacting host: api.toodledo.com:80
Mark set [6 times]
Contacting host: api.toodledo.com:80
url-http: writing to process: bad file descriptor, api.toodledo.com

I tried both http and https with the same result. Am I doing something wrong? This error does not happen when there are less than 3 levels of TODO items. On the simplest testcase I could come up with i got the error "mapcar: Wrong type argument: listp, "Invalid parent ID"

Testfile: * TODO Main \ TODO Sub *\ TODO Subsub

Note: the task does get onto toodledo, but never gets a proper toodledo-id in the org file

christopherjwhite commented 12 years ago

Did you trying setting org-toodledo-flatten-all-tasks to t? I'm not sure what the behavior is when you don't flatten and have 3 or more levels. I'd have to debug that further.

...cj

On Tue, 31 Jan 2012 06:51:34 -0800 Marcel van der Boom reply@reply.github.com wrote:

Reran this, but still getting the same behaviour as before. When running this on my real org file the Message buffer contains:

Contacting host: api.toodledo.com:80
Mark set [6 times]
Contacting host: api.toodledo.com:80
url-http: writing to process: bad file descriptor,

api.toodledo.com

I tried both http and https with the same result. Am I doing something wrong? This error does not happen when there are less than 3 levels of TODO items. On the simplest testcase I could come up with i got the error "mapcar: Wrong type argument: listp, "Invalid parent ID"

Testfile: * TODO Main \ TODO Sub *\ TODO Subsub

  • Mx org-toodledo-initialize --> OK
  • M-x adding a sibling of Subsub with text '*\ New subsub'
  • M-x org-toodledo-sync --> errors out with mapcar: Wrong type argument: listp, "Invalid parent ID"

Note: the task does get onto toodledo, but never gets a proper toodledo-id in the org file


Reply to this email directly or view it on GitHub: https://github.com/christopherjwhite/org-toodledo/issues/5#issuecomment-3740333

christopherjwhite commented 12 years ago

Hey Marcel,

I improved the support for more than 3-levels of hierarchy, basically flattening all the children beneath the parent.

;; If 3 or more levels is present, all children will ;; appear directly beneath the top-most TODO item: ;; ;; org-mode:
;; * TODO Level 1 item ;; \ WAITING Level 1.1 item ;; * DONE Level 1.1.1 item ;; \ DONE Level 1.2 item ;; * DONE Level 1.2.1 item ;; ;; server: ;; * TODO Level 1 item ;; * WAITING Level 1.1 item ;; * DONE Level 1.1.1 item ;; * DONE Level 1.2 item ;; * DONE Level 1.2.1 item ;; ;; Note that the hierarchy is preserved in the org-mode file, it just ;; displays with the children flattened on the server.

mrvdb commented 12 years ago

Cool, thanks!

christopherjwhite commented 12 years ago

Ok -- found one bug that will flatten all subtasks if the parent is not at the top-level. They do retain the hierarchy in org-mode, just show up as all flattened on the toodledo.com.

Fixed in 2.7 release. It should just require updating the code then resync, it will fix the parent/child relationship on the server with no loss.

It's tough to test subtasks, as my "test" account is not pro, so I end up doing manual testing in my main account, which is not quite as easy...

...cj

mrvdb commented 12 years ago

Sorry, but I'm still getting "url-http: writing to process: bad file descriptor, api.toodledo.com<1>" with a sufficiently complext org file. With a simple testfile things seem to go as expected.

christopherjwhite commented 12 years ago

Hi Marcel,

Hmm.. I'm a bit stumped. A few thoughts/questions:

I did find an issue that would lead to an error of "Invalid ID number", but that doesn't sound like your issue.

...cj

On Tue, 21 Feb 2012 01:31:16 -0800 Marcel van der Boom reply@reply.github.com wrote:

Sorry, but I'm still getting "url-http: writing to process: bad file descriptor, api.toodledo.com<1>" with a sufficiently complext org file. With a simple testfile things seem to go as expected.


Reply to this email directly or view it on GitHub: https://github.com/christopherjwhite/org-toodledo/issues/5#issuecomment-4071579

mrvdb commented 12 years ago

On di 21-feb-2012 04:50 "Christopher J. White" reply@reply.github.com wrote:

  • I notice you are using emacs 24, have you installed the url-http patches or ensured that they have the fixes in them? This sounds a bit like one of the issues where a short response would cause problems. I had not applied them before. I retested with and without the patches applied. With the patches applied the error is a bit different:

Contacting host: api.toodledo.com:80 All interaction with toodledo.com will be via HTTPS Contacting host: api.toodledo.com:443 [2 times] symbol-name: Wrong type argument: listp, "Invalid parent ID"

  • does both http and https fail? (I assume you have a pro account, yes?)

Yes, I have tested with both http and https on a Pro-Account. The error is the same.

  • I'd be happy to debug this on your file if you don't mind sharing. You can send it to the email address at the top of org-toodledo.el

I can't send the file unfortunately, but I can look into a situation where I can reproduce the problem with a minimal file and send this through. This can take a while I presume, but I'll give that a shot later this week.

Thanks for your efforts, it is appreciated a lot!

marcel

christopherjwhite commented 12 years ago

On Tue, 21 Feb 2012 05:37:16 -0800 Marcel van der Boom reply@reply.github.com wrote:

  • I notice you are using emacs 24, have you installed the url-http patches or ensured that they have the fixes in them? This sounds a bit like one of the issues where a short response would cause problems. I had not applied them before. I retested with and without the patches applied. With the patches applied the error is a bit different:

Contacting host: api.toodledo.com:80 All interaction with toodledo.com will be via HTTPS Contacting host: api.toodledo.com:443 [2 times] symbol-name: Wrong type argument: listp, "Invalid parent ID"

Ok -- this is better, as it's in the org-toodledo code. I suspect what's happening is that when syncing tasks to the server, one or more tasks sent to the server has a parent ID set that the server does not know of.

For example:

My guess -- org-toodledo thinks that Parent is already up on the server so it does not send it on sync, but in fact it's not. Child has a change, so it sends Child up to the server and passes Parent-ID of 25. The server responds with "Invalid parent ID" because 25 is not a known task. It may be that the Parent is on the server but has a different ID for some reason.

I need to enhance the code that processes the results from a sync so that such errors have more info in them that tell which task it was trying to sync that failed. org-toodledo sends bulk actions to the server, such as "edit" with up to 50-tasks as one big XML chunk. The server will process them and return an XML response that has a response code per task sent. I'll need to match up the request tasks with the response in order to generate a better message.

FYI -- you can tell what ID is assigned to a task on the server by clicking on the little "actions" icon (the sort of arrow on the left of a task). This brings up a menu -- click on "Permanent link" and the URL of the target has the task id in it.

...cj

christopherjwhite commented 12 years ago

Hi Marcel,

I just pushed version 2.8 up to git hub. This has significantly better error handling. If an error occurs while syncing a task, it will log the task along with what error code came back from the server for that specific task. It should continue syncing all other tasks without stopping.

Hopefully this will help, either no more issues, or at least a much better idea of where things are failing.

Let me know how it goes!

...cj

On Tue, 21 Feb 2012 05:37:16 -0800 Marcel van der Boom reply@reply.github.com wrote:

On di 21-feb-2012 04:50 "Christopher J. White" reply@reply.github.com wrote:

  • I notice you are using emacs 24, have you installed the url-http patches or ensured that they have the fixes in them? This sounds a bit like one of the issues where a short response would cause problems. I had not applied them before. I retested with and without the patches applied. With the patches applied the error is a bit different:

Contacting host: api.toodledo.com:80 All interaction with toodledo.com will be via HTTPS Contacting host: api.toodledo.com:443 [2 times] symbol-name: Wrong type argument: listp, "Invalid parent ID"

  • does both http and https fail? (I assume you have a pro account, yes?)

Yes, I have tested with both http and https on a Pro-Account. The error is the same.

  • I'd be happy to debug this on your file if you don't mind sharing. You can send it to the email address at the top of org-toodledo.el

I can't send the file unfortunately, but I can look into a situation where I can reproduce the problem with a minimal file and send this through. This can take a while I presume, but I'll give that a shot later this week.

Thanks for your efforts, it is appreciated a lot!

marcel


Reply to this email directly or view it on GitHub: https://github.com/christopherjwhite/org-toodledo/issues/5#issuecomment-4074754

mrvdb commented 12 years ago

cj,

All tests run fine.

Syncing seems to work at least partially now. I get a list of about 40 items in toodledo. There is an issue with priority markers. I don't use those in orgmode and toodledo adds them (i.e. adds [#B] for every synced task in the org file). If I recall correctly, this setting could be queried by org-toodledo and acted upon accordingly.

The log contains a lot of line similar to these: [13:54:47] [DEBUG2] org-toodledo-find-todo-entry: "-597" t nil t [13:54:47] [ERROR] Failed to edit task on server, error 13 'Invalid parent ID', task -597: 'Zoeken bij WIK %term% voor naam maken'

You did mention something about this earlier, but I forgot what it was.

On subsequent runs of org-toodledo-sync i get local/server conflict which are only because parent id has not been filled into the propery locally (so I guess it's related to the above?)

when resolving the log contains an error: [14:02:46] [DEBUG] Task modified locally and on server, asking user to resolve [14:02:46] [ERROR] Unsupported repeat string format: [14:02:46] [DEBUG2] Note:

It does not matter if I resolve to local or server, the error is there regardless.

christopherjwhite commented 12 years ago

Hi Marcel,

Thanks for the update, comments below in line: On Tue, 20 Mar 2012 06:05:24 -0700 Marcel van der Boom wrote:

Syncing seems to work at least partially now. I get a list of about 40 items in toodledo. There is an issue with priority markers. I don't use those in orgmode and toodledo adds them (i.e. adds [#B] for every synced task in the org file). If I recall correctly, this setting could be queried by org-toodledo and acted upon accordingly.

This is a small enhancement. Every TODO item in org-mode has default priority (org-default-priority == 66 or 'B' on my system). If an item has no explicit priority set, that value is used. I can tweak org-mode to leave it out if the priority of a task matches that default priority.

The log contains a lot of line similar to these: [13:54:47] [DEBUG2] org-toodledo-find-todo-entry: "-597" t nil t [13:54:47] [ERROR] Failed to edit task on server, error 13 'Invalid parent ID', task -597: 'Zoeken bij WIK %term% voor naam maken'

You did mention something about this earlier, but I forgot what it was.

Yes, this occurs when syncing tasks that have a parent/child relationship. When syncing parent/child tasks to toodledo, there is a some complex code to handle syncing the parents first, grabbing the task id assigned by the server, and then the children.

Something is failing in the process of child/server relationship. For the task listed above, it sounds like you should have something like:

Can you confirm that this is true? If so, can you tell me:

  1. Did the parent task get synced properly to the server? If so, what task id (in the :PROPRETIES: drawer)
  2. Did the child task get synced and assigned a task id?
  3. Is there possibly more levels than just the parent/child? I know you talked about having 3 or more levels of TODO items.

If you have a chance, can try to sync just this task along with it's top-level parent and the entire subtree of the tasks below that parent and see if you can reduce the problem to a few set of tasks and then send me that set of tasks that fails?

On subsequent runs of org-toodledo-sync i get local/server conflict which are only because parent id has not been filled into the propery locally (so I guess it's related to the above?)

when resolving the log contains an error: [14:02:46] [DEBUG] Task modified locally and on server, asking user to resolve [14:02:46] [ERROR] Unsupported repeat string format: [14:02:46] [DEBUG2] Note:

It does not matter if I resolve to local or server, the error is there regardless.

The error message generated is like this: (format "Unsupported repeat string format: %s" repeat)

Is there no other text after the colon at the end of the line? That seems to indicate the repeat string is maybe the null string.

On the toodledo server, is this task set to repeat, and if so, what is the repeat interval set to? I can try the same setting on my side.

Thanks ...cj