Skip to content

fix: preserve pending content opportunities - #63

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
ryonakae:fix/content-opportunity-dedupe
May 20, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
ryonakae:fix/content-opportunity-dedupe

Conversation

@ryonakae

Copy link
Copy Markdown
Contributor

Summary

  • Stop deleting pending new content opportunities before each generation
  • Dedupe generated opportunities against existing pending rows by prompt_id + normalized title
  • Skip insert when every generated opportunity is already pending, and log inserted vs pending counts

Closes #62

Verification

  • node --check server/src/lib/opportunity-generator.js
  • git diff --check

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to Ansvisor, and thank you for your first PR! A maintainer will be by soon to review.

In the meantime, two things that make review faster:

  • A short description of why the change matters, not just what it does — most of our PRs link a Fixes #... to the issue that explains the why.
  • A quick local test note if there's anything worth eyeballing in the browser.

If you'd like to keep an eye on where Ansvisor goes next, a ⭐ on the repo helps others discover it (and Watch sends you a ping when related issues land). Either way — looking forward to your next one.

@gkhngyk
gkhngyk merged commit 8a4059e into ansvisor:main May 20, 2026
1 check passed
@gkhngyk

gkhngyk commented May 20, 2026

Copy link
Copy Markdown
Contributor

Clean fix — exactly what the issue asked for. Merging shortly.

Nice catch on the intra-batch dedupe inside the filter (seen.add(key) after the lookup). The issue didn't call for it, but the LLM does occasionally rephrase the same title twice in one run, and that one line keeps the table tidy without any extra round-trips.

Welcome to Ansvisor — looking forward to the next one.

@gkhngyk gkhngyk mentioned this pull request May 26, 2026
gkhngyk added a commit that referenced this pull request Oct 2, 2026
The Generate button deleted every open opportunity a brand had before
inserting three new ones, so pressing it threw away the list someone
was working through. #63 moved the nightly generator from delete-and-
replace to keep-and-append, but the button path was never updated.

The button now adds to the open list and follows the same rules as
the nightly run: prompts at the per-prompt cap are skipped, the rest
list their open titles as "Already suggested", and exact repeats are
dropped. Both generators share the open-opportunity read
(lib/open-opportunities) and the prompt-data helpers and rule
(opportunity-limits), so the two paths cannot drift apart again.
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.

fix(content): stop deleting fresh content opportunities on every regeneration

2 participants