Skip to content

fix(seed): give the demo answers mention positions and a run a day - #1087

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/demo-positions
Oct 16, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/demo-positions

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The demo's answers get mention positions and a run a day, so the Prompts table's Positions column and the positions panel show something on a fresh install.

Two problems in the demo answers made the positions features look broken locally:

  • No positions. seed.sql inserted every demo answer without a mention_position. The Positions column read "—" for every prompt in every range, and the panel had no position to show.
  • A single run. Answers were spaced exactly 6 hours apart (now() - n * 6 hours). The panel starts a new run only after a gap of more than 6 hours (feat(prompts): add a Positions column with a per-platform positions panel #1003), so a prompt with 40 answers over 11 days read "1 run".

The positions code itself is fine. I checked it end to end on realistic answers: parser → prompt_position_summaries → table → panel.

What changes in supabase/seed.sql

  • Answer texts. Each demo answer names Acme Coffee among the seeded competitors, in one of four orders:
    • Acme first of three;
    • second of two;
    • third of three;
    • first of two.
  • Stored positions. Each answer stores the mention_position and mentioned_entity_count that response-parser.js's computeMentionPosition returns for its text. I checked this against the parser for every generated row: 166 rows, 0 mismatches.
  • Timing. Answers come four to a run, 20 minutes apart, one run a day. The 90-day spread and the density stay as they were, and each prompt's run count now equals its days, e.g. "40 answers · 11 runs · 11 days".
  • Prompt 807. Its recent re-dating step keeps a run a day too, two engines 20 minutes apart.

Mention and citation counts, competitor entries, regions and everything else are unchanged. That keeps the other demo pages (Insights, Competitors…) showing what they did.

Related issue

None. Found while checking the Positions column and panel; the UI changes from the same check are #1088, #1089 and #1090.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Reset a local database with the seed (supabase db reset).
  2. Open Prompts → Tracked Prompts at 7d, 30d and 90d. The Positions column shows averages such as #1.7.
  3. Open a prompt's positions panel. The header reads e.g. "10 runs" for 10 tracked days, and the day blocks are coloured by position.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): not run; no web code changed
  • yarn typecheck passes (run from web/): not run; no web code changed
  • yarn format:check passes (run from web/): not run; no web code changed
  • Changes are focused — one concern per PR

Also checked:

  • The seed's query. I ran the seed's own answers query against my dev database, read-only. All 166 generated rows' positions match computeMentionPosition, and runs equal days per prompt.
  • The dev database. I applied the same update to its demo answers, with competitor names mapped to that database's. The table and panel then showed positions, and the panel's runs matched its days.

Known, left as is: the seeded competitor_mentions counts and Acme's mention_count are arithmetic (n % 4, 1 + n % 5), so they don't follow the answer text. That predates this PR; changing it would reshape the Competitors and Insights demo numbers.

🤖 Generated with Claude Code

The demo's answers had no mention_position, so the Prompts table's
Positions column read "—" everywhere and the panel had no position to show;
and they were spaced exactly 6 hours apart, which the panel's run count (a
new run per gap of more than 6 hours) folded into a single run. Each answer
now names Acme Coffee among competitors in one of four orders, stores the
position response-parser.js would compute from that text, and lands in a
daily run of four answers 20 minutes apart. Prompt 807's recent rows keep a
run a day too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk a seed fix for review: the demo answers had no mention_position (Positions read "—" everywhere) and were exactly 6 h apart (the panel folded them into "1 run"). They now name Acme among competitors in four orders, store the parser's position (checked: 166/166 rows match computeMentionPosition), and come a run a day. Counts and competitor entries are unchanged. Independent of #1088–#1090.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, approving. The four answer texts match the stored positions (1 of 3, 2 of 2, 3 of 3, 1 of 2), and n comes from row_number(), so the day and 20-minute steps divide as integers.

@gkhngyk
gkhngyk merged commit cfc9ad3 into ansvisor:main Oct 16, 2026
6 checks passed
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