Repository navigation
Parser Debugger
The Parser Debugger helps answer three questions: which parser did fpdb pick, what did it read, and where did the result stop matching expectations? Open a hand-history file from Tools → Parser Debugger…, or use Debug failed import… in Bulk Import. Choose Auto-detect unless you are deliberately checking a specific room, then press Debug parse.
The debugger runs the parser in memory. It does not write hands to the database or change the site configuration. A file can still be inspected when its site is disabled for normal importing.
| Phase | What it does | Where to look |
|---|---|---|
| 1. Open and split the input | fpdb reads the selected hand-history file and separates it into hands. This diagnostic run is in memory; it does not import hands into the database. | Source pane and hand selector |
| 2. Detect the room | fpdb matches the file header to a room converter and identifies the parser class. A recognised header identifies a candidate; it does not guarantee that later parsing will succeed. | Detection |
| 3. Run the actual parse | The selected parser builds the hand: game type, hand/table IDs, players and stacks, streets, blinds, cards, actions, pots and results. | Steps, Hand, Log, JSON |
| 4. Trace source-line coverage | When Trace lines is enabled, the debugger replays the hand with instrumented regexes to associate source lines with matches. This is a coverage aid, separate from the actual parse. | Lines and orange source highlights |
| 5. Check the generic contract | fpdb checks required parser outputs and whole-hand invariants such as valid seats, chip conservation, duplicate cards, betting order and winners. | Contract and Summary |
| 6. Compare with a regression baseline | If matching sidecar files exist beside the input, the parsed result is compared with their saved hand, player and game-type values. | Expected |
| 7. Consolidate a confirmed fix | Preserve a minimal anonymized hand history and its trusted expected sidecars, then keep them together as a regression fixture so later parser changes can be checked. | Fixture files and regression CI |
The phases answer different questions. Contract asks whether the hand is structurally acceptable in general. Expected asks whether its values still match a saved baseline for this exact fixture. A hand can pass the contract and still differ from the known-good stack or pot in its sidecars. Conversely, an Expected mismatch can be caused by an outdated or incorrect baseline, so inspect the values before changing a parser or blessing a new baseline.
flowchart LR
A[Hand-history file] --> B[Detect room and parser]
B --> C[Parse hand in memory]
C --> D[Extracted hand]
C --> E[Steps and captured logs]
A -. optional coverage replay .-> F[Lines and regex matches]
D --> G[Generic contract checks]
D --> H{Sidecars beside file?}
H -- yes --> I[Compare with saved baseline]
H -- no --> J[No exact baseline]
E --> K[Debugger report]
F --> K
G --> K
I --> K
J --> K
K --> L[Confirm bug and fix parser]
L --> M[Anonymized fixture plus trusted sidecars]
M --> N[Regression suite and CI]
The table's Converter and Site columns identify the room converter and configured site name. Above the table, Parser used shows the fully qualified Python class that was actually instantiated, for example fpdb_3_legacy.SomeRoomToFpdb.SomeRoom. That class is the clearest answer to “which parser ran?”
Recognised = yes means that converter's header pattern matched; it does not by itself mean the hand parsed successfully. Check Steps for that. A site marked disabled is excluded from normal configured imports, but a file opened manually can still be inspected. Summary files do not create a hand parser, so there may be no parser class to show.
These examples use a synthetic BetRivers hand history. Follow the same hand across tabs when comparing results.

BetRivers is recognised from the first line, while the site is disabled for normal imports. Opening the file manually still lets the debugger inspect it. In newer builds, the Parser used label above this table names the actual Python parser class.

OK — 2 ok means both hands parsed without a fatal exception. The diagnostics still point out a disabled site and lines that the trace did not match. Check each item before treating the hands as complete.

Green read rows show lines associated with a traced regex. Orange unread rows show lines for which the trace recorded no regex match. This can reveal a trace-coverage gap: for example, the next screenshot shows a small-blind action in the extracted hand even though its source line is orange. Orange therefore does not by itself prove the parser dropped that action.

Expand the relevant sections in Hand to see whether a player, action, card, or pot value made it into the parsed result. Compare this data with the raw hand and the Contract tab. If the field is present here but its input line is orange, the parser extracted it and the line trace did not account for it.

Start at the first raised row. Later not reached rows are usually consequences of that earlier failure, not separate parser bugs. For example, if determineGameType raises an unsupported-game error, player, blind and action readers cannot run. If every step returns but Contract reports missing actions, the problem is completeness rather than a thrown exception.

The converter recognises the Entraction header, then refuses the Sökö game during determineGameType. The parser name answers which implementation ran; the first raised step explains where it stopped. Later steps are marked not reached because the earlier exception ended the hand.

Here the header is the only line read before the failure. The remaining lines are not reached; they were not tested by later parser steps. This differs from an unread line in a successful parse, where the converter finished but the trace found no regex match for that line.

This hand says it is 3-max but contains a player in seat 5. The warning reports the field (players.seat), expected range and parsed value. Use Hand to inspect the table size and player list, then Lines to locate the source seat line. A green overall parse verdict does not cancel this warning.

An ok step only means that the method returned. Check What it did for the changes it made and Regexes for match counts. If the game type and stacks parse but the action count is zero, inspect Lines, Contract and Log for the omitted actions.

The Log tab shows captured Python log records and debugger diagnostics for the selected hand. It can contain contract warnings, check failures, repairs and unread-line notes even when the converter emitted no Python warning. Select a hand in the top-right hand picker before concluding that its log is empty.
| Tab | Meaning |
|---|---|
| Summary | Overall verdict, detection details and diagnostics. OK means no fatal parse exception; completeness warnings may still be present. |
| Detection | Candidate converters and the parser class selected for the file. |
| Steps | What each parser method did. ok means it returned; raised means it threw an error; not reached means an earlier failure stopped the parse; not called means that method did not run for this hand. |
| Contract | Expected versus found values for each parser step, then checks across the whole hand. pass is green, warning is orange, and fail is red. |
| Hand | The extracted fields, including the pot. Rake is under pot → rake; uncalled bet refunds are under pot → uncalled_returns. Rake may be read from the history or derived during pot calculation. Tournament hands have per-hand rake set to zero; the tournament fee is a separate value. |
| Lines | How each input line was classified. read means a traced regex matched it; marker is a section heading; blank is empty; unread means the trace recorded no regex match; not reached means parsing stopped before it. The latest view also exposes each match's regex name, character span and matched text. Span offsets are relative to the selected hand. This is trace coverage, not definitive proof that a line's data was omitted. |
| Expected | Comparison with .hands, .hp and .gt regression sidecars, plus the live parser snapshot when the input is in its manifest. The snapshot row includes the selected hand fingerprint and a whole-file digest/count comparison. “No sidecar” means there is no saved reference for this file, not that parsing failed. Sidecar comparison currently targets the first hand in a file. |
| Log | Captured Python log records and debugger diagnostics from the current debugger run for the selected hand, including contract/check warnings, repairs and unread-line notes. It does not import an earlier Bulk Import log; run the failed hand through the debugger to capture warnings again. Select another hand in the hand picker to inspect its records. The tab explicitly says when the parse produced no logs or diagnostics. |
| JSON | The complete structured report, including detection, parser class and extracted hand data. |
| Changes | Differences between two saved debugger reports for the same input. It is not a comparison with the expected sidecar. |
The legend applies across the result tables: green is successful or read, orange is a warning, missing value, not reached step, or line without a recorded trace match, and red is an error. Color communicates status; it does not certify that a successfully parsed numeric value is correct.
A fixture is a small, reproducible input kept with the regression tests. For a hand-history parse, the raw text file is the input; optional sidecars beside it are the saved expected output. Their names append the suffix to the complete input filename:
example.txt # anonymized hand history given to the parser
example.txt.hands # expected hand-level fields
example.txt.hp # expected per-player fields (HandsPlayers)
example.txt.gt # expected game type row
| Sidecar | What it checks | Typical use |
|---|---|---|
.hands |
Hand-level values produced for the parsed hand, such as hand ID, pot totals, board, rake and other Hands fields. |
Catch a change to the hand result or pot calculation. |
.hp |
Expected values grouped by player, corresponding to HandsPlayers fields such as seat, starting stack, cards and derived player statistics. Only fields recorded in this baseline are compared. |
Catch a change to a player's parsed or derived data. |
.gt |
The expected game-type row: room/game family, limit, category, currency and stakes fields. | Catch incorrect room/game classification or stakes. |
These are comparison baselines, not parser instructions and not a second input format. The debugger reads them only when they exist; it does not create or update them. The Save anonymized fixture… button saves the selected raw hand history as a .txt file only. A maintainer must separately establish and review the expected .hands, .hp and/or .gt values before adding them as a regression baseline.
The baseline must describe a known-correct result, not merely the current output. Usually it is carried forward from a trusted existing regression case or reviewed against an independently verified import. A fixture without sidecars is still useful: it reproduces a parser failure, but it cannot say whether every extracted value exactly matches a known answer.
The sidecar comparison is intentionally for the first hand in the file. Keep a regression fixture to one hand when possible; otherwise, later hands in a multi-hand file are parsed and checked by the generic contract, but they are not compared with those sidecars in this debugger. Files listed in tests/fixtures/hands/live_parser_snapshots.json also show a semantic fingerprint for each parsed hand and compare the full parsed file's count and SHA-256 digest with that manifest. A mismatch is reported as a diagnostic; the debugger does not silently rewrite the manifest.
- Reproduce: save or identify the smallest hand history that still shows the issue. Keep the original input unchanged while diagnosing it.
- Anonymize: use Save anonymized fixture…, review the editable name list, and inspect the saved text for IDs or names the automatic list missed. The save flow suggests a repository fixture path, replaces Hero and the other listed names, and stops if a listed real name remains. Review the full file before committing because account IDs and unlisted names may live outside the converter's player list.
- Diagnose: use Detection → Steps → Contract → Hand → Lines to locate whether the issue is detection, a stopped parse, a missing field, a wrong value, or only incomplete line tracing.
-
Fix and reparse: confirm the extracted
Handis correct and the relevant contract checks pass. If the file has an existing expected baseline, investigate everyExpecteddifference. -
Consolidate the regression: add the anonymized
.txtand only the sidecars whose expected values have been independently verified. If the file belongs in the live snapshot corpus, update its entry only after the fix and hand output are reviewed. Do not generate a new baseline from an unreviewed buggy parse; that would preserve the bug as the new expected result. - Run the regression suite/CI: verify the fixture stays green alongside the existing parser cases. This catches a fix that breaks another room or format.
No sidecar means “there is no exact saved baseline to compare”, not “the parse failed.” Use Contract for general validity and add sidecars when you need exact regression protection for a confirmed case.
The generic contract follows the same order as the converter pipeline:
-
determineGameTypeidentifies cash game or tournament, game family, limit, category, currency and stakes. An unsupported format can be detected as a room file and still fail here. -
readHandInfosupplies the hand ID, time and table, plus tournament ID when applicable. -
readPlayerStacksadds players with their seat, name and starting stack. -
markStreetsdivides the history into the game’s streets, such as preflop, flop, turn and river. - Blind, ante, bring-in, button and hole-card steps record forced bets, dealer position and private cards.
-
readActionrecords player actions in order and on the correct street. - Collection and show/muck steps record who won money and what cards were shown.
The Contract tab shows the requirement next to what the converter produced. For example, “seat 5 is above the table size (expected ≤ 3, found 5)” points to a mismatch between the parsed seats and a 3-max table. A warning signals something suspicious that may still occur in a legitimate hand; an error means a required value or supported value is missing or invalid.
- Open the failing file, or select it from Debug failed import… after Bulk Import.
- In Detection, confirm the site, the recognised header and Parser used. If no parser was selected, inspect the closest candidates and the detection message.
- In Steps, find the first
raisedornot reachedrow. That is usually where to start. - In Contract, compare Expected and Found. Use Lines to jump back to the corresponding source text.
- Check Hand for the actual fields. For pot questions, expand
pot; rake and uncalled refunds are separate values. - If the file has reference sidecars, use Expected to see exact differences. Otherwise, a successful contract check only confirms the general structure.
- Use Copy bug report to prepare an anonymized report, or Save anonymized fixture… to preserve one selected hand. Review the proposed name list and add names the parser missed before saving. A saved fixture may require new, reviewed
.hands,.hpor.gtsidecars; update the live snapshot manifest only when its output should become a maintained regression baseline.
Save report… writes the raw JSON report, which may contain real player names. Review it before sharing. Hand histories, logs and screenshots can also contain player or account identifiers; see Screenshots and privacy.
- HUD overview
- HUD — installation and first run
- HUD — configuration from the GUI
- HUD — Fast-Fold tables
- HUD — importing a PokerTracker 4 layout
- HUD — troubleshooting
- HUD_config.xml reference
- Research and study
- Packs and moving from another tracker
- Hand Replayer
- Auto Notes
- Reports and graphs
- Statistics reference