[codeface] Re: [PATCH 4/4] Fix: Id case where no email address is found for a developer

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Fri, 04 Apr 2014 14:47:52 +0200

Hi Mitchell,

On 03/04/14 18:25, Mitchell Joblin wrote:
> - this case happens when a developer does not add there
>   email in a commit
> 
> - some projects are very strict about always including a developer
>   email but in the case of apache style tags the email is most
>   often not included, only the developer name is
> 
> - developers without an email were previously assigned a generic replacement,
>   the problem with this approach is that the email is used for
>   merging aliases and thus everyone with the same email gets assigned
>   the same person Id
> 
> - we now introduce a random string email replacement so that the
>   alias merging will resolve unique Ids for people without an
>   email address
> 
> - an alternative solution would be to change the order in which
>   the id service performes alias merging and keep the generic
>   replacement email, I think that the generic email is a bad
>   idea in general since the nature of an email address is
>   unique to the individual or organization that it represents
>   and we destroy that notion of uniqueness when we assign a generic
>   email, I think we still need to know when an email was artificially
>   generated and thats why we need a generic plus a unique component
>   for the email as provided by this patch
agreed, I like the random email generation better than changing the
alias merging order. I was thinking about using an even simpler
method that does not assign a completely random identifier, but
uses a consecutive numbering. While this would eliminate the
(tiny) probability that different persons receive the same
random emails address, it adds a global state that needs to
be protected in parallel execution, and is thus not worth
while the effort.
> 
> Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx>

Reviewed-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxx>

Practical detail: Would you prefer me to merge the uncontroversial
patches directly and then take the changed ones, or do you want to
submit a reworked stack?

Thanks, Wolfgang

> ---
>  codeface/cluster/idManager.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/codeface/cluster/idManager.py b/codeface/cluster/idManager.py
> index 8030028..944cc1e 100644
> --- a/codeface/cluster/idManager.py
> +++ b/codeface/cluster/idManager.py
> @@ -23,6 +23,7 @@ import httplib
>  import urllib
>  import json
>  import string
> +import random
>  
>  class idManager:
>      """Provide unique IDs for developers.
> @@ -88,7 +89,9 @@ class idManager:
>                  # In this case, no eMail address was specified.
>  #                print("Fixup for email required, but FAILED for 
> {0}".format(addr))
>                  name = addr
> -                email = "could.not@xxxxxxxxxxxxxxx"
> +                rand_str = "".join(random.choice(string.ascii_lowercase + 
> string.digits)
> +                                   for i in range(10))
> +                email = "could.not.resolve@"+rand_str
>  
>          email = email.lower()
>  
> 


Other related posts: