Make a bug report one click, and fill in the half the reporter cannot #1065

Merged
jaylouisw merged 2 commits from feat/one-click-bug-report into main 2026-11-08 14:50:34 +00:00
Owner

Reporting a bug meant finding the repository, choosing between six issue templates, and then working out for yourself which build, Node version and browser you were running. The parts a reporter can reasonably supply — what happened, how to make it happen — are the short part. The rest is the part they leave out, and a report with no build in it is a conversation rather than a bug.

What this adds

A Report a bug button in the top bar, one click from anywhere in the app. It opens the new-issue form pre-filled with what the running app already knows:

Field Source
PacketForge build new GET /api/version — package version, optional PF_COMMIT
Node / platform same endpoint
Browser the browser's own user-agent string
Page location.href
Catalogue size makes "this device is missing" answerable without a second round trip

The body carries an empty What happened and a numbered Steps to reproduce skeleton, plus a comment noting that the environment block was filled in by the app so the reporter knows what to correct.

/api/version is deliberately tiny and dependency-free: it reads package.json at request time and reports devices: catalog.length.

When things go wrong

If /api/version cannot be reached, the version field says so — unknown (GET /api/version failed: …) — and the form still opens. A server that will not answer is frequently the bug being reported.

Tests

  • test/bug-report.test.js (26 assertions) loads the real web/app.js in a stub DOM and tests the builder directly: the URL points at the Forgejo tracker and not the GitHub mirror, every environment field reaches the body, the title/body round-trip through encodeURIComponent, and — the important one — an empty environment yields unknown, never the literal "undefined" or "null". It also asserts the button exists in index.html inside .topbar-actions, with an aria-label, a title, and a click handler in app.js.
  • scripts/smoke-http.js now checks /api/version answers, and that the catalogue size it reports equals what /api/catalog serves.

Verified locally

node scripts/syntax-check.js 162 files OK · npm test 103 suites, 4951 assertions, 0 failures · node scripts/smoke-http.js all checks clean (/api/version → 0.1.0, node v24.11.0, 1549 models on both endpoints).

Reporting a bug meant finding the repository, choosing between six issue templates, and then working out for yourself which build, Node version and browser you were running. The parts a reporter can reasonably supply — what happened, how to make it happen — are the short part. The rest is the part they leave out, and a report with no build in it is a conversation rather than a bug. ### What this adds A **Report a bug** button in the top bar, one click from anywhere in the app. It opens the new-issue form pre-filled with what the running app already knows: | Field | Source | |---|---| | PacketForge build | new `GET /api/version` — package version, optional `PF_COMMIT` | | Node / platform | same endpoint | | Browser | the browser's own user-agent string | | Page | `location.href` | | Catalogue size | makes "this device is missing" answerable without a second round trip | The body carries an empty **What happened** and a numbered **Steps to reproduce** skeleton, plus a comment noting that the environment block was filled in by the app so the reporter knows what to correct. `/api/version` is deliberately tiny and dependency-free: it reads `package.json` at request time and reports `devices: catalog.length`. ### When things go wrong If `/api/version` cannot be reached, the version field says *so* — `unknown (GET /api/version failed: …)` — and the form still opens. A server that will not answer is frequently the bug being reported. ### Tests - `test/bug-report.test.js` (26 assertions) loads the real `web/app.js` in a stub DOM and tests the builder directly: the URL points at the Forgejo tracker and not the GitHub mirror, every environment field reaches the body, the title/body round-trip through `encodeURIComponent`, and — the important one — an **empty environment yields `unknown`, never the literal `"undefined"` or `"null"`**. It also asserts the button exists in `index.html` inside `.topbar-actions`, with an `aria-label`, a `title`, and a click handler in `app.js`. - `scripts/smoke-http.js` now checks `/api/version` answers, and that the catalogue size it reports equals what `/api/catalog` serves. ### Verified locally `node scripts/syntax-check.js` 162 files OK · `npm test` 103 suites, 4951 assertions, 0 failures · `node scripts/smoke-http.js` all checks clean (`/api/version` → `0.1.0`, `node v24.11.0`, 1549 models on both endpoints).
Make a bug report one click, and fill in the half the reporter cannot
Some checks failed
CI / Test (Node 18) (pull_request) Failing after 1m25s
CI / Test (Node 20) (pull_request) Failing after 1m21s
CI / Server smoke test (pull_request) Successful in 26s
CI / Docker build (pull_request) Successful in 11s
CI / Test (Node 22) (pull_request) Failing after 1m21s
ff7fc52544
Reporting a bug meant finding the repository, choosing between six issue
templates, and then working out for yourself which build, Node version and
browser you were running. Everything the person reporting it can reasonably be
asked for - what happened, and how to make it happen - is the short part. The
rest is the part they get wrong or leave out, and a report with no build in it is
a conversation rather than a bug.

There is now a Report a bug button in the top bar. It opens the new-issue form
pre-filled with what the running app already knows:

  - PacketForge version, from a new GET /api/version (package version, optional
    PF_COMMIT, Node, platform, catalogue size)
  - the browser's own user-agent string and the page URL
  - the catalogue size, which is what makes 'this device is missing' answerable
    without a second round trip

The body has an empty What happened and a numbered Steps to reproduce skeleton,
and a comment saying the rest was filled in by the app so the reporter knows what
to correct.

When /api/version cannot be reached the field says so, and the form still opens:
the server not answering is itself the bug being reported.

test/bug-report.test.js loads the real app.js in a stub DOM and asserts the
builder directly, including that an empty environment yields 'unknown' and never
the string 'undefined'. scripts/smoke-http.js now checks /api/version answers and
counts the same catalogue as /api/catalog.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-08 14:44:32 +00:00
Do not promise a console link that was never written
Some checks failed
CI / Test (Node 18) (pull_request) Failing after 1m30s
CI / Test (Node 20) (pull_request) Failing after 1m24s
CI / Server smoke test (pull_request) Successful in 23s
CI / Docker build (pull_request) Successful in 10s
CI / Test (Node 22) (pull_request) Failing after 1m24s
d820334021
When a popup blocker stopped the report window, the toast said the link was in
the console - and nothing put it there. That turned 'report a bug' into a dead
end at exactly the moment someone had something to report.

The URL is now built once and logged with console.warn before the toast mentions
it, and the handler returns the same URL in both cases. The test drives the real
handler twice, with window.open returning null and returning a window, and
asserts what was logged is the report link rather than a promise of one.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-08 14:50:23 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1065
No description provided.