Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 192309 - fix synchronization of Trac web tasks
Summary: fix synchronization of Trac web tasks
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 2.0   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 193041 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-12 20:03 EDT by Steffen Pingel CLA
Modified: 2007-06-20 16:49 EDT (History)
2 users (show)

See Also:


Attachments
mark web tasks read when opened (6.03 KB, patch)
2007-06-14 21:08 EDT, Steffen Pingel CLA
no flags Details | Diff
mylar/context/zip (1.51 KB, application/octet-stream)
2007-06-14 21:08 EDT, Steffen Pingel CLA
no flags Details
updated patch (1.02 KB, patch)
2007-06-14 23:52 EDT, Steffen Pingel CLA
no flags Details | Diff
updated patch (1.05 KB, patch)
2007-06-18 20:23 EDT, Steffen Pingel CLA
no flags Details | Diff
fix upating of tasks from hits (26.07 KB, patch)
2007-06-19 23:58 EDT, Steffen Pingel CLA
no flags Details | Diff
mylar/context/zip (16.33 KB, application/octet-stream)
2007-06-19 23:58 EDT, Steffen Pingel CLA
no flags Details
fixed incoming notification (33.55 KB, patch)
2007-06-20 10:13 EDT, Steffen Pingel CLA
no flags Details | Diff
mylyn/context/zip (17.81 KB, application/octet-stream)
2007-06-20 10:13 EDT, Steffen Pingel CLA
no flags Details
updated patch (19.90 KB, patch)
2007-06-20 11:35 EDT, Steffen Pingel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2007-06-12 20:03:18 EDT
With the recent changes made as part of bug 161734 the behavior of query synchronization for Trac tasks accessed in Web mode (no task data) has changed. I'll use this ticket to list the things that need to be fixed:

 * Tasks are not marked as read when the editor is opened (they remain to be marked as "new")
 * Tasks are synchronized twice when the editor is opened
 * When a query is synchronized all previous hits (?) are moved to the archive
 
Steps to reproduce:

1. Create a Trac repository choosing the Edgewall repository template
2. Create a query that filters by summary containing "XML"
Comment 1 Steffen Pingel CLA 2007-06-13 10:31:52 EDT
Eugene, have you checked synchronization of web tasks?
Comment 2 Eugene Kuleshov CLA 2007-06-13 11:50:00 EDT
Nope. BTW, it would be nice if we can somehow reuse code between web connector and trac for that.
Comment 3 Mik Kersten CLA 2007-06-14 02:33:22 EDT
Please note that all the recent changes run a risk of destabilizing the Trac and Generic Web connectors for RC1.  Rob and I are trying to do what we can to avoid that.  The Trac connector has a great test suite which will help.
Comment 4 Steffen Pingel CLA 2007-06-14 10:04:27 EDT
One of the problems is that QueryHitCollector does not preserve (attributes of) existing tasks such as lastSyncDateStamp when receiving hits as tasks. Before query hits and tasks were merged that problem did not exist since only query hits were replaced and the associated task was not touched. I am not sure what the best solution is here: keep the existing task and copy new attributes or replace the existing task and preserve the meta data. I am leaning to towards the latter because that only requires knowledge about the common task model and could be done in the framework. Lets discuss this on bug 191575.
Comment 5 Steffen Pingel CLA 2007-06-14 21:08:43 EDT
Created attachment 71386 [details]
mark web tasks read when opened

The patch has mostly formatting changes. The only semantic change is that the sync timestamp is set to a "bogus" date when a task is opened similar to the handling of local tasks.
Comment 6 Steffen Pingel CLA 2007-06-14 21:08:45 EDT
Created attachment 71387 [details]
mylar/context/zip
Comment 7 Robert Elves CLA 2007-06-14 23:13:16 EDT
Path currently won't take in my workspace... did you still want this one applied?
Comment 8 Steffen Pingel CLA 2007-06-14 23:52:21 EDT
Created attachment 71407 [details]
updated patch

I have limited the patch to the implementation change. It fixes the sychronization state decoration for web tasks so it would be nice to have if you think it's the correct way to fix it.
Comment 9 Steffen Pingel CLA 2007-06-18 20:23:53 EDT
Created attachment 71675 [details]
updated patch
Comment 10 Steffen Pingel CLA 2007-06-18 20:25:58 EDT
*** Bug 193041 has been marked as a duplicate of this bug. ***
Comment 11 Robert Elves CLA 2007-06-18 21:18:30 EDT
 (In reply to comment #8)
> I have limited the patch to the implementation change. It fixes the
> sychronization state decoration for web tasks so it would be nice to have if you
> think it's the correct way to fix it.

Patch applied. Note there is a Bugzilla short coming that can cause the last changed task to get synched again resulting in erroneous incoming on a task marked as read (when no offline data exists), but this condition is an outlier. Lets work with it and watch.
Comment 12 Steffen Pingel CLA 2007-06-19 22:02:42 EDT
When a task changes remotely and already exists in the task list query synchronization does not pick up the changes. The reason is that TaskList.add() does not replace existing tasks. There are two options to fix this:

1) replace the existing task by removing it first
2) copy the properties from the new task to the existing task

1: This could be tricky because the task object might be used elsewhere (e.g. in the editor) and we would have to make sure that we do not loose any of the Mylyn managed properties like the notes when replacting the task.

2: Part of this has to be done by the connector similar to what is now in updateFromTaskData() only that the new method would be called updateTaskFromTask(). A default implementation could be provided that copies all properties of AbstractTask which would be sufficient for most connectors and it could be overridden by connectors for any custom properties.

I am leaning towards the latter and will start working on a patch soon if there are no objections.

Comment 13 Robert Elves CLA 2007-06-19 22:14:02 EDT
2 sounds right to me. A patch would be great!
Comment 14 Steffen Pingel CLA 2007-06-19 23:58:30 EDT
Created attachment 71826 [details]
fix upating of tasks from hits  

Here is a patch that updates existing tasks from query hits. I changed the name of the method that mirgrate the query hit properties to the existing task to updateTaskFromQueryHit() (instead of naming it updateTaskFromTask()). The patch is not beautiful but it's the best I could come up with.

Rob, please review carefully and apply.
Comment 15 Steffen Pingel CLA 2007-06-19 23:58:32 EDT
Created attachment 71827 [details]
mylar/context/zip
Comment 16 Robert Elves CLA 2007-06-20 04:39:34 EDT
Looks like this patch breaks background synchronization of incoming. Change a couple tasks remotely then Synchronize Changed from toolbar doesn't result in new incoming.  I can sort this out in the morning but if you have a spare minute in the morning....
Comment 17 Steffen Pingel CLA 2007-06-20 09:53:06 EDT
I'll try to reproduce it.
Comment 18 Steffen Pingel CLA 2007-06-20 10:13:20 EDT
Created attachment 71887 [details]
fixed incoming notification

Thanks for testing Rob. SynchronizeQueryJob checked the stale flag on the hit and not on the existing task. It's fixed in the updated patch.
Comment 19 Steffen Pingel CLA 2007-06-20 10:13:25 EDT
Created attachment 71888 [details]
mylyn/context/zip
Comment 20 Steffen Pingel CLA 2007-06-20 11:00:53 EDT
ITaskListExternalizer slipped into the patch. Rob, just exclude that file when applying the patch.
Comment 21 Mik Kersten CLA 2007-06-20 11:06:15 EDT
I put ITaskListExternalizer back.  Excluding it was a mistake commit for progress on bug 166609.  That bug is evil.
Comment 22 Steffen Pingel CLA 2007-06-20 11:35:18 EDT
Created attachment 71910 [details]
updated patch
Comment 23 Robert Elves CLA 2007-06-20 15:15:09 EDT
Patch reviewed and applied. Thanks Steffen.
Comment 24 Steffen Pingel CLA 2007-06-20 16:49:46 EDT
Thanks for all the testing Rob.