Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The client passes charset-decoded characters to a JSON decoder expecting UTF-8 bytes, causing valid non-ASCII responses to fail parsing, caching the failure, and hiding the runs module.
1 open issue
What changed in this PR
Adds a Hackbot integration to BMO that displays run status on bug pages for authorized editbugs members.
Changes:
- Adds a permission-checked REST endpoint backed by a cached Hackbot API client.
- Adds an asynchronously loaded run table with status, origin, start time, and run links.
- Adds configuration switches, development defaults, and backend and REST tests.
| File | Description |
|---|---|
| scripts/generate_bmo_data.pl | Enables Hackbot features in generated development data. |
| qa/t/rest_hackbot_runs.t | Tests REST access controls and run responses. |
| extensions/Hackbot/web/style/hackbot_runs.css | Styles the run table and status badges. |
| extensions/Hackbot/web/js/hackbot_runs.js | Fetches and renders runs on bug pages. |
| extensions/Hackbot/template/en/default/hook/bug_modal/header-end.html.tmpl | Loads Hackbot styles and JavaScript conditionally. |
| extensions/Hackbot/template/en/default/hook/bug_modal/edit-module.html.tmpl | Adds the initially hidden Hackbot module. |
| extensions/Hackbot/template/en/default/hackbot/table.html.tmpl | Defines the run table structure. |
| extensions/Hackbot/template/en/default/admin/params/hackbot.html.tmpl | Documents integration settings for administrators. |
| extensions/Hackbot/t/bmo/bug-runs.t | Tests API handling, filtering, requester mapping, and caching. |
| extensions/Hackbot/lib/Constants.pm | Defines access, timeout, cache, and validation constants. |
| extensions/Hackbot/lib/Config.pm | Defines feature switches and connection settings. |
| extensions/Hackbot/lib/Client.pm | Implements Hackbot API requests and conditional fetching. |
| extensions/Hackbot/lib/BugRuns.pm | Caches, filters, and prepares runs for display. |
| extensions/Hackbot/lib/API/V1/Runs.pm | Exposes runs with authentication and bug-visibility checks. |
| extensions/Hackbot/Extension.pm | Registers settings and enables bug-page integration. |
| extensions/Hackbot/Config.pm | Declares the Hackbot extension identity. |
Review effort: Balanced
| return {ok => 0, status => $response->code, errmsg => $response->status_line}; | ||
| } | ||
|
|
||
| my $data = eval { decode_json($response->decoded_content) }; |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds a Hackbot module to the bug page that lists the bug's Hackbot runs: agent, status, origin, start time, and a "view run" link into the Hackbot UI. Until now a run gave no sign on the bug until it posted a comment, so nobody could tell whether Hackbot had picked up a needinfo request or was still working on it.
Screenshot
Changes
Hackbotextension. The bug page loads the table fromGET /rest/hackbot/bug_runs/:bug_id, and BMO forwards that request to the Hackbot API (GET /runs?bug_id=N, Bug 2091030 - Add the ability to filter runs based on bug id in the hackbot API bugbug#7440) with anX-API-Key.editbugsonly, and the user must be able to see the bug. Each run'sbug_idmust match the bug, so an API that ignores the filter can't leak runs from other bugs. Only nicks reach the browser, never emails.If-None-Match(kept for a day). Failures are cached for 60 s.hackbot_runs_enabled,hackbot_api_url,hackbot_api_keyandhackbot_ui_url. Test data turns the feature on.Tests
extensions/Hackbot/t/bmo/bug-runs.t: client, trimming, origin mapping, ETag/304/error caching.qa/t/rest_hackbot_runs.t: login,editbugsand private-bug access, response shape.Depends on
mozilla/bugbug#7442 (the
bug_idfilter) being deployed.