Skip to content

fix(shopping): keep chatgpt-shopping off brands that have Shopping disabled - #432

Merged
gkhngyk merged 1 commit into
mainfrom
fix/shopping-platform-leak
Jul 15, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/shopping-platform-leak

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Shopping tracking is opt-in per brand (#155), but nothing enforced the OFF side. Two shopping-disabled brands had accumulated chatgpt-shopping on 111 active prompts — roughly 700 paid Cloro scrapes a week for data those brands can't even see, with the rows leaking into analytics surfaces. How it spread: the engine pickers offered (and default-checked) ChatGPT Shopping regardless of the brand pref, fan-out Track copies the latest prompt's platforms verbatim, and the tracking worker runs whatever the stored arrays say.

Three enforcement layers, so this can't regrow:

  • Prompt write actions (addPromptToSet, savePromptSet, updatePrompt) strip chatgpt-shopping when the brand's pref is off — one server-side choke point covers manual adds, suggestion accepts and fan-out Track. The pref-ON behavior is unchanged: addPromptToSet still auto-appends the platform, so fan-out Track on a Shopping-enabled brand keeps getting it.
  • Tracking worker filters prompt.platforms by the brand pref at run time (same pattern as the plan-gated model filter), so already-contaminated arrays stop producing paid scrapes immediately on deploy.
  • Brand prompts page hides the ChatGPT Shopping engine checkbox when the pref is off.

The existing 111 contaminated prompt rows were cleaned up separately (verified: 0 remaining on shopping-disabled brands; Shopping-enabled brands untouched).

Related Issue

Found while investigating the citations mismatch behind #429/#430.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🧹 Chore / refactor
  • 📝 Documentation
  • 🚨 Breaking change

How to Test

  1. On a brand with Shopping off: the prompts page engine picker shows no ChatGPT Shopping option; adding a prompt (manual, suggestion, or fan-out Track) never persists chatgpt-shopping in prompts.platforms.
  2. On a brand with Shopping on: new prompts (including fan-out Track) still get chatgpt-shopping appended automatically.
  3. Give a Shopping-off brand's prompt a stale platforms: [..., "chatgpt-shopping"] directly in the DB → a tracking run submits no shopping scrape and the progress total excludes it.
  4. Editing a prompt on a Shopping-off brand strips the platform on save; on a Shopping-on brand the user's selection is preserved.

Checklist

  • My code follows the project's style guidelines (Prettier clean)
  • I have performed a self-review of my code
  • npx tsc --noEmit passes
  • Web tests pass (45/45), server tests pass (113/113)
  • Data cleanup executed and verified against production

…sabled

Shopping tracking is opt-in per brand (#155), but nothing enforced the
OFF side: the engine pickers offered chatgpt-shopping regardless of the
pref (and default-checked it), fan-out Track copied it from the latest
prompt's platforms, and the tracking worker ran whatever the stored
arrays said. Two shopping-disabled brands accumulated it on 111 prompts
— ~700 paid Cloro scrapes a week for data those brands can't see, with
the rows leaking into analytics surfaces that don't exclude the
platform yet.

Three layers now enforce the pref:
- prompt write actions (addPromptToSet, savePromptSet, updatePrompt)
  strip chatgpt-shopping when the brand's pref is off — one choke point
  covers manual adds, suggestion accepts and fan-out Track; the pref-ON
  auto-append behavior is unchanged
- the tracking worker filters prompt.platforms by the pref at run time,
  so already-contaminated arrays stop producing scrapes immediately
- the brand prompts page hides the ChatGPT Shopping engine when the
  pref is off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant