latin-language-toolkit/arethusa — pull request #566 by balmas (2014-12-28 01:59:41+00:00)
Title: Idmap fix

Per email discussion with @LFDM . We are still not sure why we are losing newly added artificial tokens even with the fixes in the ellipsis_fix branch, but at least one symptom is that sourceids are being reassigned. We decided it would be a good idea to make the idhandling code more robust by refusing to reassign already assigned sourceids when creating/updating IdMaps for tokens.

Originally I was thinking we should throw some sort of notification if we try to do this but it's not clear to me what form that should take. So the change in this pull request so far just silently fails to steal an already mapped sourceId.

Note that this idmap_fix branch was on master, which doesn't yet have the ellipses fix in the treebank persister, and so would normally be stealing tokens if you try to persist a doc with newly added artificial tokens twice (because of the reassignment to the lastId at https://github.com/latin-language-toolkit/arethusa/blob/master/app/js/arethusa/treebank_persister.js#L135). This token stealing no longer occurs with the change in this pull request, because the reassignment no longer has any effect.

I'm not sure we want to merge this request as-is without doing something more with the notifications, but sending it on as-is for some feedback on what I've done so far.

Thanks!