deckhearth/.convoys/pricing-online-local/brief-3-mtg-bulk-sync-snapshots.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.7 KiB

convoy brief_number depends_on recommended_model model_tier files cross_brief_commitments
pricing-online-local 3
2
composer-2.5 standard
lib/card-import/bulk-sync.js
test/lib/card-import/bulk-sync.test.js
brief description
2 Uses `recordPriceSnapshots` and sets `prices_updated_at = CURRENT_TIMESTAMP` on each upsert batch where price columns change.

Brief 3: MTG bulk sync + snapshots

Goal (1 sentence)

Update Scryfall bulk sync to stamp prices_updated_at and record daily price history snapshots.

Files in scope (do not edit anything else)

  • lib/card-import/bulk-sync.js
  • test/lib/card-import/bulk-sync.test.js

Conventions to follow

  • Keep existing mapCard() mapping: usd → current_price, usd_foil → market_price.
  • Add prices_updated_at to INSERT/UPDATE columns (set when either price is non-null).
  • After each successful upsertBatch, call recordPriceSnapshots for rows with prices (source: 'scryfall', priceType: 'market' for nonfoil amount, optionally second snapshot for foil if present).
  • Export mapCard for unit tests (or test via named export already present).
  • Preserve Scryfall User-Agent header.

Acceptance criteria

  • upsertBatch writes prices_updated_at
  • Price snapshots recorded per card per sync day
  • mapCard unit tests cover price parsing
  • Existing runBulkMtgSync return shape unchanged (add optional snapshotsWritten count)
  • Tests pass
  • No scope expansion

Rationale (≤3 sentences)

MTG already has price data from Scryfall; this brief wires timestamps and history without changing upstream source. Fixes the data pipeline for Phase 1 pricing API reads.