Repository navigation
Fix false-positive card matches in decklist import - #109
Conversation
Fuzzy fallback scored candidates by name-length delta only, so any card sharing a 4-char prefix and similar length was accepted. Use edit distance, a 0.85 threshold, and reject ties. Co-Authored-By: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Factory test report✅ All checks passed on 1275ca9
|
Verdict: approveReviewed head: 1275ca9
Fuzzy matching now uses edit distance, a 0.85 threshold and tie rejection, so look-alike cards are no longer substituted; tests cover it. No findings. Review notes
Factory session · Review runtime: litellms/anthropic/claude-sonnet-5-5, reasoning setting: medium. |
Summary
When a card name in an imported decklist has no exact match, the importer falls back to a fuzzy match. That fallback scored candidates by name length only, so an unrelated card with the same first four characters and a similar length could be silently substituted (for example "Lightning Bolt" becoming "Lightning Helix").
The fuzzy matcher now:
Names that can't be matched confidently show up in the existing unmatched list.
Verification
pnpm vitest run lib/deck app/_actions/deckpassed (1107 tests).pnpm tsc --noEmitandpnpm lintpassed.card-resolver.ts, the new false-positive and tie tests fail.Fixes #93
Factory session