fix(client): accept lowercase set codes in MTGA deck lines#5191
Merged
matthewevans merged 1 commit intoJul 9, 2026
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
The MTGA printing-line matcher and MTGA_LINE_PATTERN captured the set code with [A-Z0-9]* (uppercase only). A decklist line with a lowercase Scryfall-style set code (e.g. '1 Lightning Bolt (2xm) 123' — several exporters emit these) failed the MTGA match, fell through to the simple count+name matcher, and the set code + collector number were swallowed into the card name, producing an unresolvable name and no sourcePrinting. Widen the class to [A-Za-z0-9]*; setCode.toLowerCase() already normalizes case, and card names never contain parenthesized runs so this can't misclassify a real line.
96dda40 to
c3b5a23
Compare
matthewevans
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
parseDeckEntryLinematches MTGA-style printing lines (<count> <name> (<set>) <collector#>) with:The set-code group is
[A-Z0-9]*— uppercase only.MTGA_LINE_PATTERN(used for format detection) has the same restriction. A decklist line whose set code is lowercase (Scryfall-style — e.g.2xm,mh2,m21,fdn, which several exporters emit) fails the MTGA match, falls through to the simple(\d+)x?\s+(.+)matcher, and the set code + collector number get swallowed into the card name:Fix
Widen the set-code class to
[A-Za-z0-9]*in both the parse regex andMTGA_LINE_PATTERN.setCode.toLowerCase()already normalizes case downstream, so a lowercase code yields exactly the samesourcePrintingan uppercase one would. Card names never contain a parenthesized(...) <token>run, so widening the class can't misclassify a real name line.Tests
Adds two cases to the existing
deckParsersuite: a lowercase set code ((2xm) 123) now parses to{ name: "Lightning Bolt", sourcePrinting: { setCode: "2xm", collectorNumber: "123" } }(fails before — the name is garbled and there's no printing), and lowercase vs uppercase set codes produce identical results. The full existing 73-test suite still passes.Self-contained: only
deckParser.ts+ its test; no engine/Rust/protocol changes.Model: claude-opus-4-8