Skip to content

Conversation

@rachel-kittens
Copy link
Contributor

@rachel-kittens rachel-kittens commented Jan 15, 2026

Problem

When users deleted AI prompts through the UI, those prompts continued to be sent to Mystique in subsequent weekly runs.

Investigation

Data flow

  • AI prompts originate from Ahrefs keyword data, stored in weekly parquet files by spacecat-import-worker
  • spacecat-audit-worker reads parquet files and sends prompts to Mystique for categorization
  • Mystique categorizes prompts and stores them in config.aiTopics
  • UI displays prompts from config.aiTopics and allows users to delete them
  • Deleted prompts are recorded in config.deleted.prompts

Root cause

  • Parquet files are immutable
  • When user deletes an AI prompt, it's added to config.deleted.prompts with the Mystique-assigned category
  • Parquet file still contains the prompt with category: "" (empty string)
  • The audit worker was not filtering parquet prompts against deleted.prompts
  • Even if it did filter, category mismatch would prevent matching:
    • Parquet: {prompt: "...", category: ""}
    • Deleted: {prompt: "...", category: "Breakfast Cereals"}
  • Not an issue for human prompts: UI removes deleted regions from config.topics before saving → no filtering needed in audit worker

Solution

Added filtering that:

  1. Only matches deleted prompts with origin: 'ai'
  2. Matches on prompt text + region only (ignores category/topic)
  3. Filters AI prompts loaded from parquet before sending to Mystique

Note: aiTopics remains unchanged


Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes
  • If data sources for any opportunity has been updated/added, please update the wiki for same opportunity.

Related Issues

LLMO-2627

Thanks for contributing!

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link

This PR will trigger a minor release when merged.

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.

2 participants