Repository navigation
fix(tracking): keep job active until webhook results drain - #1
Merged
Merged
Conversation
In webhook mode the worker was returning right after submission, so the UI loading banner (driven by job status) disappeared within seconds even though Cloro hadn't started returning real results yet. After checkout/payment that meant the user landed on Insights and saw a silent empty state instead of "Analyzing prompts...". Now after submitting, the worker polls cloro_pending_tasks every 15s for the brand and updates job.progress with the remaining count. Job returns only when pending hits 0 or the 60-minute drain timeout fires. This is cheap (single COUNT query, no Cloro calls) and preserves the loading bar UX users had under the polling-mode worker. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The drain-loop progress banner referenced "Cloro queue" directly. End users shouldn't see the scraper-vendor name. Replace with neutral "still processing" wording. Internal log lines and comments keep the Cloro reference for debuggability. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Oct 13, 2026
Merged
gkhngyk
pushed a commit
that referenced
this pull request
Oct 17, 2026
…order its platforms (#1102) * feat(prompts): give each platform one line in the positions panel's 24h view The 24h view listed each platform with its name on one line and a Mention / Citation block under it. Each platform now takes one line: its name on the left and its latest answer's status on the right ("Mentioned Early · #1 of 3 · Not cited", or "No runs in this period"). The run's time moves to the status's tooltip, which opens on hover or keyboard focus. The platforms are also reordered wherever POSITION_PLATFORMS drives them (the panel and the table's platform dots): ChatGPT, Microsoft Copilot, Google AI Overviews, Google AI Mode, Gemini, Grok, Claude, Perplexity. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(prompts): keep the 24h rows' mention and citation columns, citation on the right The one-line rows read the request wrong. Each platform keeps its name line with "Run at …" and its Mention / Citation block under it, as before; the Citation column is now right-aligned, so mentions read down the left and citations down the right. On narrow screens the two stack, left-aligned. The rows carry data-platform for the test; the platform order from the previous commit stays. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…1063) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(signals): plan ae_competitor_positions with its arguments A SQL-language function is planned without its argument values, so the day range was a guess: on the largest brand, with its 19 competitors over two weeks, the read took 28.6 s. As 00147, 00148 and 00152 do, the function becomes plpgsql with force_custom_plan and work_mem, and takes 0.16 s with the same 80 rows. The body is unchanged. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…1064) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…ts on (#1065) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
#1066) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…1068) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show what AI visitors did on a traffic signal's pages The AI-traffic detector compares each page's AI visitors with the site's using Analytics: engagement and key events per session. It now records those figures with each page, and the site's rates beside them, and an AI traffic drop counts its falling pages apart from its sessions. The drawer gives each page its sessions and what its finding was raised on: engagement against the site, key events per session, or the key events a converting page lost. Without Analytics, a page shows its sessions. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…hat each card counts (#1075) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show what AI visitors did on a traffic signal's pages The AI-traffic detector compares each page's AI visitors with the site's using Analytics: engagement and key events per session. It now records those figures with each page, and the site's rates beside them, and an AI traffic drop counts its falling pages apart from its sessions. The drawer gives each page its sessions and what its finding was raised on: engagement against the site, key events per session, or the key events a converting page lost. Without Analytics, a page shows its sessions. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(signals): show signal count changes in a neutral colour and say what each card counts AC-008. More signals usually means more losses and gaps, so the Total, Important and New cards no longer show a rise in green (or a fall in red): their change is neutral and signed, "+550% vs Aug 17 – Sep 15". Only more resolved signals is green. Each card also says what it counts in the selected range: "active in the last 30 days", "detected in the last 30 days", "resolved in the last 30 days". Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…1069) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(signals): label each figure with the window its detector reads The What changed block said "Last 7 days" for findings read over longer windows. The Search Console findings (gsc_demand_gap, search_ai_misalignment, gsc_low_ctr, gsc_risk, gsc_decline) count queries over the last 28 days, and the cross-channel findings read AI sessions over 14 days against 14, search clicks over 28 against 28 and mentions over 7 against 7. Add the 28-day periods, give a figure its own period where it differs from the change's, name the days in the before and after labels, and return each figure's period from list_signals. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
8 of 12 tasks
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…action's counts (#1076) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show what AI visitors did on a traffic signal's pages The AI-traffic detector compares each page's AI visitors with the site's using Analytics: engagement and key events per session. It now records those figures with each page, and the site's rates beside them, and an AI traffic drop counts its falling pages apart from its sessions. The drawer gives each page its sessions and what its finding was raised on: engagement against the site, key events per session, or the key events a converting page lost. Without Analytics, a page shows its sessions. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): copy or export everything an action shows Every action's drawer gets Copy Data, Export CSV and Export Excel (AC-005). Copy Data opens the whole action as Markdown, every tab of the drawer, to copy a part or all of it with one click; the copy falls back to the browser's copy command where the clipboard API is blocked. The CSV (action-AC-52.csv, UTF-8 with a BOM) has a row per task and per signal marked by a section column; the Excel workbook has a sheet each for the action, its tasks, its signals and its history. Adds the write-excel-file package, loaded only when a workbook is asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): score every action's priority on the server Each action gets a priority score from 0 to 100 with a level (critical, high, medium, low), and the facts behind it for "Why this priority?" (AC-006). The score weighs impact, the demand of the most searched prompts, queries or pages, how severe the change is, commercial intent, independent kinds and sources of evidence, whether the ground was held before, and how recent it is, never how many signals repeat. It is worked out when an action is created and again every night, stored in new columns (migration 00144), and orders the queue of waiting findings too, with a little added for each day waited. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show each action's priority and work the list by it The actions list sorts by the server's priority score by default, shows the score beside Impact, and the Top Actions card counts the five highest-priority open actions. The drawer explains the score in "Why this priority?", and Copy Data and the exports carry it. MCP list_actions and get_action return the priority, and list_actions can sort by it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): use the priority score wherever actions showed impact The score already weighs impact in, so showing both read as two answers to one question. The Actions and History lists drop their Impact column for a Priority Score column (score and level), filter and sort by priority, and the Potential Impact card becomes Highest Priority. The drawers' headers, Copy Data and Excel show the priority instead of impact, and MCP list_actions now lists the highest priority first by default (sort "updated" for the old order). Signals keep their own impact. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): link signals and actions both ways and keep priority current AC-007. Every signal an action takes as evidence is now kept in a new action_signals table (00145), so an action lists its signals after they move on to a later cycle and a signal can be used by more than one action. - The nightly generator writes the link, treats a signal as taken only while an active action holds it (a still-open signal whose action closed can start the next cycle), and keeps newcomers queued on the nights after they were linked, not only the first. - Resolving, dismissing or reopening a signal scores its active actions again at once, through POST /api/action-center/signals/:id/rescore. - "Why this action?" says how many open signals support the action and lists them by type, platform and subject. The list counts only those, and the drawer, History and MCP get_action read through the new table. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the prompts, pages and platforms behind an action's counts AC-003, part 1. "Recover lost citations on 7 prompts" said 7 prompts with no way to see which. The action drawer gets an Affected tab, built from the signals that support the action so the list matches them: - prompts with their AI search volume, the platforms they were lost or missed on, the brand's page that lost the citation and what is cited instead, or the competitor ahead of the brand on each; - AI-traffic pages with their visits and where they came from, and a technical finding's checks; - topics and competitors where a finding names no rows. Columns nothing fills are left out. Prompts link to their page and their Positions panel. The header's counts become chips that open the list behind them (signals open the Signals tab), with new pages, platforms and topics chips. Copy Data, Export CSV and Export Excel include the affected rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): read the 30-day position result through the shared event text Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): let the action-signals mock answer the detail's outcome read Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…#1077) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show what AI visitors did on a traffic signal's pages The AI-traffic detector compares each page's AI visitors with the site's using Analytics: engagement and key events per session. It now records those figures with each page, and the site's rates beside them, and an AI traffic drop counts its falling pages apart from its sessions. The drawer gives each page its sessions and what its finding was raised on: engagement against the site, key events per session, or the key events a converting page lost. Without Analytics, a page shows its sessions. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): copy or export everything an action shows Every action's drawer gets Copy Data, Export CSV and Export Excel (AC-005). Copy Data opens the whole action as Markdown, every tab of the drawer, to copy a part or all of it with one click; the copy falls back to the browser's copy command where the clipboard API is blocked. The CSV (action-AC-52.csv, UTF-8 with a BOM) has a row per task and per signal marked by a section column; the Excel workbook has a sheet each for the action, its tasks, its signals and its history. Adds the write-excel-file package, loaded only when a workbook is asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): score every action's priority on the server Each action gets a priority score from 0 to 100 with a level (critical, high, medium, low), and the facts behind it for "Why this priority?" (AC-006). The score weighs impact, the demand of the most searched prompts, queries or pages, how severe the change is, commercial intent, independent kinds and sources of evidence, whether the ground was held before, and how recent it is, never how many signals repeat. It is worked out when an action is created and again every night, stored in new columns (migration 00144), and orders the queue of waiting findings too, with a little added for each day waited. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show each action's priority and work the list by it The actions list sorts by the server's priority score by default, shows the score beside Impact, and the Top Actions card counts the five highest-priority open actions. The drawer explains the score in "Why this priority?", and Copy Data and the exports carry it. MCP list_actions and get_action return the priority, and list_actions can sort by it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): use the priority score wherever actions showed impact The score already weighs impact in, so showing both read as two answers to one question. The Actions and History lists drop their Impact column for a Priority Score column (score and level), filter and sort by priority, and the Potential Impact card becomes Highest Priority. The drawers' headers, Copy Data and Excel show the priority instead of impact, and MCP list_actions now lists the highest priority first by default (sort "updated" for the old order). Signals keep their own impact. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): link signals and actions both ways and keep priority current AC-007. Every signal an action takes as evidence is now kept in a new action_signals table (00145), so an action lists its signals after they move on to a later cycle and a signal can be used by more than one action. - The nightly generator writes the link, treats a signal as taken only while an active action holds it (a still-open signal whose action closed can start the next cycle), and keeps newcomers queued on the nights after they were linked, not only the first. - Resolving, dismissing or reopening a signal scores its active actions again at once, through POST /api/action-center/signals/:id/rescore. - "Why this action?" says how many open signals support the action and lists them by type, platform and subject. The list counts only those, and the drawer, History and MCP get_action read through the new table. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the prompts, pages and platforms behind an action's counts AC-003, part 1. "Recover lost citations on 7 prompts" said 7 prompts with no way to see which. The action drawer gets an Affected tab, built from the signals that support the action so the list matches them: - prompts with their AI search volume, the platforms they were lost or missed on, the brand's page that lost the citation and what is cited instead, or the competitor ahead of the brand on each; - AI-traffic pages with their visits and where they came from, and a technical finding's checks; - topics and competitors where a finding names no rows. Columns nothing fills are left out. Prompts link to their page and their Positions panel. The header's counts become chips that open the list behind them (signals open the Signals tab), with new pages, platforms and topics chips. Copy Data, Export CSV and Export Excel include the affected rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): read the 30-day position result through the shared event text Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): let the action-signals mock answer the detail's outcome read Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): write an action's why and goal from its own data "Why this action?" and "Goal" were one template per kind ("Citations you held consistently are gone.", "Win back the citations you lost."). They now name the prompts or pages, their topic and monthly AI search demand, the platforms, the brand's domain and the days the signals were raised, and set a measurable goal: 70% of the items back, rounded up (all of them for keep and fix work), by the due date or 30 days after the action was raised. Sentences follow the evidence, not the kind: sixteen families of sentences (a citation lost, a gap, a competitor ahead, AI traffic falling, an audit finding...) cover the sixty-six kinds. The drawer's header, Overview and Copy Data / CSV / Excel use them; an action a person sent keeps its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…1080) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show what AI visitors did on a traffic signal's pages The AI-traffic detector compares each page's AI visitors with the site's using Analytics: engagement and key events per session. It now records those figures with each page, and the site's rates beside them, and an AI traffic drop counts its falling pages apart from its sessions. The drawer gives each page its sessions and what its finding was raised on: engagement against the site, key events per session, or the key events a converting page lost. Without Analytics, a page shows its sessions. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): copy or export everything an action shows Every action's drawer gets Copy Data, Export CSV and Export Excel (AC-005). Copy Data opens the whole action as Markdown, every tab of the drawer, to copy a part or all of it with one click; the copy falls back to the browser's copy command where the clipboard API is blocked. The CSV (action-AC-52.csv, UTF-8 with a BOM) has a row per task and per signal marked by a section column; the Excel workbook has a sheet each for the action, its tasks, its signals and its history. Adds the write-excel-file package, loaded only when a workbook is asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): score every action's priority on the server Each action gets a priority score from 0 to 100 with a level (critical, high, medium, low), and the facts behind it for "Why this priority?" (AC-006). The score weighs impact, the demand of the most searched prompts, queries or pages, how severe the change is, commercial intent, independent kinds and sources of evidence, whether the ground was held before, and how recent it is, never how many signals repeat. It is worked out when an action is created and again every night, stored in new columns (migration 00144), and orders the queue of waiting findings too, with a little added for each day waited. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show each action's priority and work the list by it The actions list sorts by the server's priority score by default, shows the score beside Impact, and the Top Actions card counts the five highest-priority open actions. The drawer explains the score in "Why this priority?", and Copy Data and the exports carry it. MCP list_actions and get_action return the priority, and list_actions can sort by it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): use the priority score wherever actions showed impact The score already weighs impact in, so showing both read as two answers to one question. The Actions and History lists drop their Impact column for a Priority Score column (score and level), filter and sort by priority, and the Potential Impact card becomes Highest Priority. The drawers' headers, Copy Data and Excel show the priority instead of impact, and MCP list_actions now lists the highest priority first by default (sort "updated" for the old order). Signals keep their own impact. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): link signals and actions both ways and keep priority current AC-007. Every signal an action takes as evidence is now kept in a new action_signals table (00145), so an action lists its signals after they move on to a later cycle and a signal can be used by more than one action. - The nightly generator writes the link, treats a signal as taken only while an active action holds it (a still-open signal whose action closed can start the next cycle), and keeps newcomers queued on the nights after they were linked, not only the first. - Resolving, dismissing or reopening a signal scores its active actions again at once, through POST /api/action-center/signals/:id/rescore. - "Why this action?" says how many open signals support the action and lists them by type, platform and subject. The list counts only those, and the drawer, History and MCP get_action read through the new table. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the prompts, pages and platforms behind an action's counts AC-003, part 1. "Recover lost citations on 7 prompts" said 7 prompts with no way to see which. The action drawer gets an Affected tab, built from the signals that support the action so the list matches them: - prompts with their AI search volume, the platforms they were lost or missed on, the brand's page that lost the citation and what is cited instead, or the competitor ahead of the brand on each; - AI-traffic pages with their visits and where they came from, and a technical finding's checks; - topics and competitors where a finding names no rows. Columns nothing fills are left out. Prompts link to their page and their Positions panel. The header's counts become chips that open the list behind them (signals open the Signals tab), with new pages, platforms and topics chips. Copy Data, Export CSV and Export Excel include the affected rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): read the 30-day position result through the shared event text Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): let the action-signals mock answer the detail's outcome read Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): write an action's why and goal from its own data "Why this action?" and "Goal" were one template per kind ("Citations you held consistently are gone.", "Win back the citations you lost."). They now name the prompts or pages, their topic and monthly AI search demand, the platforms, the brand's domain and the days the signals were raised, and set a measurable goal: 70% of the items back, rounded up (all of them for keep and fix work), by the due date or 30 days after the action was raised. Sentences follow the evidence, not the kind: sixteen families of sentences (a citation lost, a gap, a competitor ahead, AI traffic falling, an audit finding...) cover the sixty-six kinds. The drawer's header, Overview and Copy Data / CSV / Excel use them; an action a person sent keeps its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): give tasks where, why, how and done-when fields AC-004 part 1 of 3. A task can now carry where to do it, why (the evidence), how (the steps), when it counts as done, its type (Content, On-page, Technical, Outreach, PR, Product), effort and role. Part 2 has the generator fill them; this part stores, shows, edits and exports them. - details are read through parseTaskDetails, so an Improve task's body, platform and evidence and the new fields both render, and a malformed row no longer breaks the drawer or the exports - clicking a task opens its details; Edit changes every field and the text (updateTaskDetails replaces updateTaskTitle, logs task_edited); the form stays until the save lands, and Improve tasks open as before - a reload after a change keeps the drawer's content, so an opened task stays open - Copy Data, CSV and Excel carry each field; MCP get_action returns the details in snake_case Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 17, 2026
…d from the action's data (#1086) * feat(action-center): show where each signal happened and filter signals by platform The Signals list never said which AI platform or location a signal was about, and named platforms by their raw ids ("Visibility dropped on gemini-web", "Weak in JP"). Part one of AC-002: - Each row's Affected cell gets a line with the engines and locations the signal is about: from the payload for platform and country signals, and from the prompts' tracked platforms and locations for prompt and topic signals. A line rather than a column keeps the table within the page beside a pinned sidebar. - Platforms and locations read as people know them ("Gemini", "Japan"). - Descriptions carry the measured fact instead of a generic sentence, e.g. "Your mention rate fell from 34% to 18% against the week before." - A Platform filter, search over platform and location names, and platforms and locations columns in the CSV export. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): group copies of one signal and count them once A brand can track the same prompt text as several prompts, and the detectors write one signal per prompt: on production one pass wrote ten identical "Citations lost for '…'" rows, which read as duplicates and inflated every count. Part two of AC-002: - Signals of one kind, about one prompt text (case, spacing and the closing "?" ignored), found in one pass are one row with a "×N grouped" toggle. Opened, it lists each copy with its topic, place and status; each copy keeps its own drawer and menu, and the group's menu acts on the copies it applies to. - The category tabs, the tab badge and the summary cards count groups. Migration 00141 adds signal_group_key (the same rule as lib/signals/group.ts), counts signals_summary over groups, where a group is resolved only once every copy is, and adds signals_new_count for the badge. - A drawer opened from a link to a copy opens its group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show where a signal happened, what changed and what it rests on The signal drawer showed bare numbers ("0 → 251 +167") and no platform, location, page or action. Part one of AC-001: the drawer has three blocks. - Where: the fields the spec asks per category (prompt, topic, platforms, locations, domain, competitor, pages, queries, and for a lost citation the page cited before and who is cited now). A field no detector records yet says "Not available"; platforms read from a signal's prompts say "Tracked on". - What changed: every figure with its metric, whose or which window, and unit, over its period: "Mention rate · previous 7 days 34% → last 7 days 18%, −16 pts". A source domain's three counts are named instead of read as a before and after. A fall in the brand's own numbers is red, a competitor's rise too (the old colouring showed drops as good news). - Evidence and links: the page behind the signal (the prompt's answers, the topic, Citations…), first and last detection, and the actions using it. MCP list_signals returns the same detail per signal (where, change, evidence, used_by_actions) beside the raw row, from lib/signals/detail.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): record what a lost citation rests on and show it A lost citation was recorded with its prompt only, so the drawer could not say which page lost its citation, where, or who replaced it. Part two of AC-001, for lost citations: - The recorder reads the lost prompts' answers back (server signals/lost-citation-evidence.js) and writes, with the signal: the platforms and locations it was lost on, the brand's page cited before with its position and last cited date, the pages cited in the quiet answers with their position and how many of the answers read cite them, and its cited days before and since. Best effort, and a night whose read fails keeps the evidence an earlier night recorded. - The drawer shows them: Platforms and Locations (where it was lost), "Your page cited before", "Cited now", and "Cited days · earlier 9 / 11 → latest 0 / 3". A loss on one platform names it in the title ("Citations lost on ChatGPT for …"), and the row says which page is no longer cited. - MCP list_signals returns the same evidence. - ownDomainMatcher is the own-domain rule countOwnDomainCitations already used, now shared. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a competitor beats you, prompt by prompt A competitor signal named the competitor and one number, so the drawer had "Not available" for positions by prompt and the sources behind its wins. Part two of AC-001, for competitor signals (leads, gaining, surge, crossed, overtaken, citation gap): - Migration 00142 adds ae_competitor_positions: per competitor, the prompts and platforms where it is level with or ahead of the brand, with both positions this week and last, from the daily rollups (harmonic mean of mention positions). Service role only, like the other detector reads. - The recorder writes, with each competitor signal, those positions and the domains most cited in the latest answers the competitor wins (named, the brand not). Best effort, and an earlier night's evidence is kept when a read fails. - The drawer shows "Positions by prompt" ("ChatGPT · Profound #1 ↑2 · You #3 ↓1", "You — lost"), coloured as news for the brand, the platforms it leads on, and "Sources behind their wins". MCP list_signals returns them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where the brand is mentioned without a citation The "Brand mentioned without citation" signal listed prompt ids only, so the drawer had "Not available" for the mention's platform, position, sentiment and excerpt. Part two of AC-001, for mention signals: - The detector lists its prompts most mentioned first (prompt id breaks ties), and the recorder describes the first five: the platforms whose answers name the brand without citing it, the brand's median position, the answers' most common sentiment, how many answers, and a quote of the newest answer that names the brand (trying the next two if it doesn't). Best effort; a failed text read keeps the rest, and an earlier night's evidence is kept when a read fails. - mentionExcerpt quotes an answer around the brand's first mention with the mention count's own matching, without links or markdown marks, cut on whole words. - The drawer lists "Mentions by prompt" (prompt, platforms, #position, sentiment, answers, the quote and where it is from). Platforms and locations are each labelled by what they say: the platforms that mention the brand, the locations where the prompts are tracked. MCP list_signals returns the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show which crawlers and checks a technical finding rests on The audits family now records, per page, each failed check's label and evidence. The AI bot access check names the bots robots.txt blocks, read group by group: the old text-window scan took the next group's rules for an allowed bot's. The drawer shows the issue, the affected crawlers for a blocked-crawler finding, and what each check found, page by page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show where a page's AI visits come from and its prompts Traffic signals now record, for their first pages, AI-referred visits by platform over the last 14 days against the 14 before, and the active prompts that name any of their pages as the target URL; site-wide ones record the site's visits by platform. One read (ae_page_traffic_evidence) matches the detector's pages as written and a page opportunity's as a path. The drawer shows both, and the AI-traffic findings now say they compare 14 days. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(signals): show what AI visitors did on a traffic signal's pages The AI-traffic detector compares each page's AI visitors with the site's using Analytics: engagement and key events per session. It now records those figures with each page, and the site's rates beside them, and an AI traffic drop counts its falling pages apart from its sessions. The drawer gives each page its sessions and what its finding was raised on: engagement against the site, key events per session, or the key events a converting page lost. Without Analytics, a page shows its sessions. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): copy or export everything an action shows Every action's drawer gets Copy Data, Export CSV and Export Excel (AC-005). Copy Data opens the whole action as Markdown, every tab of the drawer, to copy a part or all of it with one click; the copy falls back to the browser's copy command where the clipboard API is blocked. The CSV (action-AC-52.csv, UTF-8 with a BOM) has a row per task and per signal marked by a section column; the Excel workbook has a sheet each for the action, its tasks, its signals and its history. Adds the write-excel-file package, loaded only when a workbook is asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): score every action's priority on the server Each action gets a priority score from 0 to 100 with a level (critical, high, medium, low), and the facts behind it for "Why this priority?" (AC-006). The score weighs impact, the demand of the most searched prompts, queries or pages, how severe the change is, commercial intent, independent kinds and sources of evidence, whether the ground was held before, and how recent it is, never how many signals repeat. It is worked out when an action is created and again every night, stored in new columns (migration 00144), and orders the queue of waiting findings too, with a little added for each day waited. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): show each action's priority and work the list by it The actions list sorts by the server's priority score by default, shows the score beside Impact, and the Top Actions card counts the five highest-priority open actions. The drawer explains the score in "Why this priority?", and Copy Data and the exports carry it. MCP list_actions and get_action return the priority, and list_actions can sort by it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): use the priority score wherever actions showed impact The score already weighs impact in, so showing both read as two answers to one question. The Actions and History lists drop their Impact column for a Priority Score column (score and level), filter and sort by priority, and the Potential Impact card becomes Highest Priority. The drawers' headers, Copy Data and Excel show the priority instead of impact, and MCP list_actions now lists the highest priority first by default (sort "updated" for the old order). Signals keep their own impact. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): link signals and actions both ways and keep priority current AC-007. Every signal an action takes as evidence is now kept in a new action_signals table (00145), so an action lists its signals after they move on to a later cycle and a signal can be used by more than one action. - The nightly generator writes the link, treats a signal as taken only while an active action holds it (a still-open signal whose action closed can start the next cycle), and keeps newcomers queued on the nights after they were linked, not only the first. - Resolving, dismissing or reopening a signal scores its active actions again at once, through POST /api/action-center/signals/:id/rescore. - "Why this action?" says how many open signals support the action and lists them by type, platform and subject. The list counts only those, and the drawer, History and MCP get_action read through the new table. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the prompts, pages and platforms behind an action's counts AC-003, part 1. "Recover lost citations on 7 prompts" said 7 prompts with no way to see which. The action drawer gets an Affected tab, built from the signals that support the action so the list matches them: - prompts with their AI search volume, the platforms they were lost or missed on, the brand's page that lost the citation and what is cited instead, or the competitor ahead of the brand on each; - AI-traffic pages with their visits and where they came from, and a technical finding's checks; - topics and competitors where a finding names no rows. Columns nothing fills are left out. Prompts link to their page and their Positions panel. The header's counts become chips that open the list behind them (signals open the Signals tab), with new pages, platforms and topics chips. Copy Data, Export CSV and Export Excel include the affected rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): read the 30-day position result through the shared event text Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(action-center): let the action-signals mock answer the detail's outcome read Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): write an action's why and goal from its own data "Why this action?" and "Goal" were one template per kind ("Citations you held consistently are gone.", "Win back the citations you lost."). They now name the prompts or pages, their topic and monthly AI search demand, the platforms, the brand's domain and the days the signals were raised, and set a measurable goal: 70% of the items back, rounded up (all of them for keep and fix work), by the due date or 30 days after the action was raised. Sentences follow the evidence, not the kind: sixteen families of sentences (a citation lost, a gap, a competitor ahead, AI traffic falling, an audit finding...) cover the sixty-six kinds. The drawer's header, Overview and Copy Data / CSV / Excel use them; an action a person sent keeps its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): give tasks where, why, how and done-when fields AC-004 part 1 of 3. A task can now carry where to do it, why (the evidence), how (the steps), when it counts as done, its type (Content, On-page, Technical, Outreach, PR, Product), effort and role. Part 2 has the generator fill them; this part stores, shows, edits and exports them. - details are read through parseTaskDetails, so an Improve task's body, platform and evidence and the new fields both render, and a malformed row no longer breaks the drawer or the exports - clicking a task opens its details; Edit changes every field and the text (updateTaskDetails replaces updateTaskTitle, logs task_edited); the form stays until the save lands, and Improve tasks open as before - a reload after a change keeps the drawer's content, so an opened task stays open - Copy Data, CSV and Excel carry each field; MCP get_action returns the details in snake_case Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): write an action's tasks from its evidence AC-004 part 2 of 3. Template tasks ("Refresh content for 7 prompts") are replaced by at most six tasks a model writes from the pages, prompts, domains and competitors the action's signals name: one per target, each with where, why, how, done-when, type, effort and role (#1080's fields). - task-writer/evidence.js reads the signals' payloads into entities with refs; quality.js refuses a task with no known target, a count in its title, analysis the product does itself, or missing fields; refused tasks are asked for once more with their reasons - runs after a pass that opened actions and in a daily sweep, on plans nobody has started on; "Regenerate tasks" rewrites on request, keeping done, under-way and hand-added tasks - a claim column keeps two writers off one action; every model attempt is charged to the Improve budget (prompt_improve_usage.action_id) - off unless ACTION_TASKS_AI=true; scripts/review-action-tasks.js writes the dry-run review set product reads before it is turned on - migration 00150: prompt_improve_usage.action_id, actions.tasks_generated_at, actions.tasks_writing_since Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): send a task to Content or the brand's webhook A content task can become a Content opportunity that carries the task's target, reasons, steps and done-when check and links back to its action; any task can be posted to the brand's active webhook as action_task.sent. The task records where it went, History logs it, and the brief prompt reads the task's context. Migration 00151 adds the 'action' opportunity source and keeps one open opportunity per task. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): add affected items to the actions list CSV and copy toast The actions list's Export CSV gains affected_count and affected_items, read for the listed actions from the signals each rests on, as the drawer's Affected tab shows them, and is now written with a BOM so Excel keeps non-ASCII text. The Copy Data toast names the prompts (or pages) it copied before the tasks and signals. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): return an action as Markdown or CSV from the API and MCP get_action takes a format (json, markdown or csv) and GET /api/mcp/actions/{id} takes ?format=, returning the action as the dashboard's Copy Data and Export CSV write it. The drawer's labelling moves into lib/action-center/export-labels so both use it; the API reads the action through the API key and works out the Affected list, its demand, the Why and Goal and a Content action's opportunity the way the drawer does. format=json stays the default and is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the goal's due day in the API export east of UTC The goal's due date was set to local midnight, which the API's export writes out in UTC: on a server east of UTC a goal due Nov 9 read "by Nov 8". It is now set to local noon, the same calendar day wherever it is written out. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): write the History drawer's goal and what happened from the action's data The History drawer read general sentences ("Citations you held consistently are gone.") where the Actions drawer names the prompts, platforms and days. It now reads the action's signals when it opens and writes both the way the Actions drawer does, through a hook the two share (use-action-story), with placeholders until they are read and the general sentences when they can't be. A lean getActionSignals reads only what it needs; history items carry the due date the goal is dated by. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
Merged
8 of 12 tasks
This was referenced Oct 21, 2026
Merged
This was referenced Oct 24, 2026
Merged
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…ts, orders and readiness (Product Visibility, part 4) (#1639) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
… on it, top rival and AI revenue (Product Visibility, part 5) (#1640) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…AI picked another one (Product Visibility, part 6) (#1641) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…h the work that gets it on the AI shelf (Product Visibility, part 7) (#1642) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…by channel and check by check (Product Visibility, part 8) (#1643) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…Products chip (Product Visibility, part 9) (#1644) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…nd open the product on that shelf (Product Visibility, part 10) (#1645) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…he product and its category (Product Visibility, part 11) (#1646) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…tarter and 50,000 on Growth (Product Visibility, part 12) (#1647) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(catalog): cap a workspace's catalog products by plan, 50 / 500 / custom (product visibility, part 12) ECOM-019. Plans get maxCatalogProducts: Starter 50, Growth 500, Enterprise set per customer through plan_overrides, self-hosted no cap; counted across the workspace's brands, like prompts. - On the managed cloud a source's sync keeps what's left of the cap after the workspace's other sources (productRoom): the products already live first, so a tracked product stays tracked, then the new ones in the source's order. The rest aren't written; one in the catalog already is marked removed, as if gone from the source, and comes back when there's room. Nothing is deleted. - The source records how many it couldn't keep and the cap (last_counts overLimit / limit); Settings › Product catalog says so, with Upgrade for admins and managers. - A workspace without an active subscription gets the plan's own words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): cap a Google Merchant Center account's products by plan, as a feed's Merchant Center (#1270) reads through the workspace sign-in, a path of its own beside feeds and stores; the plan's product cap (productRoom) applies to it all the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): cap catalog products at 5,000 on Starter and 50,000 on Growth ECOM-019's caps were the spec's open-question defaults, 50 and 500: a real store's catalog went past them on the first sync. Decided on 2026-10-28: Starter 5,000, Growth 50,000; Enterprise stays set per customer through plan_overrides, and self-hosted uncapped (both -1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…swers that showed it (Product Visibility, part 13) (#1648) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(catalog): cap a workspace's catalog products by plan, 50 / 500 / custom (product visibility, part 12) ECOM-019. Plans get maxCatalogProducts: Starter 50, Growth 500, Enterprise set per customer through plan_overrides, self-hosted no cap; counted across the workspace's brands, like prompts. - On the managed cloud a source's sync keeps what's left of the cap after the workspace's other sources (productRoom): the products already live first, so a tracked product stays tracked, then the new ones in the source's order. The rest aren't written; one in the catalog already is marked removed, as if gone from the source, and comes back when there's room. Nothing is deleted. - The source records how many it couldn't keep and the cap (last_counts overLimit / limit); Settings › Product catalog says so, with Upgrade for admins and managers. - A workspace without an active subscription gets the plan's own words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what AI says about a product, quoted from the answers that showed it (product visibility, part 13) ECOM-012, V1. A product's page gets a "What AI says" card: from the answers of the last 30 days whose cards showed the product, the sentence that names it (as Mentions quotes a brand: answerProse, mentionExcerpt), the latest first, one per text, and the sources those answers cited most. Their own words only: no AI of ours reads them, so no cost. Pros and cons drawn from them come later. - lib/shopping/ai-says.ts: productNames (each card title and its name before the variant), productQuote, productAiSays. - getProductAiSays reads the product's cards, then the latest 8 answers' text and the latest 20's citations; the page reads it apart and fills the card when it comes, so the heavy text doesn't hold the page. - mention-match: namesAny, the tracking match as a yes/no. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): cap a Google Merchant Center account's products by plan, as a feed's Merchant Center (#1270) reads through the workspace sign-in, a path of its own beside feeds and stores; the plan's product cap (productRoom) applies to it all the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): cap catalog products at 5,000 on Starter and 50,000 on Growth ECOM-019's caps were the spec's open-question defaults, 50 and 500: a real store's catalog went past them on the first sync. Decided on 2026-10-28: Starter 5,000, Growth 50,000; Enterprise stays set per customer through plan_overrides, and self-hosted uncapped (both -1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…ith a Shopping filter (Product Visibility, part 14) (#1649) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(catalog): cap a workspace's catalog products by plan, 50 / 500 / custom (product visibility, part 12) ECOM-019. Plans get maxCatalogProducts: Starter 50, Growth 500, Enterprise set per customer through plan_overrides, self-hosted no cap; counted across the workspace's brands, like prompts. - On the managed cloud a source's sync keeps what's left of the cap after the workspace's other sources (productRoom): the products already live first, so a tracked product stays tracked, then the new ones in the source's order. The rest aren't written; one in the catalog already is marked removed, as if gone from the source, and comes back when there's room. Nothing is deleted. - The source records how many it couldn't keep and the cap (last_counts overLimit / limit); Settings › Product catalog says so, with Upgrade for admins and managers. - A workspace without an active subscription gets the plan's own words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what AI says about a product, quoted from the answers that showed it (product visibility, part 13) ECOM-012, V1. A product's page gets a "What AI says" card: from the answers of the last 30 days whose cards showed the product, the sentence that names it (as Mentions quotes a brand: answerProse, mentionExcerpt), the latest first, one per text, and the sources those answers cited most. Their own words only: no AI of ours reads them, so no cost. Pros and cons drawn from them come later. - lib/shopping/ai-says.ts: productNames (each card title and its name before the variant), productQuote, productAiSays. - getProductAiSays reads the product's cards, then the latest 8 answers' text and the latest 20's citations; the page reads it apart and fills the card when it comes, so the heavy text doesn't hold the page. - mention-match: namesAny, the tracking match as a yes/no. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(prompts): suggest shopping questions from the brand's catalog, with a Shopping filter (product visibility, part 14) ECOM-003. A suggestion refresh now also offers the model the brand's catalog categories, each with its live products and price band (the round price most of them sell under), and asks for at least 5 shopping questions from them: best-of, under a budget, for a use, which type. One that names an offered category is kept with source 'catalog' and the category in source_data; a category the catalog never offered stays a plain suggestion. Brands without a catalog get the same prompt as before. - server/src/lib/catalog-suggestions.js: composeCatalogCandidates, roundPrice; any read failure returns [] so a refresh never fails on it. - 00362: 'catalog' in prompt_suggestions_source_check; schema.sql rebuilt. - Prompt Suggestions: a "Your catalog" badge with the category on hover, and a Shopping source filter once the catalog gave a suggestion (or ?source=shopping); "Ansvisor Agents only" leaves them out. - docs/guides/prompts.mdx: the fourth source. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): cap a Google Merchant Center account's products by plan, as a feed's Merchant Center (#1270) reads through the workspace sign-in, a path of its own beside feeds and stores; the plan's product cap (productRoom) applies to it all the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): cap catalog products at 5,000 on Starter and 50,000 on Growth ECOM-019's caps were the spec's open-question defaults, 50 and 500: a real store's catalog went past them on the first sync. Decided on 2026-10-28: Starter 5,000, Growth 50,000; Enterprise stays set per customer through plan_overrides, and self-hosted uncapped (both -1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…der parallel syncs, and count suggestion categories in SQL (Product Visibility follow-ups, part 1) (#1665) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(catalog): cap a workspace's catalog products by plan, 50 / 500 / custom (product visibility, part 12) ECOM-019. Plans get maxCatalogProducts: Starter 50, Growth 500, Enterprise set per customer through plan_overrides, self-hosted no cap; counted across the workspace's brands, like prompts. - On the managed cloud a source's sync keeps what's left of the cap after the workspace's other sources (productRoom): the products already live first, so a tracked product stays tracked, then the new ones in the source's order. The rest aren't written; one in the catalog already is marked removed, as if gone from the source, and comes back when there's room. Nothing is deleted. - The source records how many it couldn't keep and the cap (last_counts overLimit / limit); Settings › Product catalog says so, with Upgrade for admins and managers. - A workspace without an active subscription gets the plan's own words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what AI says about a product, quoted from the answers that showed it (product visibility, part 13) ECOM-012, V1. A product's page gets a "What AI says" card: from the answers of the last 30 days whose cards showed the product, the sentence that names it (as Mentions quotes a brand: answerProse, mentionExcerpt), the latest first, one per text, and the sources those answers cited most. Their own words only: no AI of ours reads them, so no cost. Pros and cons drawn from them come later. - lib/shopping/ai-says.ts: productNames (each card title and its name before the variant), productQuote, productAiSays. - getProductAiSays reads the product's cards, then the latest 8 answers' text and the latest 20's citations; the page reads it apart and fills the card when it comes, so the heavy text doesn't hold the page. - mention-match: namesAny, the tracking match as a yes/no. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(prompts): suggest shopping questions from the brand's catalog, with a Shopping filter (product visibility, part 14) ECOM-003. A suggestion refresh now also offers the model the brand's catalog categories, each with its live products and price band (the round price most of them sell under), and asks for at least 5 shopping questions from them: best-of, under a budget, for a use, which type. One that names an offered category is kept with source 'catalog' and the category in source_data; a category the catalog never offered stays a plain suggestion. Brands without a catalog get the same prompt as before. - server/src/lib/catalog-suggestions.js: composeCatalogCandidates, roundPrice; any read failure returns [] so a refresh never fails on it. - 00362: 'catalog' in prompt_suggestions_source_check; schema.sql rebuilt. - Prompt Suggestions: a "Your catalog" badge with the category on hover, and a Shopping source filter once the catalog gave a suggestion (or ?source=shopping); "Ansvisor Agents only" leaves them out. - docs/guides/prompts.mdx: the fourth source. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): cap a Google Merchant Center account's products by plan, as a feed's Merchant Center (#1270) reads through the workspace sign-in, a path of its own beside feeds and stores; the plan's product cap (productRoom) applies to it all the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): cap catalog products at 5,000 on Starter and 50,000 on Growth ECOM-019's caps were the spec's open-question defaults, 50 and 500: a real store's catalog went past them on the first sync. Decided on 2026-10-28: Starter 5,000, Growth 50,000; Enterprise stays set per customer through plan_overrides, and self-hosted uncapped (both -1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): match a brand's shopping cards right after a sync the person asked for A catalog connected, synced from Settings or uploaded had its brand's AI shopping cards matched only by the next day's sweep, so the Shelf showed "Products on the shelf" at 0 for a day. After such a sync reads the catalog, matchBrandLater matches the brand's recent cards in the background: never waited on, a failure logged, and a brand being matched already matched once more after instead of twice at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): write a workspace's capped catalog sources one at a time Two sources of one workspace synced at once (a sync from Settings while the daily run reads another store) each counted the room the other was about to take, and could keep more products than the plan's cap. On the managed cloud the room count and the writes now wait in a line per organization (inLine); the store or feed read itself doesn't. The comment explains how products marked removed past the cap meet the 90-day purge. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(prompts): count catalog categories for shopping suggestions in the database Shopping prompt suggestions read every live product, category link and variant of the brand's catalog, a page at a time, to offer 8 categories, and cut the categories at an arbitrary 1,000. 00371 adds catalog_suggestion_categories, which counts each category's live products and its price band in SQL and returns only the categories offered; the server rounds the 75th-percentile price as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): keep uncapped workspaces out of the write line, and stop waiting for a stuck write Every cloud workspace's catalog writes waited in its line, even on a plan without a cap, where there is no room to count; and a write that never finished held its workspace's line for good. The cap is now read first, and only a capped workspace's sources wait in line. A write waits five minutes at most (LINE_WAIT_MS) for the one before it, then runs anyway, recounting its room on its turn, and the stopped wait is logged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(prompts): read only the brand's live products when counting its suggestion categories catalog_suggestion_categories (00371) joined a category link to its product by id alone, so the live-product filter couldn't use catalog_products_brand_live_idx. The join now names the brand too. schema.sql is rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. * perf(prompts): read only the brand's live variants when pricing its suggestion categories (00371) The variants half of 00371's read now filters by brand and live rows, as the products half does, so catalog_variants_brand_live_idx (00281) serves it rather than every brand's variants. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…rom every channel, and leave an unknown check out of the score (Product Visibility follow-ups, part 2) (#1666) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(catalog): cap a workspace's catalog products by plan, 50 / 500 / custom (product visibility, part 12) ECOM-019. Plans get maxCatalogProducts: Starter 50, Growth 500, Enterprise set per customer through plan_overrides, self-hosted no cap; counted across the workspace's brands, like prompts. - On the managed cloud a source's sync keeps what's left of the cap after the workspace's other sources (productRoom): the products already live first, so a tracked product stays tracked, then the new ones in the source's order. The rest aren't written; one in the catalog already is marked removed, as if gone from the source, and comes back when there's room. Nothing is deleted. - The source records how many it couldn't keep and the cap (last_counts overLimit / limit); Settings › Product catalog says so, with Upgrade for admins and managers. - A workspace without an active subscription gets the plan's own words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what AI says about a product, quoted from the answers that showed it (product visibility, part 13) ECOM-012, V1. A product's page gets a "What AI says" card: from the answers of the last 30 days whose cards showed the product, the sentence that names it (as Mentions quotes a brand: answerProse, mentionExcerpt), the latest first, one per text, and the sources those answers cited most. Their own words only: no AI of ours reads them, so no cost. Pros and cons drawn from them come later. - lib/shopping/ai-says.ts: productNames (each card title and its name before the variant), productQuote, productAiSays. - getProductAiSays reads the product's cards, then the latest 8 answers' text and the latest 20's citations; the page reads it apart and fills the card when it comes, so the heavy text doesn't hold the page. - mention-match: namesAny, the tracking match as a yes/no. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(prompts): suggest shopping questions from the brand's catalog, with a Shopping filter (product visibility, part 14) ECOM-003. A suggestion refresh now also offers the model the brand's catalog categories, each with its live products and price band (the round price most of them sell under), and asks for at least 5 shopping questions from them: best-of, under a budget, for a use, which type. One that names an offered category is kept with source 'catalog' and the category in source_data; a category the catalog never offered stays a plain suggestion. Brands without a catalog get the same prompt as before. - server/src/lib/catalog-suggestions.js: composeCatalogCandidates, roundPrice; any read failure returns [] so a refresh never fails on it. - 00362: 'catalog' in prompt_suggestions_source_check; schema.sql rebuilt. - Prompt Suggestions: a "Your catalog" badge with the category on hover, and a Shopping source filter once the catalog gave a suggestion (or ?source=shopping); "Ansvisor Agents only" leaves them out. - docs/guides/prompts.mdx: the fourth source. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): cap a Google Merchant Center account's products by plan, as a feed's Merchant Center (#1270) reads through the workspace sign-in, a path of its own beside feeds and stores; the plan's product cap (productRoom) applies to it all the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): cap catalog products at 5,000 on Starter and 50,000 on Growth ECOM-019's caps were the spec's open-question defaults, 50 and 500: a real store's catalog went past them on the first sync. Decided on 2026-10-28: Starter 5,000, Growth 50,000; Enterprise stays set per customer through plan_overrides, and self-hosted uncapped (both -1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): match a brand's shopping cards right after a sync the person asked for A catalog connected, synced from Settings or uploaded had its brand's AI shopping cards matched only by the next day's sweep, so the Shelf showed "Products on the shelf" at 0 for a day. After such a sync reads the catalog, matchBrandLater matches the brand's recent cards in the background: never waited on, a failure logged, and a brand being matched already matched once more after instead of twice at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): write a workspace's capped catalog sources one at a time Two sources of one workspace synced at once (a sync from Settings while the daily run reads another store) each counted the room the other was about to take, and could keep more products than the plan's cap. On the managed cloud the room count and the writes now wait in a line per organization (inLine); the store or feed read itself doesn't. The comment explains how products marked removed past the cap meet the 90-day purge. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(prompts): count catalog categories for shopping suggestions in the database Shopping prompt suggestions read every live product, category link and variant of the brand's catalog, a page at a time, to offer 8 categories, and cut the categories at an arbitrary 1,000. 00371 adds catalog_suggestion_categories, which counts each category's live products and its price band in SQL and returns only the categories offered; the server rounds the 75th-percentile price as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): leave the first-40-words check out of readiness when a product has no type Shopify often leaves product_type empty, and a product with neither a type nor a category failed "what the product is in the first 40 words" for want of a word to look for. Its readiness now counts that check as unknown: left out of the score (out of the other checks' points), said apart in the Products tooltip and on the product page, not counted in Readiness's First 40 words check, which is unknown when no product has a type. An empty type falls back to the category as a missing one did. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): recover the Shelf from a failed read, and read Readiness's channels from every channel - Shelf: a read that failed left its numbers and rows on a skeleton for good. It now says so with a Try again button that reads it again. - The orders from AI visits are kept by brand: switching brands no longer shows the last brand's AI revenue while the new one's are read; the revenue and top-channel numbers wait for them instead. - Readiness: the channel cards read every channel's shelves whatever channel the Shelf's chips picked, so a card no longer says "Tracked, yours not shown" because another channel was chosen. They wait while read, and say "Couldn't read" when they couldn't be. - The price bands are named in the shelves' own currency ("Under €50"), a cut KPI value shows whole on hover, and a long channel name wraps in a narrow Readiness card. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): keep uncapped workspaces out of the write line, and stop waiting for a stuck write Every cloud workspace's catalog writes waited in its line, even on a plan without a cap, where there is no room to count; and a write that never finished held its workspace's line for good. The cap is now read first, and only a capped workspace's sources wait in line. A write waits five minutes at most (LINE_WAIT_MS) for the one before it, then runs anyway, recounting its room on its turn, and the stopped wait is logged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(prompts): read only the brand's live products when counting its suggestion categories catalog_suggestion_categories (00371) joined a category link to its product by id alone, so the live-product filter couldn't use catalog_products_brand_live_idx. The join now names the brand too. schema.sql is rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. * perf(prompts): read only the brand's live variants when pricing its suggestion categories (00371) The variants half of 00371's read now filters by brand and live rows, as the products half does, so catalog_variants_brand_live_idx (00281) serves it rather than every brand's variants. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
gkhngyk
added a commit
that referenced
this pull request
Oct 28, 2026
…e, and an honest 7-day re-check (Product Visibility follow-ups, part 3) (#1667) * feat(shopping): open Product Visibility with its data sources, a Why popup and the Shelf and Products tabs (product visibility, part 1) The first step to the Products screens in Drive › E-commerce (ECOM-spec, ECOM-mockup): the page says what it's for, "Which of your products AI recommends, why, and what it sells.", with "Why Ansvisor Product Visibility?" beside the title. That opens the four steps from the AI shelf to the sale, and offers Connect Google Analytics while GA isn't connected (ECOM-010). Under the title, the data sources (ECOM-009), as on AI Traffic: - the product catalog (its products and last sync, Manage, or Connect); - Google Analytics and Search Console, each with what it adds here; - a Marketplaces & feeds row: Merchant Center connects as a catalog source, and the marketplaces show Soon until they have a connector. The tabs read Shelf, Prompts, Products and Competitors, the one open in the URL (?tab=products). The sidebar item is new. AI Traffic's Google source card is shared, with an optional line for while it isn't connected. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): match each AI shopping card to the brand's catalog product it shows (product visibility, part 2) Product Visibility's Shelf, Products and Categories (ECOM-005…008) count a brand's products on the AI shelf, so each product card that is the brand's own now records which catalog product it shows (prompt_result_shopping_cards.catalog_product_id, and catalog_match for how it was found; 00360). lib/catalog/card-match.js matches in order: - by the marketplace listing a card links (ASIN, eBay item id), to a variant's marketplace_item_id; - by a GTIN the card carries, without its padding; - by its link, to a product's or variant's page, with or without its query; - else by its title: at least 0.6 of the words in common (Dice) and 0.1 clear of the next product, the brand's name and filler words aside. A key two products share matches neither. Cards are matched as they're written, against the brand's catalog read at most every 10 minutes. If the catalog can't be read, the cards go in without matches. If the API runs before 00360, they go in without the new columns rather than not at all. After the daily catalog sweep, each brand whose catalog synced in the last day has its own cards of the last 90 days matched again. Only the matches that changed are written, 500 a call, through set_shopping_card_matches (service role only). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show the AI shelf for each shopping question, with the brand's place and its sales from AI (product visibility, part 3) The Shelf tab (ECOM-006, Drive › E-commerce › ECOM-mockup) is Product Visibility's overview now. Four numbers: - AI shelf share: the brand's share of the product slots in AI answers; - Products on the shelf: its catalog products shown (00360), "41 of 320", else distinct titles; - AI revenue · 30d: orders from AI visits and their value against the 30 days before, from the tracking snippet and the Shopify pixel (ai_traffic_events). Without a source, "Connect to see sales" links to AI Traffic; - Top AI channel: by AI orders, else by the brand's slots. Then where AI sends shoppers and resellers cheaper than the brand, as before. Then one row per shopping question and channel: its latest shelf in order, with photos, prices, ratings and merchant icons. The brand's products are ringed ("2 · You", "via Amazon"), and each row says "You: #2 · 1 of 2 shelves this week" or "You're not on this shelf". The shelves the brand isn't on come first. Filters: - channel chips, which set the page's platform filter; - a price band, from the shelf's middle price. The platform card rate and trend charts stay below, under Trends. The old KPI row and the Card-eligible prompts tab give way to the Shelf. The Shelf reads on its own, so a failure there leaves the other tabs working and says so. ChatGPT Shopping gets its name in the platform labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): list the catalog's products with their AI shelf, visits, orders and readiness (product visibility, part 4) The Products tab (ECOM-007) lists the brand's catalog when it has one. Each product shows: - its photo, category and price; - the AI shelves it was on, its win rate (#1 or #2) and average place over the filter window, from its matched cards (00360); - the AI visits its page got; - the orders those visits led to, and their revenue; - its readiness out of 100. Visits and orders come from catalog_product_ai_stats (00361). No source carries order line items yet (Shopify order sync, #1267), so an order is credited to the product whose page the AI visitor landed on first (ai_traffic_events.first_url). A product's page is its link, else its first variant's, matched by path. Members of the brand's organization only. Readiness adds up what the catalog can tell: - a GTIN (20); - a photo (15); - in stock (15); - a price (10); - a description of 25 words or more (15); - what the product is, in its first 40 words (10, ECOM-024); - a category (10); - a brand (5). Its tip says what's missing and what each costs. Views: All, Never shown, Shown not clicked, Clicked not bought, and Top sellers from AI, each with its count. The table reads up to 2,000 products and says so past that. A brand with no catalog, or one that can't be read, keeps the products AI showed by title, with a line on connecting the catalog. Prices format in one place (lib/shopping/price.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show each catalog category's AI shelf share, products on it, top rival and AI revenue (product visibility, part 5) The Categories tab (ECOM-008, between Shelf and Products) lists each category of the brand's catalog that has live products, with: - its shopping questions: a question is the category's when the category's own name is in it (its last level, plural or not: "Hiking backpacks" in "lightweight 30L hiking backpack for women"), or when one of its products was on the question's shelf (00360); - the brand's share of the product slots on those shelves, with a bar; - its products on a shelf, of its products; - the rival with the most slots there: the competitor a card is matched to, else the card's brand, with its favicon; - its products' AI revenue in their main currency (00361). A category with three questions or more where the brand holds under 10% of the slots is marked "needs attention", tinted amber. The tab reads when it opens, once per brand and filters, and shows its count. It also says when the catalog has no categories, or when they can't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): give each product a page with where it shows and why AI picked another one (product visibility, part 6) Each product in the Products table now opens its own page, /dashboard/shopping/products/[id] (ECOM-011, the mockup's product detail). Header: its photo, price, category, "On N of M shelves", its readiness, and "View product page". Below it, its AI clicks, AI orders and AI revenue over 30 days (00361). "Why not your product?": for the most relevant question whose shelf it isn't on (else the one it ranks lowest on), it stands beside the product AI put first, row by row: - match with the question: both BM25 scores (#1487's), over its title and its description's first 40 words, with the missing words; - price: close, or how much higher or lower; - rating and reviews, as the answers showed them; - what it is, in its first 40 words; - GTIN, photo and stock in the feed; - who sells each. Each row is marked ✓ matches, ✕ missing, ↓ weaker, or — just what each has. Rows we have no data for (delivery, returns, schema) are left out rather than guessed. "Where it shows": the questions it belongs on (its category's name in them, the shelves it was on, or a match of 40 or more), each channel's latest shelf, its place, its match and the missing words. Then its readiness, check by check. The view is its own component (_product-detail.tsx). Reading the catalog's products is shared with the Products table. The plan's locked note now says what Growth unlocks here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): send a product or a category to the Action Center with the work that gets it on the AI shelf (product visibility, part 7) ECOM-013, the mockup's "Actions to get on the shelf" and "Category actions". A product's page lists its proposed work, from what it misses beside the shelf's winner: - Optimize page: rewrite it for the missing words; - Create content: a comparison with the winner and an FAQ, else a buying guide; - Get listed: the review sites AI quotes; - Technical: GTIN and structured data. The Categories table's "Plan actions" (filled on a category that needs attention) opens the same for the category: the category page, a buying guide, the "best X" lists, and its feed fields. Each line is picked or not and set to Me or Agent. The agent can't take a technical fix. "Send N actions to Action Center" opens one action with a toast that links to it; a second send returns the action still open. Server, POST /api/action-center/products (lib/action-center/ from-products.js): - a 'shopping_product' (Growth) or 'shopping_category' (Compete) action, one open per product or category; - tasks from the library: optimize_content; create_content_brief + create_content_draft; prepare_outreach + execute_outreach; fix_structured_data. Each task's mode follows Me or Agent where the task allows it, and the line becomes its why; - the payload keeps the brand's own questions only. It's measured on them and the product's page (basket metrics), with its own priority subject. The web knows both kinds' titles ("Get Ridge 30L Backpack on the shelf", "Win “Hiking backpacks” in AI answers"). A category row keeps its questions' ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): score how ready the shop is for AI shopping, channel by channel and check by check (product visibility, part 8) The Readiness tab (ECOM-015, spec §3.4 / §3.4b, the mockup's Readiness): - the market and what it means for ChatGPT: OpenAI's product index in the US, Google Shopping in Europe; - one card per AI shopping channel (ChatGPT Shopping, Google AI Overviews, AI Mode, Gemini, Copilot): whether it shows the brand's products, has its shelves tracked without them, or isn't tracked, and where it takes products from; - "AI shopping readiness" scored 0–100. The checklist lists only what Ansvisor can read: - the catalog, and the Merchant Center feed (a fail in Europe, where it decides ChatGPT too); - in the US, OpenAI's product index, and the verified seller flag as unknown, not scored; - descriptions that don't say what the product is in their first 40 words; - feed fields complete (GTIN, photo, price, brand, category); - feed links tagged utm_medium=feed; - a price an AI answer shows more than 2% off the catalog's, with an example; - resellers cheaper than the brand; - Amazon's share falling sharply. Product page schema, return policies, AI bots on product pages and colors as separate items aren't listed until there's data for them. Each check says where its fix starts: the Products table, or Settings › Integrations. OpenAI's product index card, with its direct-feed switch, moves from Shelf to here. The Products read keeps the prices AI answers showed for each matched product, for the wrong price check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(action-center): list the actions sent from Products with a From Products chip (product visibility, part 9) The ECOM mockup's Action Center preview: a "From Products" chip beside the categories, for the actions Product Visibility sends (part 7): a product to get on the AI shelf ('shopping_product', Growth) and a category to win ('shopping_category', Compete). They sit in different categories, so no category filter shows them together. - The chip shows with its count when the brand has such an action, and filters the list (and its CSV export) to them, whatever the category; a second click clears it. - It lives in the URL (?from=products) with the page's other filters. - FROM_PRODUCTS_KINDS in lib/action-center/registry.ts names the kinds. The action-center guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): offer "Why not you?" on a shelf the brand isn't on, and open the product on that shelf (product visibility, part 10) The mockup's Shelf: "When you're absent, your product shows greyed with 'Why not you? ›', which opens the product detail." - On a shelf the brand isn't on, its product the question asks for most shows greyed after the shelf's own cards (the last of six gives way): whyNotYou in lib/shopping/shelf.ts scores the catalog's products by the question's words in their title, category and type, the readier one on a tie, none when nothing shares a word. Read from the Products table's rows, which load with the Shelf: no new read. - "Why not you? ›" opens the product's page on that shelf (?prompt=…&platform=…): getShoppingProductDetail takes the shelf asked for, keeps its question whatever its match (productShelves' include) and explains it first (focusShelf's prefer), beside the product AI picked there. Without one, or when the brand leads it, the page explains its usual shelf. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what a done Products action did, 7 days on, on the product and its category (product visibility, part 11) ECOM-018. Once an action sent from Products is completed, the product's page and the Categories table set the shelves of its shopping questions in the 7 days after it was done beside the 7 days before: how many the product (or, for a category, any of the brand's products) was on. Read from the cards already kept when the page opens: no job, nothing stored. - lib/shopping/recheck.ts: shelfPresence, actionResult, resultTrend. - getShoppingProductDetail reads the product's last done action beside the rest; one that can't be read leaves the page as it is. - getShoppingActionResults: the categories' results, read after the table. - Product page: an "After action #N" card with Open the action; the Categories table: a line under the category's name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(catalog): cap a workspace's catalog products by plan, 50 / 500 / custom (product visibility, part 12) ECOM-019. Plans get maxCatalogProducts: Starter 50, Growth 500, Enterprise set per customer through plan_overrides, self-hosted no cap; counted across the workspace's brands, like prompts. - On the managed cloud a source's sync keeps what's left of the cap after the workspace's other sources (productRoom): the products already live first, so a tracked product stays tracked, then the new ones in the source's order. The rest aren't written; one in the catalog already is marked removed, as if gone from the source, and comes back when there's room. Nothing is deleted. - The source records how many it couldn't keep and the cap (last_counts overLimit / limit); Settings › Product catalog says so, with Upgrade for admins and managers. - A workspace without an active subscription gets the plan's own words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(shopping): show what AI says about a product, quoted from the answers that showed it (product visibility, part 13) ECOM-012, V1. A product's page gets a "What AI says" card: from the answers of the last 30 days whose cards showed the product, the sentence that names it (as Mentions quotes a brand: answerProse, mentionExcerpt), the latest first, one per text, and the sources those answers cited most. Their own words only: no AI of ours reads them, so no cost. Pros and cons drawn from them come later. - lib/shopping/ai-says.ts: productNames (each card title and its name before the variant), productQuote, productAiSays. - getProductAiSays reads the product's cards, then the latest 8 answers' text and the latest 20's citations; the page reads it apart and fills the card when it comes, so the heavy text doesn't hold the page. - mention-match: namesAny, the tracking match as a yes/no. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(prompts): suggest shopping questions from the brand's catalog, with a Shopping filter (product visibility, part 14) ECOM-003. A suggestion refresh now also offers the model the brand's catalog categories, each with its live products and price band (the round price most of them sell under), and asks for at least 5 shopping questions from them: best-of, under a budget, for a use, which type. One that names an offered category is kept with source 'catalog' and the category in source_data; a category the catalog never offered stays a plain suggestion. Brands without a catalog get the same prompt as before. - server/src/lib/catalog-suggestions.js: composeCatalogCandidates, roundPrice; any read failure returns [] so a refresh never fails on it. - 00362: 'catalog' in prompt_suggestions_source_check; schema.sql rebuilt. - Prompt Suggestions: a "Your catalog" badge with the category on hover, and a Shopping source filter once the catalog gave a suggestion (or ?source=shopping); "Ansvisor Agents only" leaves them out. - docs/guides/prompts.mdx: the fourth source. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a re-check's cards a hundred question ids at a time The categories' re-check could filter one card read by up to 400 question ids, a request address long enough to be refused. Reads now take 100 ids each, side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): index a shopping card's catalog product by itself, for a product's delete (00360) `on delete set null` looks up a deleted catalog product's cards by the product alone, which the (brand_id, catalog_product_id) index can't serve: each delete would scan the cards. A partial index on catalog_product_id covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): match a big catalog's cards without holding the event loop, and read every GTIN key in the sweep A 50,000-product catalog took about 90 s to match 20,000 cards, in one synchronous run. Now about 1 s, the longest hold under 70 ms: - A word in more than 5% of the titles (and more than 500) finds no products to compare; it still counts in a title's score. A title of common words only is found by its rarest one. A product not compared can't come within the margin of the best: when one could (it would share only the card's common words), no title match is made. So every title match is one the full comparison makes too; a few it made are not. A catalog of 500 titles or fewer is matched exactly as before. - matchCards matches 500 cards at a time, with a turn of the event loop between (the bot-log parser's nextTurn). - The kept catalogs are capped at 200,000 products in all, not 50 brands; the brand read least recently goes first, and a read keeps a brand. - The daily sweep reads a card's GTIN under gtin, gtin13, gtin12, gtin14, ean and upc, as matching at write time does, not under gtin alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI visits, and list a big catalog's active products first (00361) catalog_product_ai_stats returned a row for every live product, so a catalog past 1000 products lost the rest to PostgREST's max_rows, and the Products table read at most the first 2000 products by id, with every variant of the catalog. - 00361 returns only the products with an AI visit or an order, and takes p_product_id for one product's row. The table reads it a page at a time (readAllRpcRows, by product_id). - Past 2000 products, the table lists those on a shelf or visited from AI first (orders, then shelves, then visits), then the rest by id. Their rows, variants, photos and categories are read for those ids, 100 at a time; a catalog of 2000 or fewer is read by the brand, as before. - All and Never shown count the whole catalog (the server's count), not the rows read; the note says which products the table holds. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the Products table only on its tab, and the Shelf apart from the rest Each filter change read the whole Products table with the page's other reads, and the Shelf's rows waited for all of them. - useKeyedRead: a read made once per brand and filters while it's wanted, an older answer dropped. The Shelf reads with it on its own; the Products table only while its tab is open, as Categories does. - The no-catalog view says what main's CatalogNote says (with its link to Settings), not a second line of its own: products.noCatalog goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read every product's AI revenue for the Categories table The Categories table read catalog_product_ai_stats in one request, so a catalog with more than 1000 products with AI visits or orders lost the rest of its revenue to PostgREST's max_rows. It reads the pages now, as the Products table does (readProductAiStats). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read a product's page for that product alone The product's page read every product's AI visits and orders to find its own, and lost it past the first 1000 rows. It asks catalog_product_ai_stats for its product only (p_product_id, 00361), and reads its catalog rows by its id. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): say each "Why not your product?" row's state in words, beside its icon The comparison's ✓, ✕, ↓ and – icons are hidden from screen readers, so the state they draw wasn't read at all. Each row now says it after its name ("Price, in place"; "GTIN in the feed, missing"), for a screen reader only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): send products to the Action Center on Product Visibility's plans only, and never as an action without tasks POST /api/action-center/products checked the brand but not the plan, and opened the action before planning its tasks. - The route asks for shopping_analytics (requireFeature), as the page does. - The tasks are planned before the action is inserted. Work none of whose tasks can be planned for the brand opens nothing: a 422 that says so, shown in the page's toast. - The other Action Center route tests' plan-guard mocks give requireFeature. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): name each Categories row's Plan actions button for its category Every row's button read "Plan actions", so a screen reader's list of buttons couldn't tell them apart. Each is labelled "Plan actions for Hiking backpacks", its visible text first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): flag a wrong price in AI answers only from each channel's latest answer, against every variant's price The Readiness "Wrong price in AI answers" check flagged any card in the window more than 2% off the product's lowest in-stock price: an older answer since corrected, or the price of another variant or before a sale, was flagged as wrong. - Only each channel's latest card counts (cards now carry when they were shown). - A price is wrong only when it's more than 2% off every variant's price and sale price in the same currency (CatalogProductRow.prices; without them, the product's price, as before). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): wait for the catalog in Readiness, and say what couldn't be read instead of changing the score Readiness scored at once, from whatever had been read: while the catalog sources or products were still loading, or after their read failed, the checks on them were dropped and the score changed without a word. - The products are read on the Readiness tab too. - The checklist and its score show a skeleton until the sources and the products are read. - A read that failed is said in a line above the checks, and the score isn't shown until it can be read. Merchant Center is "unknown", not "connect it", when the sources couldn't be read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(action-center): keep the From Products chip while its filter is on, to turn it off Opened from ?from=products with no action from Products left, the list was filtered to nothing and the chip that turns the filter off wasn't shown. The chip shows while it's on, with its count of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): read the catalog for the Shelf's "Why not you?" once per brand "Why not you?" took its product from the Products table, which now reads only on its tab: on the Shelf the card never showed. The Shelf reads the catalog's products itself, once per brand and not again on a filter change (the card needs the products, not the window's numbers), and without holding up the shelves. The table's own read is used when there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): start the "Why not you?" link's name with the words it shows Its aria-label ("Why isn't … on this shelf?") didn't contain its visible text, so voice control couldn't reach it by what it says. It reads "Why not you? Open … beside the product AI picked on this shelf". Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): cap a Google Merchant Center account's products by plan, as a feed's Merchant Center (#1270) reads through the workspace sign-in, a path of its own beside feeds and stores; the plan's product cap (productRoom) applies to it all the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): cap catalog products at 5,000 on Starter and 50,000 on Growth ECOM-019's caps were the spec's open-question defaults, 50 and 500: a real store's catalog went past them on the first sync. Decided on 2026-10-28: Starter 5,000, Growth 50,000; Enterprise stays set per customer through plan_overrides, and self-hosted uncapped (both -1). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): match a brand's shopping cards right after a sync the person asked for A catalog connected, synced from Settings or uploaded had its brand's AI shopping cards matched only by the next day's sweep, so the Shelf showed "Products on the shelf" at 0 for a day. After such a sync reads the catalog, matchBrandLater matches the brand's recent cards in the background: never waited on, a failure logged, and a brand being matched already matched once more after instead of twice at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): write a workspace's capped catalog sources one at a time Two sources of one workspace synced at once (a sync from Settings while the daily run reads another store) each counted the room the other was about to take, and could keep more products than the plan's cap. On the managed cloud the room count and the writes now wait in a line per organization (inLine); the store or feed read itself doesn't. The comment explains how products marked removed past the cap meet the 90-day purge. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(prompts): count catalog categories for shopping suggestions in the database Shopping prompt suggestions read every live product, category link and variant of the brand's catalog, a page at a time, to offer 8 categories, and cut the categories at an arbitrary 1,000. 00371 adds catalog_suggestion_categories, which counts each category's live products and its price band in SQL and returns only the categories offered; the server rounds the 75th-percentile price as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): leave the first-40-words check out of readiness when a product has no type Shopify often leaves product_type empty, and a product with neither a type nor a category failed "what the product is in the first 40 words" for want of a word to look for. Its readiness now counts that check as unknown: left out of the score (out of the other checks' points), said apart in the Products tooltip and on the product page, not counted in Readiness's First 40 words check, which is unknown when no product has a type. An empty type falls back to the category as a missing one did. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): recover the Shelf from a failed read, and read Readiness's channels from every channel - Shelf: a read that failed left its numbers and rows on a skeleton for good. It now says so with a Try again button that reads it again. - The orders from AI visits are kept by brand: switching brands no longer shows the last brand's AI revenue while the new one's are read; the revenue and top-channel numbers wait for them instead. - Readiness: the channel cards read every channel's shelves whatever channel the Shelf's chips picked, so a card no longer says "Tracked, yours not shown" because another channel was chosen. They wait while read, and say "Couldn't read" when they couldn't be. - The price bands are named in the shelves' own currency ("Under €50"), a cut KPI value shows whole on hover, and a long channel name wraps in a narrow Readiness card. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): offer "Why not you?" only for a product the question asks for "Best running shoes for men under $100" offered "Men's Best Seller Tee": one shared word was enough, and "best", "under" and the price counted. The question's asking words (best, top, under, cheap, …), numbers and single letters no longer count, and a product needs two of the question's words, or a category or type the question names. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): look for a product by its own name in "What AI says", not its brand's "The North Face | Borealis Backpack" was looked for as "The North Face", so any sentence about the brand was quoted as the product's. The product's brand (the catalog's and the cards') is now kept out of its names: a title part that is the brand is left out, a brand opening a part is cut off, and the brand alone is never a name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): read only a product's own questions on its page, never name its brand's own product the winner - "Why not your product?" named the shelf's first product the winner even when it was another of the brand's own; the winner is now the first rival above it, none when only the brand's own are. - An address with no product id in it says the product isn't in the catalog, not that the read failed. - A plan without Product Visibility reads nothing on the page. - The page read every card of the window with each answer's searches. It now reads the product's own cards, the brand's questions, then the shelves of up to 60 it may belong on (detailPrompts: asked for, shown on, of its category, sharing its words), and AI's searches only for each shelf's latest answer. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): re-check every question of a done action, and count a category's own products - The 7-day re-check read the first 400 questions of the actions it checked; it now reads them all, 100 ids a read, six reads at a time. - A category's shelves counted any of the brand's products; they now count the category's own (catalog_product_categories). - A week after with no answers read shows "not run in the 7 days after" in the Categories table instead of "x/y → 0/0". - A week before with no shelf read is "New: nothing to compare", not "On more of its shelves". Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(shopping): group a re-checked category's products once, not per action Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(catalog): keep uncapped workspaces out of the write line, and stop waiting for a stuck write Every cloud workspace's catalog writes waited in its line, even on a plan without a cap, where there is no room to count; and a write that never finished held its workspace's line for good. The cap is now read first, and only a capped workspace's sources wait in line. A write waits five minutes at most (LINE_WAIT_MS) for the one before it, then runs anyway, recounting its room on its turn, and the stopped wait is logged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(prompts): read only the brand's live products when counting its suggestion categories catalog_suggestion_categories (00371) joined a category link to its product by id alone, so the live-product filter couldn't use catalog_products_brand_live_idx. The join now names the brand too. schema.sql is rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): don't offer "Why not you?" for a product on who it's for alone A product whose category or type only said who it's for ("Clothing > Men", type "Men") counted as the category a question names: "best running shoes for men under $100" offered a "Men's Best Seller Tee". Words like men, women or kids no longer make a product a candidate, neither as its category or type nor toward the two shared words; they still break a tie between candidates. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shopping): don't compare a done action whose answers were too many to read The re-check reads its questions' cards newest first, up to CARD_MAX_ROWS per hundred questions. A read cut there dropped the oldest cards, the week before the action first, so a product on its shelves before read as "New: nothing to compare" or "On more of its shelves". An action with a question in a cut read is now partial: no trend, and its card and line say there were too many answers to compare. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(catalog): bound the work on a long card link or title when matching cards to the catalog A card's link has its trailing slashes cut by a walk back rather than an end-anchored regex, and a title match reads a card title's first 40 words (MAX_CARD_TITLE_WORDS): each word more was compared with every product it found. * perf(shopping): count each question's shelves once for the Categories table Each category added up its questions' cards by walking every card in the window again; a big catalog's categories, each in most questions, took seconds. The cards are now counted once per question (slots, the brand's, each rival's), and a category adds up its questions. The rows are the same. * fix(shopping): list a category's questions in the cards' order Counting each question's shelves once gathers a category's questions by name first, then by its products. Its promptIds are put back in the cards' order, so the first 50 sent to the Action Center are the same as before. * fix(shopping): send a category's first 50 questions and cut a long work line, as the Action Center route takes them A category with more than 50 shopping questions, or a work line over 500 characters (a long question or two long product titles), was refused whole by POST /api/action-center/products with a 400, so nothing was sent. The web now sends the first 50 questions and cuts the line at a word. * perf(prompts): read only the brand's live variants when pricing its suggestion categories (00371) The variants half of 00371's read now filters by brand and live rows, as the products half does, so catalog_variants_brand_live_idx (00281) serves it rather than every brand's variants. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
This was referenced Nov 1, 2026
Merged
10 of 13 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Nov 10, 2026
…, a starfield before the product
The owner's choice (2026-11-10): what moves on ansvisor.com now moves
behind the screens a new person sees before the product, and never on
their text, form or window.
Sign-up and sign-in: the landing page's CTA animation (AgentBackdrop, a
canvas). Prompt dots, and the grey "Ansvisor" agent with its pulse ring,
which wanders the side gutters and follows the pointer. It sends green
sparks to the dots near it; a won dot turns green and draws a faint line
to its engine's hub (ChatGPT, Gemini, Google AI Overviews, Google AI
Mode, Claude, Bing AI Mode, three on each side, labels drawn inward), and
now and then a green tag floats up ("+1 citation", "mentioned", "#1
answer", "cited", "+1 mention", "top 3", "New traffic", "New demand",
"+$ revenue"). The words are in en.json (auth.agent).
- Kept clear from the real layout: AuthShell marks the header's logo and
link, the headline, the card column, the footnote and the footer line
data-keep-clear; their boxes are measured, again on every resize (a
ResizeObserver on the frame and on each of them). No dot, hub, label,
tag or agent goes inside them; over them, the agent waits at the
nearest edge, and it fades across the column rather than through it.
Whatever a line draws there is cleared.
- Dots are seeded (the same layout every load), 420 at 1440x900 and more
or fewer with the page's area. DPR is capped at 2.
- It runs only while the tab is shown and the canvas is on screen, stops
on unmount, and does nothing on the server. With reduced motion it is
one still frame. Below xl (1280px) nothing is drawn: the gutters can't
hold the hubs and labels.
- Dark theme as in the mockup. The light theme uses the page's ink and
muted text, a deeper green (#22c55e), and a darker agent.
Forgot password, reset password, onboarding and the welcome page: the
landing page's starfield (StarBackdrop, server-rendered). Tiny round dots
(1.2-2.5px) and six four-point sparkles, white on dark (0.2-0.75) and grey
#8a8a8a on light (about two-thirds of that). Every sparkle and a third of
the dots twinkle slowly (3-6s, staggered); with reduced motion none do.
Seeded positions, as percentages of zones beside the column:
- Auth frame: both sides, 300px clear of the centre, under the header,
and the header's empty middle. 130 stars.
- Onboarding frame (the wizard and /dashboard/welcome): beside the
window, 20px clear of its widest edge (1024px), so the stars stay put
from step to step; a medium (768px) or narrow (576px) window shows the
bands between too. Above the blurred dashboard preview, under the
window. The right-hand zones stop 80px above the bottom, clear of Sign
out.
- Hidden below xl (1280px).
Both are aria-hidden and pointer-events: none, sit first in their frame
under the content, and are out of the layout's flow. The consent page
gets neither; dashboard pages neither. No new dependencies.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 14, 2026
gkhngyk
pushed a commit
that referenced
this pull request
Nov 21, 2026
…You (CP-06) The Tracked Competitors grid was in the order competitors were added, without the brand, so it took reading every card to see who leads. It now runs from the highest Visibility score to the lowest, each card with its rank (#1, #2…), and the brand's own card, "You", in its place; a tie puts the brand first. A brand named in fewer than 10 prompts in the period isn't ranked: it comes after, marked Low sample (D5, D8). Without scores the list keeps its order. Grouped by type, each group is ranked on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In webhook mode the worker was returning right after submission, so
the UI loading banner (driven by job status) disappeared within seconds
even though Cloro hadn't started returning real results yet. After
checkout/payment that meant the user landed on Insights and saw a
silent empty state instead of "Analyzing prompts...".
Now after submitting, the worker polls cloro_pending_tasks every 15s
for the brand and updates job.progress with the remaining count. Job
returns only when pending hits 0 or the 60-minute drain timeout fires.
This is cheap (single COUNT query, no Cloro calls) and preserves the
loading bar UX users had under the polling-mode worker.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]