Reconcile pending scan submissions after catalog sync #51

Merged
varutasu merged 1 commit from feat/reconcile-submissions-after-catalog-sync into main 2026-05-28 10:47:59 -04:00
varutasu commented 2026-05-28 10:46:20 -04:00 (Migrated from github.com)

Summary

  • Add lib/card-import/reconcile-submissions.js to match pending card_submissions against catalog rows after each set import (set code/name + card name + collector number, with 015/20815/208 normalization).
  • Auto-approve unambiguous matches by setting status = 'approved' and promoted_card_id to the existing catalog row (no duplicate cards INSERT).
  • Hook reconciliation into runCatalogSync after every successfully imported set; surface counts in the admin catalog sync panel.

Behavior

  • Only pending submissions whose ocr_payload references the imported set are considered.
  • Ambiguous cases (multiple printings, missing collector number) stay in the queue for manual review.
  • reviewed_by remains null on auto-reconciled rows (manual admin approvals still set it).

Test plan

  • npm run test:run — 45/45 green (5 new reconciliation unit tests)
  • After deploy: create or use an existing pending submission for a not-yet-imported set, run catalog sync for that set, confirm submission disappears from /admin/card-submissions and promoted_card_id is set

Made with Cursor

## Summary - Add `lib/card-import/reconcile-submissions.js` to match pending `card_submissions` against catalog rows after each set import (set code/name + card name + collector number, with `015/208` ↔ `15/208` normalization). - Auto-approve unambiguous matches by setting `status = 'approved'` and `promoted_card_id` to the existing catalog row (no duplicate `cards` INSERT). - Hook reconciliation into `runCatalogSync` after every successfully imported set; surface counts in the admin catalog sync panel. ## Behavior - Only `pending` submissions whose `ocr_payload` references the imported set are considered. - Ambiguous cases (multiple printings, missing collector number) stay in the queue for manual review. - `reviewed_by` remains null on auto-reconciled rows (manual admin approvals still set it). ## Test plan - [x] `npm run test:run` — 45/45 green (5 new reconciliation unit tests) - [ ] After deploy: create or use an existing pending submission for a not-yet-imported set, run catalog sync for that set, confirm submission disappears from `/admin/card-submissions` and `promoted_card_id` is set Made with [Cursor](https://cursor.com)
vercel[bot] commented 2026-05-28 10:46:23 -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 28, 2026 2:46pm

Request Review

[vc]: #vsbKtzAFsCAfcvnKX/6thlDlluBjlXDvNHheERuqjFM=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ0Y2ctdmF1bHQiLCJwcm9qZWN0SWQiOiJwcmpfRjZXOEVvRkd3Y0g3aWVGcnRvRlNlOXdVVkFhNSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9yYW5kYWxsLXN0aWxsd2VsbHMtcHJvamVjdHMvdGNnLXZhdWx0L0hTY0hKNFpoa2ZjRHFyWk1LdWJ2NzZmNmM3RXQiLCJwcmV2aWV3VXJsIjoidGNnLXZhdWx0LWdpdC1mZWF0LXJlY29uY2lsZS1iY2E5MTQtcmFuZGFsbC1zdGlsbHdlbGxzLXByb2plY3RzLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoidGNnLXZhdWx0LWdpdC1mZWF0LXJlY29uY2lsZS1iY2E5MTQtcmFuZGFsbC1zdGlsbHdlbGxzLXByb2plY3RzLnZlcmNlbC5hcHAifSwicm9vdERpcmVjdG9yeSI6bnVsbH1dLCJyZXF1ZXN0UmV2aWV3VXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL3ZlcmNlbC1hZ2VudC9yZXF1ZXN0LXJldmlldz9vd25lcj12YXJ1dGFzdSZyZXBvPXRjZy12YXVsdCZwcj01MSJ9 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/HScHJ4ZhkfcDqrZMKubv76f6c7Et) | [Preview](https://tcg-vault-git-feat-reconcile-bca914-randall-stillwells-projects.vercel.app), [Comment](https://vercel.live/open-feedback/tcg-vault-git-feat-reconcile-bca914-randall-stillwells-projects.vercel.app?via=pr-comment-feedback-link) | May 28, 2026 2:46pm | <a href="https://vercel.com/vercel-agent/request-review?owner=varutasu&repo=tcg-vault&pr=51" 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-28 10:46:35 -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 pass

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 | ✅ pass | _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.
github-actions[bot] commented 2026-05-28 10:47:48 -04:00 (Migrated from github.com)

Visual Diff

Screenshots and diffs uploaded as artifacts: view run

If intentional changes: update snapshots locally with npx playwright test --project=visual --update-snapshots and commit.

## Visual Diff Screenshots and diffs uploaded as artifacts: [view run](https://github.com/varutasu/tcg-vault/actions/runs/26582065897) If intentional changes: update snapshots locally with `npx playwright test --project=visual --update-snapshots` and commit.
Sign in to join this conversation.
No description provided.