fix(cards): resolve glued combined multi-face names in image lookup#5125
Merged
matthewevans merged 1 commit intoJul 5, 2026
Merged
Conversation
The deck-builder image/type lookup (scryfall.ts) does a direct key lookup into card-data, which keys multi-face cards by oracle id, spaced display name, and front-face name — never the glued "Front//Back" form. A card entered as a hand-typed glued combined name therefore missed every key and rendered a text-tile fallback instead of its art (the engine still resolved it via its own "//" split, so it loaded fine — only the thumbnail was lost). Add a front-face fallback to resolveNameLookupKey: when a "//" name isn't a direct/folded key, split on "//" and resolve the front face, which the export always indexes. This mirrors the engine's card_db lookup_key behavior. A single-faced card whose own printed name contains "//" (e.g. "SP//dr, Piloted by Peni") is a primary key and hits the exact-match path first, so it is never mis-split. Tests: glued and spaced combined names both resolve to the card entry, and a single-faced "//"-in-name card resolves to itself. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Member
|
Thanks for the follow-up in your first contribution set. This neatly closes the display-side case by resolving hand-typed glued multi-face names without regressing real |
matthewevans
approved these changes
Jul 5, 2026
matthewevans
left a comment
Member
There was a problem hiding this comment.
Maintainer review: ready. The Scryfall lookup fallback is ordered correctly, covered, and CI is green.
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.
Summary
Makes the deck-builder image/type lookup resolve glued combined multi-face names (
"Front//Back", no spaces) so they render their art instead of a text-tile fallback.fetchCardData(viaresolveNameLookupKeyinscryfall.ts) does a direct key lookup into the local card-data map. That map keys multi-face cards by oracle id, spaced display name ("front // back"), and front-face name — never the glued form. So a card entered as a hand-typed glued combined name missed every key and threw"Card not in local data", falling back to a text tile. (The engine still resolved the card via its own//split, so the deck loaded — only the thumbnail was lost.)Fix
Add a front-face fallback to
resolveNameLookupKey: when a//name isn't a direct or diacritic-folded key, split on//and resolve the front face, which the export always indexes. This mirrors the engine'scard_dblookup_keybehavior, so the display layer and the engine agree.A single-faced card whose own printed name contains
//(e.g. SP//dr, Piloted by Peni) is itself a primary key and hits the exact-match path first, so it is never mis-split.Verification
scryfall(vitest): the three new tests pass —"Peter Parker//The Amazing Spider-Man") resolves to the card entry via the front face;//-in-name card ("SP//dr, Piloted by Peni") resolves to itself, not mis-split.tsc -b --noEmitis clean. (Two unrelated pre-existing tests in this file shell out togen-scryfall-*.shand needjq/bash, absent in my local env — they don't touch this code path.)Relationship to #4790
Independent of, but complementary to, the #4790 deck-parser fix. That PR stops corrupting
//-in-name cards during parsing; this PR hardens the display layer so any glued combined name (from old saved decks, unusual paste sources, or a future import source) shows its art. Neither depends on the other.🤖 Generated with Claude Code