Page MenuHomePhabricator

GerritBot comments for 7-digit Gerrit changes conflict with Diffusion commit hashes
Closed, ResolvedPublic

Description

GerritBot comments for 7-digit Gerrit changes conflict with Diffusion commit hashes.

That's a mouthful, so just look at T356157#9581302 or T358932#9592922:

image.png (334×2 px, 58 KB)

image.png (334×2 px, 63 KB)

The first link goes to a completely unrelated commits – it just happens that the hexadecimal commit hash happens to start with 7 decimal digits, and we now have 7-digit changes in Gerrit.

Can we configure Phabricator so that it doesn't try to auto-link commit hashes that only contain digits? Or failing that, hashes shorter than 8 characters?

Event Timeline

Change 1008001 had a related patch set uploaded (by Mainframe98; author: Mainframe98):

[operations/puppet@production] GerritBot: Escape change number

https://gerrit.wikimedia.org/r/1008001

I guess that also works, but I really think this is a problem on the Phabricator side. Our repositories are big enough that 7-hexdigit hashes are too short to be unambiguous. Git itself uses adaptive length depending on the repo size, and I'm seeing 11-hexdigit short hashes in my clone of mediawiki/core (and if it knew about all the other repos, they'd probably be longer).

Change 1008001 abandoned by Mainframe98:

[operations/puppet@production] GerritBot: Escape change number

Reason:

Remarkup doesn't support escaping part of a line

https://gerrit.wikimedia.org/r/1008001

We could also just stop mirroring and empty the Diffusion repos whose only benefit is the auto-linking.

More examples: T89947#9538996, T352308#9609776 (I swear I'm not going looking for them, these are just from tasks in my inbox, so this seems like a common problem)

Both increasing the minimum number of digits and emptying the repos would break existing links. Couldn’t the above patch work with a bit different syntax?

Patch (broken)
Change %%%1006969%%% **abandoned** by Example:

Change %%%rEVED1006969baddf%%% abandoned by Example:

Backtick
Change `1006969` **abandoned** by Example:

Change 1006969 abandoned by Example:

Number sign

The change ID is a serial number after all.

Change #1006969 **abandoned** by Example:

Change #1006969 abandoned by Example:

Link

This could replace the link at the end of the message.

Change [1006969](https://gerrit.wikimedia.org/r/1006969) **abandoned** by Example:

Change 1006969 abandoned by Example:

T360026#9636990

Phabricator adds backlinks on the change sets, which makes it harder to see a dependency between all these links get generated by random. A fix would be nice. Using the has to make it a number sounds good.

Link

This could replace the link at the end of the message.

Change [1006969](https://gerrit.wikimedia.org/r/1006969) **abandoned** by Example:

Change 1006969 abandoned by Example:

The link is at the moment behind the first line of the commit in the comment by gerritbot, but moving the link looks good as well.

Change 1013097 had a related patch set uploaded (by Aklapper; author: Aklapper):

[operations/puppet@production] GerritBot: Avoid Phabricator auto-linking Gerrit change numbers

https://gerrit.wikimedia.org/r/1013097

Change 1013097 merged by Jelto:

[operations/puppet@production] GerritBot: Avoid Phabricator auto-linking Gerrit change numbers

https://gerrit.wikimedia.org/r/1013097

The change has been deployed and prefixing the change number with # should fixes the issues for new comments.

Aklapper triaged this task as Medium priority.
Aklapper moved this task from To Triage to External on the Phabricator board.

QA - works good: