mozilla / mozilla/bugbot

[Feature request] Searchfox links to instances that matches resolved bug

Open
#1,239 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
68
Forks
92
Avg merge
2d 2h
Merged PRs (30d)
16

Description

In DevTools code, it's not uncommon for us to reference Bug numbers in comments to indicate something can be done once the bug is fixed (for example: devtools/client/shared/output-parser.js#1432).

I was thinking it would be nice if the bot could put a comment with a Searchfox search results of Bug XXX when a Bug XXX is resolved, so the authors could be notified about potential cleanup followups.

Searchfox will return some nice JSON objects when calling it with a json header:

var urlSearchParams = new URLSearchParams({
  q: "Bug 711942"
});
var url = `https://searchfox.org/mozilla-central/search?${urlSearchParams}`;
var response = await fetch(url, {
  headers: {
    'Accept': 'application/json, text/javascript, */*; q=0.01'
  }
});
await response.json()

returns

{
  "normal": {
    "Textual Occurrences": [
      {
        "path": "devtools/client/shared/output-parser.js",
        "lines": [
          {
            "lno": 1432,
            "bounds": [
              9,
              19
            ],
            "line": "      // Bug 711942 will add a tooltip to edit angle values and we should"
          }
        ]
      }
    ]
  },
  "*title*": "Bug 711942",
  "*timedout*": false
}

So here autonag could print something along those lines:

"Bug 711942" references were found in the code:
- "// Bug 711942 will add a tooltip to edit angle values and we should" in [devtools/client/shared/output-parser.js#1432](https://searchfox.org/mozilla-central/rev/ac7a567f036e1954542763f4722fbfce041fb752/devtools/client/shared/output-parser.js#1432)

where the path would be a link to Searchfox (e.g. )

I don't know if that's a pattern used by other teams, but our team would benefit from it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Searchfox search endpoint and its JSON response example, then trace the autonag path that handles resolved bugs and posts comments. Done means the bot can identify matching “Bug XXX” references and post comments containing Searchfox links and matching source lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.