Skip to content

chore(seed): add shopping cards fixture so the demo Shopping page isn't empty #153

Closed

Description

@gkhngyk

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 reset reloads seed.sql cleanly
  • 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 NOTHING like the rest of the file)
  • No real customer / competitor names — keep the existing Acme Coffee / Demo Coffee Co / Fixture Roasters / Sample Beans fiction

Out of scope

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

  1. added
    documentation
    good first issue
    help wanted
    enhancement
    and removed
    documentation
    on Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions