✨ feat(card): add CardIdentity.ruleboxType + Ace Spec detection#533
Merged
Conversation
Foundation for issue #532 (Staple Cards). Adds a nullable ruleboxType column to CardIdentity capturing the card's rulebox mechanic — Ace Spec, V/VMAX/VSTAR, ex/EX, GX, BREAK, Mega/Mega-classic, Radiant, Prism Star. Modeling rationale: rulebox is intrinsic to the card identity (one-per-deck rule, banned-card cross-cutting concerns), not specific to staple-cards curation, so it lives on CardIdentity rather than on a feature-local table. PR-1 detects Ace Spec only, from tcgdex_card.rarity = 'ACE SPEC Rare'. Detection of the other 12 rulebox types is deferred to follow-up PRs; a markTestSkipped data-provider test enumerates 27 future cases as the green target for those PRs. Migration backfills the 4 currently-known Ace Spec identities (Brilliant Blender, Megaton Blower, Secret Box, Unfair Stamp) by joining card_identity to card_printing rows whose rarity matches. Refs #532
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced May 7, 2026
Merged
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
Foundation for issue #532 (Staple Cards). Lands the
CardIdentity.ruleboxTypeschema change cleanly so PR-2 can build on top.CardIdentity.ruleboxType(nullable VARCHAR(30)) captures the card's rulebox mechanic — Ace Spec, V/VMAX/VSTAR, ex/EX, GX, BREAK, Mega/Mega-classic, Radiant, Prism Star. Modeling rationale: rulebox is intrinsic to the card (one-per-deck rule for Ace Spec, etc.), not to the staple-cards curation, so it belongs on the canonical card-identity row rather than a feature-local table. Other future features (deck validation, archetype enrichment) can read it for free.App\Constants\RuleboxTypeenumerates 13 known rulebox types as named constants. The class docblock maps each to its detection signal (rarity check vs name suffix vs name prefix) with edge-case notes — modern Mega coexists with theexsuffix and must be checked first; classic Mega's strongest signal isstage = 'MEGA'(currently absent from theTcgdexCardstruct, flagged for a future struct extension).POKEMON_MEGAfor the S&V-era "Mega Charizard X ex" pattern,POKEMON_MEGA_CLASSICfor the XY-era "M Charizard EX" pattern. Same era split asPOKEMON_EXvsPOKEMON_EX_CLASSIC— the two mechanics aren't interchangeable.CardIdentityResolverdetects Ace Spec only in this PR via the new public-staticdetectRuleboxType()helper (mirrors the visibility ofcomputeAbilitySignature/computeAttackSignature). Detection runs duringfindOrCreateIdentity()for new identities, and backfillsruleboxTypeon existing ones with null values — same pattern as the existingtrainerTypebackfill.Version20260507204712adds the column and backfills the 4 currently-known Ace Spec identities (Brilliant Blender, Megaton Blower, Secret Box, Unfair Stamp) by joiningcard_identitytocard_printing.rarity = 'ACE SPEC Rare'. The auto-generated drift from unrelated tables (banned_card index renames, sessions BLOB type, etc.) was stripped — this migration only touchescard_identity.markTestSkipped27-row data-provider test enumerating the future detection cases for V/VMAX/VSTAR/ex/EX-classic/Mega/Mega-classic/G/GX/BREAK/Radiant/Prism plus collision and false-positive guards. The future-cases suite is the green target for the next PR that extends detection.Detection of the other 12 rulebox types is deferred to follow-up PRs. Most are name-pattern based; the constants file documents the canonical signals so the next implementer doesn't have to re-derive them.
Refs #532
Test plan
SELECT name, rulebox_type FROM card_identity WHERE rulebox_type IS NOT NULLreturns exactly Brilliant Blender / Megaton Blower / Secret Box / Unfair Stamp, allace_spec.ruleboxTypestays null on the resolved identities.ruleboxType = 'ace_spec'via the backfill path (not just new-create).make phpstanis green at level 10.make test.unitis green; the future-cases data-provider test reports as 27 skipped (one per row).