Skip to content

feat(prompts): show which engines share their searches on the Query Fan-out page - #1057

Merged
gkhngyk merged 7 commits into
ansvisor:mainfrom
cihan-gyk:feature/fanout-engine-coverage
Oct 16, 2026
Merged

gkhngyk merged 7 commits into
ansvisor:mainfrom
cihan-gyk:feature/fanout-engine-coverage

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

On production, the Query Fan-out page lists only Copilot, and nothing on the page says why. Users mostly track ChatGPT and Google AI Overviews, so the page reads as broken. There are two reasons (see #1056):

  • ChatGPT: its searches stopped arriving from our data provider on 2026-09-30. The answers themselves are still tracked.
  • Google AI Overviews, AI Mode and Gemini: they never share the searches behind their answers.

This PR makes the page say so, and lets the user look at one engine at a time.

Engine strip

A strip above the lists shows every engine that answered in the window:

  • Engines that share searches:
    • each chip shows the share of answers that came with searches and the number of distinct searches, e.g. "Microsoft Copilot 21% of answers · 706";
    • clicking a chip filters both views to that engine; clicking it again clears the filter.
  • Engines that never share them (Google AI Overviews, AI Mode, Gemini, and the API models, whose searches we don't capture) are dashed labels reading "not shared". There is nothing to filter to, so they aren't buttons. A note under the strip names them.
  • An engine that usually shares searches but shared none: this covers ChatGPT, Copilot and Perplexity (config/fanout-platforms.ts), and needs at least 20 answers in the window, since a few answers with none is chance.
    • Its chip is amber and says when its searches last arrived, e.g. "none since Sep 29". That date comes from a small lookup up to 90 days back.
    • A general notice explains the gap. It names no incident, so it disappears once searches arrive again.

Lists

  • By prompt: a new Engines column shows the engines that answered the prompt. Engines that shared searches for it are coloured; the others are faded.
  • Engine filter: with an engine picked, a prompt shows only that engine's searches, and prompts without any drop out. If nothing is left, the list says "No ChatGPT searches in the last 7 days".
  • Copy: the empty state and the coverage tooltip used to say Copilot and Perplexity were the main sources. They now name the engines that share searches and those that don't, and the strings are in messages/en.json.

Date range

  • The Fan-out tab now opens on 7 days. One day holds few searches, and an engine that searches on only some answers looks absent in it.
  • When switching tabs, a window still on the old tab's default moves to the new tab's default. A window the user picked stays.

Data (getQueryFanout)

Read from the same rows as before:

  • per-platform answers, answers with searches and distinct searches (engines);
  • per-prompt answering platforms and the ones that shared (platforms, fanoutPlatforms).

The only new read is the "last shared" lookup for a silent engine. It runs alongside the prompt roster read and uses PostgREST's search_queries->0 JSON-path filter, which I checked against the dev database.

Review

I ran a code review before opening this. It found 5 things; 4 are fixed:

  • the notice fired on a handful of answers;
  • the 7-day default was lost when switching tabs;
  • the lookup ran after, not alongside, the roster read;
  • the ChatGPT app and the ChatGPT API model both read "ChatGPT" (the API models are now labelled "… API").

Left as is: with an engine picked, a row's "Answers with fan-out" ratio still counts every engine.

Related issue

None. Follows #1056, which fixes the capture side and adds the health report alert.

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. Open Prompts → Query Fan-out.
    • It opens on 7d.
    • The strip shows the engines that answered, with "not shared" for Google's engines.
  2. Click an engine chip: both views show only its searches. Click it again to clear.
  3. On a brand where ChatGPT answered 20+ times in the window with no searches (production today), the ChatGPT chip is amber with its last date, and the notice explains it.
  4. From Tracked Prompts on 24h, switch to Query Fan-out: the window moves to 7d.
  5. Check light and dark mode, and 1024px (the chips wrap).

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): 0 errors; the 7 warnings are in code this PR doesn't touch
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run:

  • yarn test: 552/552.
    • fanout.test.ts: per-engine counts, prompt platforms, the last-shared lookup, which runs only for a sharing engine and only with enough answers.
    • _fanout-engines.test.tsx: the chips, the filter toggle, the notices and the silent rule.
  • yarn build: passed.
  • In the browser, on the demo brand:
    • the strip and the ChatGPT filter's empty state;
    • the notices;
    • the 7d default when switching tabs;
    • light and dark mode, 1440px and 1024px.
  • Earlier mockup: checked against production's 7-day numbers, before building.

🤖 Generated with Claude Code

…an-out page

The page listed only Copilot and said nothing about why: ChatGPT's
searches stopped arriving on 2026-09-30, and Google AI Overviews, AI Mode
and Gemini never send any. It read as broken.

- An engine strip above the lists: each engine's share of answers with
  searches and its distinct searches. A chip filters both views to that
  engine. Engines that never share are labelled "not shared".
- An engine that usually shares (ChatGPT, Copilot, Perplexity) but shared
  none over at least 20 answers is marked amber, with when it last did
  ("none since Sep 29") and a general note that clears itself once
  searches arrive again.
- An Engines column on the By-prompt list: coloured where an engine shared
  searches for the prompt, faded where it answered without.
- A filtered engine with nothing in the window says so, and the empty state
  and coverage tooltip now name the right engines (strings in en.json).
- The Fan-out tab opens on 7 days; a window the user didn't pick follows
  each tab's own default.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk The Query Fan-out page now explains which engines share their searches: an engine strip with a filter, an amber note for an engine that usually shares but sent none (ChatGPT since Sep 29), "not shared" for Google's engines, an Engines column, and a 7-day default. Companion to #1056. Ready for review when you have a moment.

@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. On the tree merged with main (now with #1088–#1090 and #1056), web tests pass (851). One note on the last-shared lookup: on the largest brand the planner walks idx_prompt_results_created_at across every brand rather than the brand index, which took 153 ms warm and 6.6 s cold, against the 8 s limit. A smaller brand uses idx_prompt_results_brand_created and takes 25 ms. A failure only drops the date, so it isn't a blocker, but worth keeping in mind if the brand grows.

@gkhngyk
gkhngyk merged commit bbb9f63 into ansvisor:main Oct 16, 2026
5 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