hackbot-ui: add local stub API with a sample run dataset - #6391
Open
sylvestre wants to merge 2 commits into
Open
hackbot-ui: add local stub API with a sample run dataset#6391sylvestre wants to merge 2 commits into
sylvestre wants to merge 2 commits into
Conversation
A dependency-free stdlib HTTP server that stands in for hackbot-api during
local UI development, so the dashboard can be exercised without Cloud SQL or
GCP. Serves GET /agents, GET /runs (honoring agent/status/author/limit/offset)
and GET /runs/{id} from a seeded set of runs spanning several agents,
statuses, and authors (including unattributed automation runs).
There was a problem hiding this comment.
Pull request overview
Adds a small, dependency-free Python HTTP server under hackbot-ui/dev/ to stand in for hackbot-api during local UI development, serving seeded run/agent data without requiring GCP/Cloud SQL.
Changes:
- Introduces
dev/stub_api.py, ahttp.server-based stub implementingGET /agents,GET /runs(with filtering + pagination), andGET /runs/{id}. - Seeds a small in-memory dataset spanning multiple agents/statuses and some error conditions.
Comments suppressed due to low confidence (3)
services/hackbot-ui/dev/stub_api.py:28
- These seed entries include what look like real employee email addresses. Please replace them with obviously fake placeholders to avoid committing personal data.
("padenot@mozilla.com", "frontend-triage", "succeeded", {"bug_id": 1890777}),
(DEV_USER, "build-repair", "failed", {"git_commit": "a1b2c3d4e5f6a7b8"}),
(DEV_USER, "frontend-triage", "running", {"bug_id": 1891555}),
("smujahid@mozilla.com", "test-plan-generator", "succeeded", {"feature_name": "WebGPU compute"}),
(None, "bug-fix", "timed_out", {"bug_id": 1888120, "revision_id": 410900}),
services/hackbot-ui/dev/stub_api.py:34
- More seed entries with what look like real employee email addresses. Please swap these for clearly fake placeholders (e.g., contrib1/2/3@mozilla.com).
("mcastelluccio@mozilla.com", "bug-fix", "failed", {"bug_id": 1887654}),
(DEV_USER, "test-plan-generator", "pending", {"feature_name": "Cookie partitioning"}),
(DEV_USER, "bug-fix", "succeeded", {"bug_id": 1893100}),
("smujahid@mozilla.com", "build-repair", "running", {"git_commit": "ffee00112233aabb"}),
("mcastelluccio@mozilla.com", "bug-fix", "succeeded", {"bug_id": 1885000, "revision_id": 409001}),
services/hackbot-ui/dev/stub_api.py:40
- More seed entries with what look like real employee email addresses. Please replace with fake placeholders to avoid committing personal data.
("padenot@mozilla.com", "autowebcompat-repro", "timed_out", {"bug_id": 1886777}),
(DEV_USER, "bug-fix", "failed", {"bug_id": 1895333}),
(DEV_USER, "bug-fix", "running", {"bug_id": 1896444}),
("mcastelluccio@mozilla.com", "frontend-triage", "succeeded", {"bug_id": 1897555}),
(None, "bug-fix", "succeeded", {"bug_id": 1884321, "revision_id": 408222}),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer | ||
| from urllib.parse import parse_qs, urlparse | ||
|
|
||
| DEV_USER = "sledru@mozilla.com" |
Comment on lines
+122
to
+124
| offset = int(q.get("offset", ["0"])[0]) | ||
| limit = int(q.get("limit", ["50"])[0]) | ||
| return self._json(items[offset : offset + limit]) |
- Replace real @mozilla.com addresses in the seed data with example.com placeholders; make the "current user" identity overridable via HACKBOT_DEV_USER. - Return 400 instead of crashing on non-integer limit/offset. - Drop the unused STATUSES constant and reflow the docstring.
suhaibmujahid
requested changes
Jul 27, 2026
Member
There was a problem hiding this comment.
I expect this was committed by mistake.
Member
There was a problem hiding this comment.
It would be nice to move it under hackbot-api.
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.
A dependency-free stdlib HTTP server that stands in for hackbot-api during local UI development, so the dashboard can be exercised without Cloud SQL or GCP. Serves GET /agents, GET /runs (honoring agent/status/author/limit/offset) and GET /runs/{id} from a seeded set of runs spanning several agents, statuses, and authors (including unattributed automation runs).