#9 Allow the bot to ignore specific bugzilla links
Opened by kparal. Modified

In this topic I link to this bugzilla:

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2123998

However, updates which are listed in that Bugzilla ticket are not really a solution to that problem. They fix some other problem, but that's not related. I want to include the bug as a reference, but I don't want issuebot to announce related Bodhi updates are solutions.

Could we add some markup to make issuebot ignore certain links? For example, this could cause issuebot ignore that line:

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2123998  <!-- issuebot ignore -->

You could easily search each line for a issuebot ignore or issuebot, ignore substring and if it matches, skip that line. Assuming you can see comments in the topic text.

WDYT?


It's a good suggestion but tricky to implement. Take a look at the JSON representation of that post:

https://ask.fedoraproject.org/t/proprietary-video-codecs-are-no-longer-hardware-accelerated-by-default-on-amd-gpus-on-fedora-37/28965.json

The raw/source view isn't available as easily, and I didn't want to parse the "cooked" (html) representation of the post text for URLs. Instead, we look further down at link_counts. This is where Discourse keeps track of how many times each link has been clicked, and handily also has a list of those links. The relevant code is here:

https://pagure.io/issuebot/blob/main/f/issuebot.py#_326-354

The only thing I can think of is something like https://bugzilla.redhat.com/show_bug.cgi?id=2123998#issuebot-ignore, which is kind of horrible, but would work.

In fact, the good news (?) is that I think this will already work, because on https://pagure.io/issuebot/blob/main/f/issuebot.py#_342, I only match on URLs ending in a sequence of digits. So actually, I think even https://bugzilla.redhat.com/show_bug.cgi?id=2123998# or https://bugzilla.redhat.com/show_bug.cgi?id=2123998& should do.

What do you think?

  1. FInd a real fix, or
  2. Document this quirk, call it a feature!

I edited the line to look like this:

Bugzilla: [#2123998](https://bugzilla.redhat.com/show_bug.cgi?id=2123998#issuebot-ignore)

So according to the code, the bot should now ignore the link.

However, I really think we should make this behavior explicit. The first reason is that if the behavior is just a random byproduct of the current regexp, somebody might easily change it in the future without realizing somebody else depends on that specific implementation. The second reason is that currently the bot currently ignores (IIUIC) completely valid links to a specific bugzilla comment, which somebody might want to include, like this:

https://bugzilla.redhat.com/show_bug.cgi?id=2123998#c2

So perhaps it would be better to parse the links like this?
1. If it contains issuebot-ignore substring, ignore it
2. If it doesn't start with https://bugzilla.redhat.com, ignore it
3. If it doesn't contain id=[0-9]+, ignore it
4. Include it

And document issuebot-ignore somewhere. The current documentation is I guess here? The README could link into it (or vice versa).

rokejulianlockhart commented

#comment-830611

@mattdm, doesn't that mean that the bot misses links that link to #c0...? That seems like a fairly significant problem.

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/quality/issuebot/issues/9

Please continue any further discussion there.

Metadata