GNOME Bugzilla – Bug 652660
Make Individual.id more stable and well-defined
Last modified: 2011-06-24 13:47:43 UTC
Change it to be a stable hash of the UIDs of the personas in the individual's persona set. Advise clients that the ID may change over time if the individual is subsequently linked to another individual. Advise that they should use the most relevant persona's UID instead if they want the link to persist over time (e.g. when tagging photos).
Created attachment 189995 [details] [review] Make Individual.id more stable http://cgit.collabora.com/git/user/pwith/folks/log/?h=652660-individual-id
Review of attachment 189995 [details] [review]: + * instead. For example, if storing references to Individuals who are tagged + * in a photo, it may be safer to store the UID of the Persona whose backend + * provided the photo (e.g. Facebook). We should provide a utility function for this. Letting applications run wild with their own heuristic seems like trouble waiting to happen. (This is the reason for the needs-work review status) + default_individuals.add ("1038ba3738014da2e71552e841fa4a15f5863f05"); + default_individuals.add ("8894dd5bc1f12ca6ecae495b390f80f6c12562d3"); + default_individuals.add ("d2a1c39becbda75573f343d2d628d27e0ef60e0e"); + default_individuals.add ("935018a015bfdb325dd19de99ab8544f109def5b"); + default_individuals.add ("28e811b0e3742a452998ff804d9387a6842841c3"); + default_individuals.add ("4c95033b91a7d2dd440a73194dd86f2bfd12208b"); + default_individuals.add ("d7dcc6ab070f45e532a8dfe71301007293ee45cc"); + default_individuals.add ("5ef41481af6f40038e79afbc304a9fcf5f7b8f2d"); Please define each of these hashes as a reasonably-named symbol (and in other tests where it matters as well). + if (i.id != "ad34428954c49db6029d94f58442877ae7167d23") Define this as well. + default_individuals.add ("420e4db98eef7110399bc5978b2a9081e92895b6"); + default_individuals.add ("1cc40d4f1a878aecb8fefc4f9bf691fc9fc7589d"); ... Same.
(In reply to comment #2) > Review of attachment 189995 [details] [review]: > > + * instead. For example, if storing references to Individuals who are tagged > + * in a photo, it may be safer to store the UID of the Persona whose backend > + * provided the photo (e.g. Facebook). > > We should provide a utility function for this. Letting applications run wild > with their own heuristic seems like trouble waiting to happen. > > (This is the reason for the needs-work review status) Split out as bug #652807.
As discussed briefly at the hackfest, we're probably best instead making an Individual.id equal to the SHA1 hash of $(most relevant Persona).id This has the following useful properties: * should be reasonably stable in most cases * deterministic * hashed, so lazy developers won't use it interchangeably with the Persona.id or assume it's static Some suboptimal properties: * not human-mappable back to the objects themselves (but sufficient debugging statements should minimize this) * not perfectly-stable (unsolvable problem, since people don't have UUIDs) * hashing takes some processing (though this shouldn't approach anything that would be a problem)
I've decided the strategy below is awful, but I'm writing it down for posterity. ---------------- (In reply to comment #4) > As discussed briefly at the hackfest, we're probably best instead making an > Individual.id equal to the SHA1 hash of $(most relevant Persona).id Alternatively, we could Individuals in a simple ini file with entries like: [<some hash>] personas=<persona id 1>;<persona id 2>;... (or perhaps something a little more efficient, like sqlite just using cross-referencing tables) We would still be able to suggest new links, allow linking, etc. It'd just get stored explicitly. Benefits (relative to strategy in comment #4): * should be more stable. We'd update the set of Persona IDs in-place whenever the links on an Individual change Anti-benefits: * Individual IDs would no longer be deterministic * we'll still have to do all the work to associate implicitly in the aggregator anyhow * this would end up duplicating most of the state in the primary backend
Created attachment 190110 [details] [review] Make Individual.id more stable (attempt 2) http://cgit.collabora.com/git/user/pwith/folks/log/?h=652660-individual-id As discussed at the hackfest, it would be better to use the UID of the “most interesting” Persona in the Individual to give the Individual's ID. This means that the ID may remain stable across linking and unlinking (though this can't be guaranteed). I've updated the branch with patches to fix up the original commit to do this. The new patch is a squashed version of these.
Review of attachment 190110 [details] [review]: Looks good.
Comment on attachment 190110 [details] [review] Make Individual.id more stable (attempt 2) commit 6ffb9775808386369c9a1fd45a072f404d410330 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Wed Jun 15 18:44:18 2011 +0100 Bug 652660 — Make Individual.id more stable and well-defined NEWS | 1 + folks/individual.vala | 60 +++++++++++++++++++++++--- tests/folks/aggregation.vala | 64 +++++++++++++++++++--------- tests/telepathy/individual-properties.vala | 17 ++++---- tests/telepathy/individual-retrieval.vala | 37 +++++++++++----- 5 files changed, 132 insertions(+), 47 deletions(-)