feat: reintroduce OPDB model selection for machines#1055
feat: reintroduce OPDB model selection for machines#1055timothyfroehlich wants to merge 6 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to Preview Branch (feature/opdb-model-integration) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
There was a problem hiding this comment.
Pull request overview
This PR reintroduces OPDB (Open Pinball Database) integration to enable searching and importing machine model metadata during machine creation and editing. The implementation adds a typed client layer with validation, mappers, and in-memory caching, persists OPDB metadata fields in the database, and locks machine names to selected OPDB models for data consistency.
Changes:
- Added OPDB client infrastructure with types, mappers, and API client (
src/lib/opdb/*) - Extended machines schema with 7 new OPDB metadata columns (id, title, manufacturer, year, image URL, machine type, last synced timestamp) plus index
- Created authenticated
/api/opdb/searchroute and reusableOpdbModelSelectUI component - Updated machine create/edit server actions to fetch OPDB details, lock names to OPDB titles, and support legacy machines with null OPDB data
- Added comprehensive unit tests and E2E coverage including edit-flow model changes
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/opdb/types.ts |
Zod schemas and TypeScript types for OPDB API validation and type safety |
src/lib/opdb/mappers.ts |
Data transformation functions to normalize OPDB API responses into app domain models |
src/lib/opdb/client.ts |
HTTP client with in-memory caching, timeout handling, and graceful credential fallback |
src/components/machines/OpdbModelSelect.tsx |
Client component with debounced search, result selection, and clear functionality |
src/app/api/opdb/search/route.ts |
Authenticated API route proxying OPDB search requests |
src/app/(app)/m/schemas.ts |
Added optional opdbId field to create/update machine schemas |
src/app/(app)/m/actions.ts |
Server actions fetch OPDB details, map to DB fields, lock names, support legacy machines |
src/app/(app)/m/new/create-machine-form.tsx |
Integrated OpdbModelSelect with name auto-population and read-only behavior when model selected |
src/app/(app)/m/[initials]/update-machine-form.tsx |
Added OpdbModelSelect to edit dialog with allowClear=false to prevent accidental unlinking |
src/server/db/schema.ts |
Added 7 OPDB metadata columns to machines table with index on opdb_id |
drizzle/0021_petite_maverick.sql |
Migration adding OPDB columns and index |
drizzle/meta/_journal.json |
Migration journal entry for 0021 |
drizzle/meta/0021_snapshot.json |
Full schema snapshot after migration 0021 |
src/test/unit/machine-actions.test.ts |
Unit tests for OPDB metadata storage and name locking behavior |
e2e/smoke/machine-with-invite.spec.ts |
E2E test with OPDB mocking for create and edit flows |
.env.example |
Added OPDB_API_URL and OPDB_API_KEY configuration with legacy alias support |
…vite dialog The initials field is re-filled after the InviteUserDialog closes because focus-trapping portals can drop uncontrolled input values when focus returns to the parent form in some browser/driver combinations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Give the Notes & Details section proper card treatment (bg-surface-container, border, shadow) matching the Machine Details card on the left. Add subtle bg-surface-variant/15 backgrounds to individual note fields and make min-h-[80px] conditional on canEdit to avoid dead space for read-only viewers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
src/lib/opdb/*)machinesand migration (opdb_id, title, manufacturer, year, image URL, type, last synced)OpdbModelSelectUI used in both create and edit flowsTesting
pnpm run check✅pnpm test -- src/test/unit/machine-actions.test.ts✅pnpm exec playwright test e2e/smoke/machine-with-invite.spec.ts --config=playwright.config.smoke.ts --project=chromium --project='Mobile Chrome'✅pnpm exec playwright test e2e/smoke/machine-presence-status.spec.ts --config=playwright.config.smoke.ts --project='Mobile Chrome'✅pnpm exec playwright test e2e/smoke/issues-crud.spec.ts e2e/smoke/machines-crud.spec.ts --config=playwright.config.smoke.ts --project='Mobile Chrome'✅ (isolated rerun)pnpm run preflight❌ due existing smoke instability:e2e/smoke/status-overhaul.spec.tstimes out onpage.waitForLoadState("networkidle")(chromium + mobile)e2e/smoke/issues-crud.spec.tsmobile failures in full-suite rune2e/smoke/machines-crud.spec.tsmobile failure in full-suite runNotes