Skip to content

hackbot-ui: add local stub API with a sample run dataset - #6391

Open
sylvestre wants to merge 2 commits into
mozilla:masterfrom
sylvestre:feat/hackbot-ui-sample-dataset
Open

hackbot-ui: add local stub API with a sample run dataset#6391
sylvestre wants to merge 2 commits into
mozilla:masterfrom
sylvestre:feat/hackbot-ui-sample-dataset

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

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).

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).
@sylvestre
sylvestre requested a review from a team as a code owner July 27, 2026 13:41
Copilot AI review requested due to automatic review settings July 27, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, a http.server-based stub implementing GET /agents, GET /runs (with filtering + pagination), and GET /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.

Comment thread services/hackbot-ui/dev/stub_api.py Outdated
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import parse_qs, urlparse

DEV_USER = "sledru@mozilla.com"
Comment thread services/hackbot-ui/dev/stub_api.py Outdated
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this was committed by mistake.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to move it under hackbot-api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants