feat: add admin provider setup UI with improved product sync

- Add /admin/providers LiveView for connecting and managing POD providers
- Implement pagination for Printify API (handles all products, not just first page)
- Add parallel processing (5 concurrent) for faster product sync
- Add slug-based fallback matching when provider_product_id changes
- Add error recovery with try/rescue to prevent stuck sync status
- Add checksum-based change detection to skip unchanged products
- Add upsert tests covering race conditions and slug matching
- Add Printify provider tests
- Document Printify integration research (product identity, order risks,
  open source vs managed hosting implications)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-01-31 22:08:34 +00:00
parent bbd748f123
commit 5b736b99fd
17 changed files with 1352 additions and 38 deletions

View File

@@ -12,16 +12,14 @@
- 100% PageSpeed score
**In Progress:**
- Products context with provider integration (Phase 1 complete)
- Products context with provider integration (sync working, wiring to shop views next)
## Next Up
1. **Admin Provider Setup UI** (`/admin/providers`) - Add/edit/test provider connections
2. **Product Sync Strategy:**
- ProductSyncWorker (Oban) for manual/scheduled sync
- Webhook endpoint for real-time updates from Printify
3. Wire Products context to shop LiveViews (replace PreviewData)
4. Session-based cart with real variants
1. **Printify Webhook Endpoint** - Real-time product updates when changes happen in Printify
2. **Wire Products to Shop LiveViews** - Replace PreviewData with real synced products
3. **Variant Selector Component** - Size/colour picker on product pages
4. **Session-based Cart** - Real cart with actual variants
---
@@ -57,15 +55,25 @@ See: [docs/plans/image-optimization.md](docs/plans/image-optimization.md) for im
- [x] Provider abstraction layer
- [x] Printify client integration
- [x] Product/variant/image schemas
- [x] Admin Provider Setup UI (`/admin/providers`) - connect, test, sync
- [x] ProductSyncWorker with pagination, parallel processing, error recovery
- [x] Slug-based fallback matching for changed provider IDs
#### Remaining Tasks
- [ ] **Admin Provider Setup UI** - `/admin/providers` for managing connections (~2hr) ← **NEXT**
- [ ] Create ProductSyncWorker (Oban) for manual/scheduled sync (~1hr)
- [ ] Printify webhook endpoint for real-time product updates (~1.5hr)
- [ ] Wire shop LiveViews to Products context (~2hr)
- [ ] Add variant selector component (~2hr)
#### Future Enhancements (post-MVP)
- [ ] Pre-checkout variant validation (verify availability before order)
- [ ] Cost change monitoring/alerts (warn if Printify cost increased)
- [ ] OAuth platform integration (appear in Printify's "Publish to" UI)
#### Technical Debt
- [ ] Add HTTP mocking (Mox/Bypass) for Printify API tests
See: [docs/plans/products-context.md](docs/plans/products-context.md) for implementation details
See: [docs/plans/printify-integration-research.md](docs/plans/printify-integration-research.md) for API research & risk analysis
### Cart & Checkout
**Status:** Planned