Put the bug report behind an always-available button.

The debug report was only reachable in DEBUG mode, which is the one mode
a player hitting a real bug won't be running. Move it to a "🐛 Report a
bug" item in the game menu: a note field, a download, and a copy-as-text,
on any server.

That knowingly shows the reporter their opponents' hands and the shop
deck order. Credentials are still required, so a report only ever reaches
someone seated at that table. The buy-any-card panel stays DEBUG-only —
it changes the game; a report only reads it.
This commit is contained in:
Greyson Parrelli
2026-08-10 13:42:31 -04:00
parent 8ccde03023
commit 6ae4d41976
9 changed files with 167 additions and 123 deletions
+14 -10
View File
@@ -43,14 +43,23 @@ Set via environment or a `.env` file (see `.env.example`):
| `DATA_DIR` | `data` | Directory holding the SQLite DB |
| `PORT` | `8080` | HTTP port |
| `STATIC_DIR` | `web/dist` | Built frontend to serve |
| `DEBUG` | off | Unlocks the in-game debug panel (see below) |
| `DEBUG` | off | Unlocks the in-game buy-any-card panel |
## Debugging a game that went wrong
Any saved game can be dumped as a **debug report**: the full state (every deck
card by card, the shop row and the order of the remaining tier decks, discards,
pending choices, each player's banked Mana/Trumpets/apples), the round's battles
with their lineups and *the dice they rolled*, and the entire event log.
Any game can be dumped as a **debug report**: the full state (every deck card by
card, the shop row and the order of the remaining tier decks, discards, pending
choices, each player's banked Mana/Trumpets/apples), the round's battles with
their lineups and *the dice they rolled*, and the entire event log.
**In game**, the `⋯` menu has **🐛 Report a bug**: a note field, a
**Download report** button, and **Copy as text**. It works on any server, DEBUG
or not, so a bug hit in a real game can actually be reported. That does hand the
player their opponents' hands and the shop deck order — an accepted trade, since
a report only ever goes to someone seated at that table (`GET
/api/debug/report`, same credentials as the WebSocket).
**From the command line**, against the server's database:
```sh
mise run report # list recent games
@@ -58,11 +67,6 @@ mise run report -- QWERT # the report, as text, for reading
mise run report -- -json -out internal/game/testdata/bug.json QWERT
```
With `DEBUG=1` the in-game 🐛 panel grows two buttons — **Download JSON** and
**Copy as text** — that pull the same report over `GET /api/debug/report`. A
report exposes both players' hands and the shop deck order, so that endpoint is
DEBUG-only; on a live server use `cmd/report`, which reads the database.
The JSON form is the useful one, because it replays. Drop it in
`internal/game/testdata/` and the battle re-runs exactly — same lineups, same
dice, same events, right down to the log text: