feat(catalog): weekly Vercel Cron sync for MTG and Pokémon sets #48

Merged
varutasu merged 1 commit from feat/catalog-sync-vercel-cron-brief-1 into main 2026-05-27 15:59:59 -04:00
varutasu commented 2026-05-27 15:47:43 -04:00 (Migrated from github.com)

Summary

  • Extracts MTG/Pokémon import logic into lib/card-import/ (admin routes unchanged contract)
  • Discovers missing sets via Scryfall /sets + Pokémon TCG /v2/sets, imports up to 3 per run with 1.5s pacing
  • Adds GET /api/cron/sync-catalog authenticated with Authorization: Bearer $CRON_SECRET (503 in prod if unset)
  • Schedules weekly cron in vercel.json (0 6 * * 1 UTC, 300s max duration)
  • Unit tests for set-diff filters (39 vitest total)

Closes the catalog freshness gap that caused Perfect Order Seel disambiguation failures.

Operator setup (required at deploy)

  1. openssl rand -base64 32 → set CRON_SECRET in Vercel project env
  2. Optionally set POKEMON_TCG_API_KEY for Pokémon set discovery rate limits
  3. After merge, manual smoke: curl -H "Authorization: Bearer $CRON_SECRET" https://<prod>/api/cron/sync-catalog

Lorcana: logged as skipped (manual map still required).

Test plan

  • npm run test:run — 39/39
  • CI vitest + smoke
  • Operator: first cron run against prod/staging Neon

Made with Cursor

## Summary - Extracts MTG/Pokémon import logic into `lib/card-import/` (admin routes unchanged contract) - Discovers missing sets via Scryfall `/sets` + Pokémon TCG `/v2/sets`, imports up to **3 per run** with 1.5s pacing - Adds `GET /api/cron/sync-catalog` authenticated with `Authorization: Bearer $CRON_SECRET` (503 in prod if unset) - Schedules weekly cron in `vercel.json` (`0 6 * * 1` UTC, 300s max duration) - Unit tests for set-diff filters (39 vitest total) Closes the catalog freshness gap that caused Perfect Order Seel disambiguation failures. ## Operator setup (required at deploy) 1. `openssl rand -base64 32` → set `CRON_SECRET` in Vercel project env 2. Optionally set `POKEMON_TCG_API_KEY` for Pokémon set discovery rate limits 3. After merge, manual smoke: `curl -H "Authorization: Bearer $CRON_SECRET" https://<prod>/api/cron/sync-catalog` Lorcana: logged as skipped (manual map still required). ## Test plan - [x] `npm run test:run` — 39/39 - [ ] CI vitest + smoke - [ ] Operator: first cron run against prod/staging Neon Made with [Cursor](https://cursor.com)
vercel[bot] commented 2026-05-27 15:47:49 -04:00 (Migrated from github.com)

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tcg-vault Ready Ready Preview, Comment May 27, 2026 7:48pm

Request Review

[vc]: #5iubw9OrbD7de5fsUZoEVyog8Q4xW3jkslaX1krZSq4=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ0Y2ctdmF1bHQiLCJwcm9qZWN0SWQiOiJwcmpfRjZXOEVvRkd3Y0g3aWVGcnRvRlNlOXdVVkFhNSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9yYW5kYWxsLXN0aWxsd2VsbHMtcHJvamVjdHMvdGNnLXZhdWx0LzJTVXBnNDhTWUFOa3NkOE5ncHV2cmhERHVuYm8iLCJwcmV2aWV3VXJsIjoidGNnLXZhdWx0LWdpdC1mZWF0LWNhdGFsb2ctcy05OGIxYTUtcmFuZGFsbC1zdGlsbHdlbGxzLXByb2plY3RzLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoidGNnLXZhdWx0LWdpdC1mZWF0LWNhdGFsb2ctcy05OGIxYTUtcmFuZGFsbC1zdGlsbHdlbGxzLXByb2plY3RzLnZlcmNlbC5hcHAifSwicm9vdERpcmVjdG9yeSI6bnVsbH1dLCJyZXF1ZXN0UmV2aWV3VXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL3ZlcmNlbC1hZ2VudC9yZXF1ZXN0LXJldmlldz9vd25lcj12YXJ1dGFzdSZyZXBvPXRjZy12YXVsdCZwcj00OCJ9 The latest updates on your projects. Learn more about [Vercel for GitHub](https://vercel.link/github-learn-more). | Project | Deployment | Actions | Updated (UTC) | | :--- | :----- | :------ | :------ | | [tcg-vault](https://vercel.com/randall-stillwells-projects/tcg-vault) | ![Ready](https://vercel.com/static/status/ready.svg) [Ready](https://vercel.com/randall-stillwells-projects/tcg-vault/2SUpg48SYANksd8NgpuvrhDDunbo) | [Preview](https://tcg-vault-git-feat-catalog-s-98b1a5-randall-stillwells-projects.vercel.app), [Comment](https://vercel.live/open-feedback/tcg-vault-git-feat-catalog-s-98b1a5-randall-stillwells-projects.vercel.app?via=pr-comment-feedback-link) | May 27, 2026 7:48pm | <a href="https://vercel.com/vercel-agent/request-review?owner=varutasu&repo=tcg-vault&pr=48" rel="noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://agents-vade-review.vercel.sh/request-review-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://agents-vade-review.vercel.sh/request-review-light.svg"><img src="https://agents-vade-review.vercel.sh/request-review-light.svg" alt="Request Review"></picture></a>
github-actions[bot] commented 2026-05-27 15:47:59 -04:00 (Migrated from github.com)

Pipeline Health

Build + CI gates

Gate Status
Vercel build (Preview) pass
CI: Lint pass
CI: Schema map fresh skipped
Preview smoke pass
Visual diff ⏭ skipped or pending

Build runs on Vercel; this CI runs lint and schema-map drift only (no duplicate build).

Role reports

Role Status
Reviewer report pending
A11y audit pending
Design system audit pending

See individual comments above for details. This rollup updates automatically.

<!-- pipeline-rollup --> ## Pipeline Health ### Build + CI gates | Gate | Status | | --- | --- | | Vercel build (Preview) | ✅ pass | | CI: Lint | ✅ pass | | CI: Schema map fresh | ❌ skipped | | Preview smoke | ✅ pass | | Visual diff | ⏭ skipped or pending | _Build runs on Vercel; this CI runs lint and schema-map drift only (no duplicate build)._ ### Role reports | Role | Status | | --- | --- | | Reviewer report | ⏳ pending | | A11y audit | ⏳ pending | | Design system audit | ⏳ pending | See individual comments above for details. This rollup updates automatically.
Sign in to join this conversation.
No description provided.