Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

Wrong folders structure #100

Closed
SergeyZhukovsky opened this issue Jun 16, 2017 · 11 comments · Fixed by #126
Closed

Wrong folders structure #100

SergeyZhukovsky opened this issue Jun 16, 2017 · 11 comments · Fixed by #126
Milestone

Comments

@SergeyZhukovsky
Copy link
Member

SergeyZhukovsky commented Jun 16, 2017

Laptop browser version is 0.17.3, Android sync version 1.3.0 the latest update on f4b5d75 commit
I have an empty profile mostly on production server, there are two folders on top level Parent1 and Test1. Test1 has a one bookmark inside. Initially Test1 folder was a subfolder of Parent1 and was moved after.
seatwork solely conserve misruled
sunder blandish loosed symbiot
acadia bore thanatology assumably
liftable nodding jewry correl

So on a fresh initial sync I have a correct structure, but laptop keeps showing Test1 as a subfolder of Parent1. I took logs. Here what I have on GET_EXISTING_OBJECTS:
[{"action":0,"deviceId":{"0":1},"objectId":{"0":196,"1":118,"2":189,"3":208,"4":37,"5":227,"6":63,"7":116,"8":229,"9":123,"10":67,"11":128,"12":84,"13":60,"14":178,"15":180},"bookmark":{"site":{"location":"https://m.facebook.com/","title":"Facebook – log in or sign up","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""},"isFolder":false,"parentFolderObjectId":[]},"objectData":"bookmark","syncTimestamp":1497571909002},{"action":0,"deviceId":{"0":1},"objectId":{"0":30,"1":44,"2":28,"3":165,"4":119,"5":114,"6":219,"7":224,"8":48,"9":58,"10":238,"11":252,"12":168,"13":155,"14":188,"15":177},"bookmark":{"site":{"location":"","title":"Test1","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""},"isFolder":true,"parentFolderObjectId":[]},"objectData":"bookmark","syncTimestamp":1497571918914},{"action":1,"deviceId":{"0":1},"objectId":{"0":196,"1":118,"2":189,"3":208,"4":37,"5":227,"6":63,"7":116,"8":229,"9":123,"10":67,"11":128,"12":84,"13":60,"14":178,"15":180},"bookmark":{"site":{"location":"https://m.facebook.com/","title":"Facebook – log in or sign up","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""},"isFolder":false,"parentFolderObjectId":{"0":30,"1":44,"2":28,"3":165,"4":119,"5":114,"6":219,"7":224,"8":48,"9":58,"10":238,"11":252,"12":168,"13":155,"14":188,"15":177}},"objectData":"bookmark","syncTimestamp":1497571918933},{"action":0,"deviceId":{"0":1},"objectId":{"0":79,"1":251,"2":234,"3":116,"4":33,"5":193,"6":72,"7":214,"8":162,"9":115,"10":189,"11":120,"12":100,"13":247,"14":121,"15":22},"bookmark":{"site":{"location":"","title":"Parent1","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""},"isFolder":true,"parentFolderObjectId":[]},"objectData":"bookmark","syncTimestamp":1497571975338},{"action":1,"deviceId":{"0":1},"objectId":{"0":30,"1":44,"2":28,"3":165,"4":119,"5":114,"6":219,"7":224,"8":48,"9":58,"10":238,"11":252,"12":168,"13":155,"14":188,"15":177},"bookmark":{"site":{"location":"","title":"Test1","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""},"isFolder":true,"parentFolderObjectId":{"0":79,"1":251,"2":234,"3":116,"4":33,"5":193,"6":72,"7":214,"8":162,"9":115,"10":189,"11":120,"12":100,"13":247,"14":121,"15":22}},"objectData":"bookmark","syncTimestamp":1497571975376},{"action":1,"deviceId":{"0":0},"objectId":{"0":30,"1":44,"2":28,"3":165,"4":119,"5":114,"6":219,"7":224,"8":48,"9":58,"10":238,"11":252,"12":168,"13":155,"14":188,"15":177},"bookmark":{"hideInToolbar":false,"isFolder":true,"parentFolderObjectId":{"0":79,"1":251,"2":234,"3":116,"4":33,"5":193,"6":72,"7":214,"8":162,"9":115,"10":189,"11":120,"12":100,"13":247,"14":121,"15":22},"site":{"location":"","title":"Test1","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""}},"objectData":"bookmark","syncTimestamp":1497572014030},{"action":1,"deviceId":{"0":1},"objectId":{"0":30,"1":44,"2":28,"3":165,"4":119,"5":114,"6":219,"7":224,"8":48,"9":58,"10":238,"11":252,"12":168,"13":155,"14":188,"15":177},"bookmark":{"site":{"location":"","title":"Test1","customTitle":"","lastAccessedTime":0,"creationTime":0,"favicon":""},"isFolder":true,"parentFolderObjectId":[]},"objectData":"bookmark","syncTimestamp":1497572038641}]


After that I send that on SEND_RESOLVED_RECORDS:
[[{ action: 0, deviceId: [1], objectId: [196, 118, 189, 208, 37, 227, 63, 116, 229, 123, 67, 128, 84, 60, 178, 180], objectData: 'bookmark', bookmark:{ site:{ location: "https://m.facebook.com/", title: "Facebook – log in or sign up", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: false, parentFolderObjectId: null} }, null], [{ action: 0, deviceId: [1], objectId: [30, 44, 28, 165, 119, 114, 219, 224, 48, 58, 238, 252, 168, 155, 188, 177], objectData: 'bookmark', bookmark:{ site:{ location: "", title: "Test1", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: true, parentFolderObjectId: null} }, null], [{ action: 1, deviceId: [1], objectId: [196, 118, 189, 208, 37, 227, 63, 116, 229, 123, 67, 128, 84, 60, 178, 180], objectData: 'bookmark', bookmark:{ site:{ location: "https://m.facebook.com/", title: "Facebook – log in or sign up", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: false, parentFolderObjectId: [30, 44, 28, 165, 119, 114, 219, 224, 48, 58, 238, 252, 168, 155, 188, 177]} }, null], [{ action: 0, deviceId: [1], objectId: [79, 251, 234, 116, 33, 193, 72, 214, 162, 115, 189, 120, 100, 247, 121, 22], objectData: 'bookmark', bookmark:{ site:{ location: "", title: "Parent1", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: true, parentFolderObjectId: null} }, null], [{ action: 1, deviceId: [1], objectId: [30, 44, 28, 165, 119, 114, 219, 224, 48, 58, 238, 252, 168, 155, 188, 177], objectData: 'bookmark', bookmark:{ site:{ location: "", title: "Test1", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: true, parentFolderObjectId: [79, 251, 234, 116, 33, 193, 72, 214, 162, 115, 189, 120, 100, 247, 121, 22]} }, null], [{ action: 1, deviceId: [0], objectId: [30, 44, 28, 165, 119, 114, 219, 224, 48, 58, 238, 252, 168, 155, 188, 177], objectData: 'bookmark', bookmark:{ site:{ location: "", title: "Test1", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: true, parentFolderObjectId: [79, 251, 234, 116, 33, 193, 72, 214, 162, 115, 189, 120, 100, 247, 121, 22]} }, null], [{ action: 1, deviceId: [1], objectId: [30, 44, 28, 165, 119, 114, 219, 224, 48, 58, 238, 252, 168, 155, 188, 177], objectData: 'bookmark', bookmark:{ site:{ location: "", title: "Test1", customTitle: "", favicon: "", lastAccessedTime: 0, creationTime: 0}, isFolder: true, parentFolderObjectId: null} }, null]]


and that is what I receive on RESOLVED_RECORDS:
[{"action":0,"deviceId":[1],"objectId":[196,118,189,208,37,227,63,116,229,123,67,128,84,60,178,180],"objectData":"bookmark","bookmark":{"site":{"location":"https://m.facebook.com/","title":"Facebook – log in or sign up","customTitle":"","favicon":"","lastAccessedTime":0,"creationTime":0},"isFolder":false,"parentFolderObjectId":[30,44,28,165,119,114,219,224,48,58,238,252,168,155,188,177]}},{"action":0,"deviceId":[1],"objectId":[30,44,28,165,119,114,219,224,48,58,238,252,168,155,188,177],"objectData":"bookmark","bookmark":{"site":{"location":"","title":"Test1","customTitle":"","favicon":"","lastAccessedTime":0,"creationTime":0},"isFolder":true,"parentFolderObjectId":null}},{"action":0,"deviceId":[1],"objectId":[79,251,234,116,33,193,72,214,162,115,189,120,100,247,121,22],"objectData":"bookmark","bookmark":{"site":{"location":"","title":"Parent1","customTitle":"","favicon":"","lastAccessedTime":0,"creationTime":0},"isFolder":true,"parentFolderObjectId":null}}]


You can see that it is a correct structure on RESOLVED_RECORDS. I have no idea why laptop does it different and more then that iOS also does the same way as laptop.

@SergeyZhukovsky
Copy link
Member Author

I think I found a root case of that. The same happens if you do that on laptop, iOS and Android never get the changes. I just receive 0 records on upcoming fetch, maybe it is something with timestamps. Do you guys update timestamps when an object was moved?
But also I found that all devices get it ok on initial fetch. So I guess it is related to timestamps somehow.

@diracdeltas
Copy link
Member

Do you guys update timestamps when an object was moved?

when a bookmark is moved, browser-laptop should be sending an UPDATE record with a new parentFolderObjectId field. so that should have a new timestamp if it is actually sent to the server. it's possible that it is not sent in some cases.

i tried the following on two browser-laptop instances and it worked:

  1. setup pyramid 0
  2. sync pyramid 1 to pyramid 0
  3. add a bookmark and a folder in pyramid 0. wait for it to show up in pyramid 1
  4. move the bookmark into the folder in pyramid 0. wait for the change to show up in pyramid 1.

@SergeyZhukovsky
Copy link
Member Author

@diracdeltas How do timestamps added? I mean want timezone format? For example I use my local on Android device, but probably it is missed because my local is ahead of the sync server time zone?

@diracdeltas
Copy link
Member

i think timestamp is just client time in s: Date.now() / 1000

@SergeyZhukovsky
Copy link
Member Author

SergeyZhukovsky commented Jun 18, 2017

@diracdeltas I'm not sure is there a problem with two laptops, but it is when you have diff platforms. The original ticket is that https://github.com/brave/browser-android-tabs/issues/279. But exactly the same happens when you do the rename on laptop, Android and iOS never get that change. I verified I just receive an empty array on GET_EXISTING_OBJECTS. But if I do an initial sync on another Android device for example, it gets that change without any problems.

@diracdeltas
Copy link
Member

@SergeyZhukovsky could you re-try with latest 0.17.x? if it's broken there, please try master

@SergeyZhukovsky
Copy link
Member Author

That is the same as this issue #107

@bridiver
Copy link
Contributor

I think this is still not working correctly, @darkdh collected details yesterday and will update

@SergeyZhukovsky
Copy link
Member Author

Ya I think it was never fixed actually!

@bridiver
Copy link
Contributor

@darkdh can comment with more info, but I think the problem is the way things are merged. It always merges the local version on top of the remote version without checking any kind of timestamp. We tried to work around it in core by keeping track of our own last updated time vs sync timestamp and only matching records that had been updated locally, but still having some issues with that.

@bridiver
Copy link
Contributor

cc @AlexeyBarabash

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants