deckhearth/.convoys/pricing-online-local/brief-10-geo-clients-cache.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.6 KiB
Raw Permalink Blame History

convoy brief_number depends_on recommended_model model_tier files
pricing-online-local 10
1
composer-2.5 standard
lib/pricing/nominatim.js
lib/pricing/overpass.js
lib/pricing/geo-cache.js
test/lib/pricing/nominatim.test.js
test/lib/pricing/overpass.test.js
test/lib/pricing/geo-cache.test.js

Brief 10: Geo clients + DB cache

Goal (1 sentence)

Implement Nominatim geocoding, Overpass store queries, and DB-backed caches per convoy gentleness rules.

Files in scope (do not edit anything else)

  • lib/pricing/nominatim.js
  • lib/pricing/overpass.js
  • lib/pricing/geo-cache.js
  • test/lib/pricing/nominatim.test.js
  • test/lib/pricing/overpass.test.js
  • test/lib/pricing/geo-cache.test.js

Conventions to follow

  • Security: Overpass QL uses fixed template only; inject parsed floats for lat/lng/radiusMeters — never user strings.
  • nominatim.js: User-Agent from NOMINATIM_USER_AGENT; min 1s between requests.
  • overpass.js: query shop=games and shop=hobby; radius capped 1–50 miles server-side.
  • geo-cache.js: zip coords cached forever; stores cache 7-day TTL.
  • Allowlist outbound hosts at module init.

Acceptance criteria

  • Zip cache hit skips Nominatim
  • Stores cache respects 7-day TTL
  • Overpass parser returns distance-ready lat/lng per store
  • Unit tests cover parser + TTL logic
  • Tests pass
  • No scope expansion

Rationale (≤3 sentences)

Isolates external geo APIs from the route handler for testability. DB cache avoids Redis dependency for long-lived zip coords. Satisfies convoy rate-limit requirements before Brief 11 wires the API.