ワンクリックで
investigate
Debug a game state discrepancy reported by the user. Extracts archive, analyzes all pipeline stages, creates a failing regression test with correct expectations, fixes the logic, and verifies the fix.
メニュー
Debug a game state discrepancy reported by the user. Extracts archive, analyzes all pipeline stages, creates a failing regression test with correct expectations, fixes the logic, and verifies the fix.
Investigate a user-reported discrepancy in any supported game's tracker output, create a regression test, and fix the bug.
Supported games and their pipeline files are listed in CLAUDE.md under Project Structure. Data flow between components is documented in docs/pages/data-flow.md.
$ARGUMENTS should contain:
bgaa_816598364.zip) or just a table ID (e.g. 816598364). If a bare table ID is given, the archive is data/bgaa_<TABLE_ID>.zip. If neither is provided, use the most recently created .zip file in data/ (find it with ls -t data/*.zip | head -1).If the discrepancy description is missing, ask the user.
Resolve the archive path from the argument (filename or table ID), or use the most recently created .zip in data/ if not specified. Derive the folder name by stripping .zip (e.g. bgaa_816598364).
mkdir -p data/<FOLDER>
unzip -o data/<ARCHIVE> -d data/<FOLDER>
The archive contains up to 4 files:
raw_data.json — raw BGA packet extraction (input to the game's process_log)game_log.json — structured game log (output of process_log, input to game engine)game_state.json — serialized game state (output of serialization)summary.html — rendered HTML summaryIf only raw_data.json is present, the pipeline failed before producing the other files — the raw data is the starting point for investigation.
Determine which game this data belongs to. Check raw_data.json for clues:
transferedCard → Innovation, factoriesFilled → Azul, newHand/playCard → Crew)Once identified, consult CLAUDE.md Project Structure for the relevant pipeline files (process_log.ts, game_state.ts/game_engine.ts, serialization.ts, render.ts).
Read the relevant files from data/<FOLDER>/ to understand the reported issue. Work backwards from the symptom:
process_log misinterpreted raw BGA packetsIdentify which pipeline stage introduced the error:
src/extract.tsprocess_log.tsgame_state.ts or game_engine.ts)render.tsSee docs/pages/data-flow.md for the full pipeline flow and serialization boundaries.
Document your findings clearly before proceeding.
Based on your analysis:
Create or extend a test in the game's __tests__/ directory that:
data/<FOLDER>/)Test data strategy:
When loading fixture data, use the pattern:
import { readFileSync } from "fs";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
const thisDir = dirname(fileURLToPath(import.meta.url));
const fixture = JSON.parse(readFileSync(resolve(thisDir, "../../data/<FOLDER>/game_log.json"), "utf-8"));
Name the test descriptively based on the bug.
npm test
Confirm that the new test fails with an assertion error that matches the known buggy behavior. If the test passes, the test is not correctly capturing the bug — revisit Step 5.
Modify the source code to fix the bug. Keep changes minimal and focused on the specific bug.
For extraction bugs (src/extract.ts): after fixing, ask the user to reload the extension and re-download the data.
npm test
npm run build
All tests must pass — both the new regression test and all existing tests.
Summarize: