Skip to content

fix(reggie,filters): keep medals without a brew name, match multi-club fields, repair double-encoded text - #19

Merged
tmack8001 merged 3 commits into
mainfrom
fix/reggie-blank-names-club-filter-quotes
Nov 9, 2026
Merged

tmack8001 merged 3 commits into
mainfrom
fix/reggie-blank-names-club-filter-quotes

Conversation

@tmack8001

Copy link
Copy Markdown
Owner

Pull Request

Description

Three bugs found while archiving the 2024 circuit (Hot N Humid and Ozarks Open Season on Reggie, Copper State Cup on BAP):

  1. Reggie drops medals published without a brew name. The parser required the brew name and club of each aaReggieMedals record to be non-empty, so medals such as Ken Johnson's 2nd in Czech Lager (Hot N Humid) or Kurt LaPak's 3rd in American Pale Ale (Ozarks) never reached the output. They are now emitted with an empty Entry Name. Only medal types 0 (medal) and 1 (Best of Show) count; the "Heavy Medal - Brewer / Club" summary rows (types 2 and 3) are not medals and stay skipped, in the JS data and in the rendered-HTML fallback.
  2. --club needed the whole club field to match exactly. BAP publishes multi-club fields such as The Brü Club / Little Mountain Brewers, so Steve Micco's Copper State Cup medal was missed when filtering on The Brü Club. The filter now equals the whole field or one complete club in it (split on /, ; and ,). It is not a substring match: ASH does not match CASH CIDER, and AC/DC stays whole. The same logic applies to --brewers.
  3. Garbled quotes in Reggie names. reggiebeer.com serves the text double-encoded although its header says UTF-8 (Randall “Scott” Gordon arrives as “Scottâ€<U+009D> Gordon). A new decoder (src/parsers/mojibake.ts) re-reads each character as its Windows-1252 byte and decodes lead and continuation bytes as UTF-8 only when the sequence is valid, so correct text (Brü, Kölsch, ’) is untouched. It is applied to brewer, category, style, brew name and club on Reggie only; BAP and BCOEM captures contain no such text.

Fixes # (none)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Changes Made

  • src/parsers/reggie-parser.ts: accept empty brew name, club and ShowLabel; only medal types 0 and 1; skip rows under Heavy Medal* group headers in the HTML path; repair double-encoded characters.
  • src/filters.ts: fieldKeys() splits an entry's club and brewer fields; shouldIncludeEntry compares the filter to the whole field or one complete name.
  • src/parsers/mojibake.ts: the decoder.
  • Trimmed fixtures from real captures (names, styles, brewer and club only): reggie_trimmed_2024_hot_n_humid.html, reggie_trimmed_2024_ozark_open_season.html, bap_trimmed_results_2024_ash_copper_state_cup.json.
  • CHANGELOG, README (--club), docs/BCOEM_IMPLEMENTATION.md, docs/PLATFORM_SUPPORT.md.
  • Known side effect of the comma split: a club or brewer name that itself contains a comma (Brewers, Inc.) can match a filter equal to just one part. Documented in the README and CHANGELOG.

Platform(s) Affected

  • Reggie
  • BAP
  • Core functionality

Testing

  • Existing tests pass (npm test)
  • Added new tests for new functionality
  • Manually tested with real competition URLs (replayed real captures)
  • Tested both JSON and CSV output

On Node 22.23.4: yarn test passes on each commit (617, 636, 703 tests; 612 on main) with 0 lint errors. On the real captures: Hot N Humid 113 medals (13 without a brew name), Ozarks 53 (3 without), both existing full-page Reggie fixtures 103; the club filter finds Steve Micco at Copper State Cup and does not match ASH against CASH CIDER; only the three "Scott" Gordon rows change from the decoder. Independent reviews: an adversarial correctness review (found that the first version also emitted the Heavy Medal summary rows; fixed) and a mutation review (79 mutants on the changed lines; the 16 real test gaps are closed, the 11 survivors are equivalent).

Test Commands

brewcompetition medals "https://reggiebeer.com/ReggieWeb.php?Web=1000864" --club "The Brü Club" --output csv
brewcompetition medals "https://beerawardsplatform.com/2024-ash-copper-state-cup" --club "The Brü Club" --output csv

Test URLs

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Documentation

  • Updated README.md (if needed)
  • Updated relevant docs in docs/ folder
  • Updated CHANGELOG.md
  • Added JSDoc comments to new functions/classes

Additional Notes

Not covered: the rendered-HTML Heavy Medal guard is tested with a synthetic table only (no real rendered Heavy Medal table was available); a genuine é in a real name would be repaired to é (indistinguishable from the double encoding).

🤖 Generated with Claude Code

https://claude.ai/code/session_019WNgkFdWRPDsrg7QyXsqtu

Change log

Newest first.

  • 2026-11-07 a52c9c2, 0f43eab, 899cd62: review fixes folded in: only medal types 0 and 1 (Heavy Medal summary rows are skipped, JS and HTML paths), explicit Windows-1252 table and lead-byte range tests, filter separator tests, style repair in both paths, comma side effect documented. 703 tests.
  • 2026-11-07 first push: blank brew names, multi-club filter, double-encoded text repair.

Generated by Claude Code

The raw-page parser required every string field of a medal record to be
non-empty, so a medal whose entry has no brew name (or whose brewer has no
club) was silently dropped. Hot N Humid 2024 lost 13 of its 113 medals this
way, including Ken Johnson's 2nd in Czech Lager; Ozarks Open Season 2024
lost 3 of 53, including two Bru Club 3rds. The brew name and club may now
be empty, so the row is emitted with an empty Brew Name column.

Accepting empty fields would also let the "Heavy Medal" points summaries
(MedalType 2 and 3, which have no brew name or club) through, so only
MedalType 0 (medal) and 1 (Best of Show) records are read, and the rendered
HTML path skips Heavy Medal tables.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019WNgkFdWRPDsrg7QyXsqtu
BAP publishes a brewer in several clubs as one string, e.g. "The Brü Club /
Little Mountain Brewers" (Steve Micco, 2nd in Porters & Stouts, 2024 Copper
State Cup), so an exact whole-field comparison missed the medal. The club
(and brewer) field is now also split on " / ", ";" and "," and the filter
must equal the whole field or one complete name in it. Still case- and
diacritic-insensitive and never a substring match, so "ASH" does not match
"CASH CIDER".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019WNgkFdWRPDsrg7QyXsqtu
Reggie's pages publish some text double-encoded: a brewer entered as
Randall "Scott" Gordon (curly quotes) is served as the UTF-8 bytes of its
Windows-1252 misreading, "“Scottâ€<U+009D> Gordon". The CLI passed that
through, so the CSV/JSON showed garbage in place of the quotes. The server
sends charset=UTF-8 and the BAP output keeps the same quotes intact, so
neither the fetch nor the CSV sanitizer is at fault.

Names and beer names from Reggie are now repaired: each character is read
as the Windows-1252 byte it stands for, and a lead byte with its
continuation bytes is decoded as UTF-8 only when that is valid. Text that is
already correct (Brü, Kölsch, ’) is left alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019WNgkFdWRPDsrg7QyXsqtu

Copy link
Copy Markdown
Owner Author

Review by Claude Opus (claude-opus-5-5)

Verdict: No findings.

Not checked: I could not run the test suite (the checkout has no node_modules, and installing them would change it), and I did not compare against live reggiebeer.com or BAP pages. I checked the parser, filter and decoder changes by reading the code, the new tests and the trimmed fixtures.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Review by Claude Sonnet (claude-sonnet-5-5)

Verdict: No findings.

Nits and pre-existing (1)
  • 🟡 Nit src/parsers/filters.ts:52: splitting on , also affects --brewers. A brewer published as "Smith, John" now matches a filter of John or Smith. The CHANGELOG and README mention this only for club names.

Not checked: I could not run the test suite (mocha is not installed in the checkout). I did not compare the new Reggie fixtures with live pages. The medal-type split (0 and 1 are medals, 2 and 3 are Heavy Medal summaries) was checked only against the fixtures already in the repo.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Review by Claude Fable 5.1 (claude-fable-5-1)

Verdict: 0 Important, 1 Nit

Nits and pre-existing (1)
  • 🟡 Nit src/parsers/mojibake.ts:59: any lead-range capital (U+00C2-U+00DF) directly followed by a U+0080-U+00BF or CP1252-high character is "repaired", so a genuinely encoded all-caps brew name such as JOSÉ’S becomes JOSɒS (verified by running the function). Live Reggie pages do mix genuine text (Kölsch, Märzen, Piña, Brü) with double-encoded text. Smallest fix: only accept a decode whose result Windows-1252 can itself represent (cp1252Byte(decoded) !== undefined), and drop the emoji case.

Verified against live sources (no 2024 raw captures exist on the circuit repo's main): reggiebeer.com/ReggieWeb.php?Web=1000864 and Web=1000874 contain the blank-brew-name rows for Ken Johnson, Kurt LaPak and Alex Zwerdling exactly as in the trimmed fixtures; the brewer name bytes are C3 A2 E2 80 AC C5 93 ... C2 9D, matching the fixture's “ / \u009D; every MedalType 0/1 row has ShowLabel 1 and every 2/3 row has 0; Reggie's own inline script identifies Heavy Medal groups by the Heavy Medal name prefix (types 2/3), matching both parser paths. The BAP getResults API for 2024-ash-copper-state-cup returns Steve Micco's Porters & Stouts 2nd with club The Brü Club / Little Mountain Brewers, the only multi-club field in that competition. On the existing full Reggie fixtures the old regex yields 99 rows and the new one 103, matching the new test. Output columns are unchanged; csvToJson keeps an empty Brew Name cell.

Not checked: the test suite and lint could not be run (no node_modules in the checkout, and installing would change it); the parser's HTML-table path was checked by reading the rendered fixture markup, not by executing cheerio.


Generated by Claude Code

@tmack8001
tmack8001 merged commit 94aebf9 into main Nov 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants