Repository navigation
Description
Problem
supabase/seed.sql leaves the demo dashboard's Shopping page empty. After signing in as [email protected], every Shopping KPI reads 0% / — and the empty state fires. The normalized prompt_result_shopping_cards table (added in #103) is unpopulated, and prompt_results.shopping_cards is the default '[]'.
Adding seed data here unblocks UI development on the rest of the Shopping epic (#105, #106) and gives newcomers cloning the repo a populated Shopping view to play with — same way the existing Insights / Citations / Competitors data does.
Scope
Add seed rows for both layers in supabase/seed.sql:
1. Raw prompt_results.shopping_cards
The existing prompt_results insert (line ~236) is a cross-join over prompts × platforms × regions. Only three platforms in the seed surface shopping cards in the wild:
perplexity-web— provider returns snake_case keys (image_url,review_count, …)google-aimode— camelCase (imageUrl,reviewCount, …)copilot-web— camelCase
Extend the SELECT to set shopping_cards to a small jsonb_build_array of provider-shape card objects for those three platforms only, and '[]'::jsonb (the default) for everything else. Keep it tiny — 2-3 cards per (prompt × platform) is plenty.
Use the existing demo entities so the brand matcher fires:
| Card | Role on the normalized side |
|---|---|
Brand = Acme Coffee or merchant_url under acme-coffee.example.com |
own |
Brand = Demo Coffee Co / Fixture Roasters / Sample Beans |
competitor |
| Any other plausible brand | other |
Sprinkle a couple "other" cards so the breakdown isn't all-tracked. Vary currencies ($, €, £) and merchant domains so the Top Merchant KPI and downstream charts have something to chew on.
2. Normalized prompt_result_shopping_cards
Insert one row per card with deterministic UUIDs following the existing seed convention (md5(format('prsc|%s|%s', prompt_result_id, position))::uuid works). Set matched_brand_id + matched_brand_role directly based on which entity the card represents — this is seed data, no need to re-derive via parser.
The normalized table mirrors the spec in supabase/migrations/00011_prompt_result_shopping_cards.sql.
Acceptance criteria
-
npx supabase db resetreloadsseed.sqlcleanly - Signed in as
[email protected], the Shopping page shows non-zero values for Card rate, Your products surfaced, Shopping SoV, and Top merchant - The bar chart shows multiple platforms with non-zero card rates
- The 30-day trend line shows own + total cards rising / falling per the timestamps used
- Seed is idempotent (
ON CONFLICT (...) DO NOTHINGlike the rest of the file) - No real customer / competitor names — keep the existing
Acme Coffee/Demo Coffee Co/Fixture Roasters/Sample Beansfiction
Out of scope
- Adding shopping cards for
chatgpt-web— feat(tracking): ChatGPT Shopping as a Growth-gated opt-in platform (capture shoppingCards + inlineProducts) #95 hasn't landed yet, the seed shouldn't pretend a feature exists - The
inlineProductsshape variant — separate normalization pass, also not in feat(shopping): normalize prompt_result_shopping_cards + parser worker #103 - New competitor entities — reuse the three the seed already defines
Notes
This is a fixture-only PR — no production code touched, no migration needed (the table is already there from #103). Existing seed shape in supabase/seed.sql is the template; mirror its style for the platform_models cross-join, deterministic UUIDs, and ON CONFLICT DO NOTHING.
Activity