Add replayable debug reports.

A report dumps everything needed to understand a game that went wrong:
the full state (decks card by card, shop row and tier deck order,
discards, pending choices, banked Mana/Trumpets/apples), the round's
battles, and the whole event log. Available as JSON, which replays, or
text, which reads — and the text ends with a paste-ready repro test.

Battles now record the randomness they consume alongside what they
started from, so a result can be replayed long after the round cleared
those banks: same lineups, same dice, same events, down to the log text.
Results predating the recording say so rather than quietly re-rolling.

Three ways in: the 🐛 panel's download/copy buttons, GET
/api/debug/report (DEBUG-only, since a report holds both players' hands
and the shop deck order), and `mise run report`, which reads the
database directly so a live game can be dumped without DEBUG.
This commit is contained in:
Greyson Parrelli
2026-08-10 10:06:06 -04:00
parent a4f5f6910d
commit 8ccde03023
16 changed files with 1480 additions and 19 deletions
+43
View File
@@ -3536,6 +3536,49 @@ h3 {
margin-bottom: 8px;
}
/* The report buttons sit above the card list, small and out of the way — they
are used once a session, when something has already gone wrong. */
.debug-report {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
margin-bottom: 12px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
font-size: 0.75rem;
}
.debug-report-btn {
background: rgba(255, 255, 255, 0.1);
color: var(--cream);
border: 1px solid var(--cocoa);
border-radius: 6px;
padding: 5px 8px;
font: inherit;
font-weight: 700;
text-decoration: none;
cursor: pointer;
}
.debug-report-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
.debug-report .muted {
flex-basis: 100%;
}
.debug-note {
flex-basis: 100%;
background: rgba(0, 0, 0, 0.3);
color: var(--cream);
border: 1px solid var(--cocoa);
border-radius: 6px;
padding: 5px 8px;
font: inherit;
}
.debug-tier-label {
color: var(--cream);
font-size: 0.75rem;