deckhearth/.convoys/pricing-online-local/brief-4-tcgdex-pokemon-pricing.md
Randall Stillwell d0468015eb
Some checks failed
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
Visual diff / Should run? (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Should run? (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
Visual diff / Screenshot diff (pull_request) Has been cancelled
feat(pricing): convoy for online prices and local stores
Add pricing schema, free API integrations (MTG bulk, TCGdex, Foolio),
valuation and sort-by-price, card detail pricing UI, and nearby store
discovery via home zip and OSM geo clients.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:47:46 -05:00

1.8 KiB

convoy brief_number depends_on recommended_model model_tier files
pricing-online-local 4
2
composer-2.5 standard
lib/pricing/tcgdex-client.js
lib/card-import/pokemon-bulk.js
test/lib/pricing/tcgdex-client.test.js
test/lib/card-import/pokemon-bulk.test.js

Brief 4: TCGdex Pokémon pricing ingest

Goal (1 sentence)

Ingest USD TCGPlayer prices from TCGdex during Pokémon bulk sync instead of writing null prices.

Files in scope (do not edit anything else)

  • lib/pricing/tcgdex-client.js
  • lib/card-import/pokemon-bulk.js
  • test/lib/pricing/tcgdex-client.test.js
  • test/lib/card-import/pokemon-bulk.test.js

Conventions to follow

  • Base URL from process.env.TCGDEX_BASE_URL ?? 'https://api.tcgdex.net/v2/en'.
  • Client: fetchSetCards(setId) with 100ms delay between set requests; parse pricing.tcgplayer (USD market/low) and pricing.cardmarket (EUR — store in market_price only when USD missing, document in code comment).
  • Match TCGdex cards to DB rows by set_code + card_number (normalize leading zeros); fallback name match within set.
  • mapPokemonBulkRow / buildUpsertQuery: populate current_price (low or market NM), market_price (market), prices_updated_at.
  • Call recordPriceSnapshots with source: 'tcgdex'.
  • Log unmatchedCount in sync summary JSON.

Acceptance criteria

  • Pokémon bulk no longer writes null prices when TCGdex has data
  • Gentleness: 100ms sleep between set fetches
  • Unit tests with mocked fetch fixtures
  • runBulkPokemonSync summary includes pricesMatched / unmatchedCount
  • Tests pass
  • No scope expansion

Rationale (≤3 sentences)

Pokémon catalog sync currently nulls prices. TCGdex is the convoy's free USD source. Set-batched fetch keeps within polite limits.