Skip to content

feat(action-center): show where a signal happened, what changed and what it rests on - #1060

Merged
gkhngyk merged 26 commits into
ansvisor:mainfrom
cihan-gyk:feature/signal-detail-where
Oct 17, 2026
Merged

gkhngyk merged 26 commits into
ansvisor:mainfrom
cihan-gyk:feature/signal-detail-where

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Part one of AC-001 (Signal detail: where exactly). Stacked on #1059, which is stacked on #1058. Please review the third commit, feat(action-center): show where a signal happened, what changed and what it rests on, or merge those two first.

Today the signal drawer shows bare numbers: "What changed: 0 → 251 +167" for a source domain is really "answers naming you, answers citing it, answers naming only competitors". It also shows nothing about the prompt's platforms or location, the page, or the action the signal feeds. The drawer now has the spec's three fixed blocks.

Where

The fields AC-001 asks for, per category (lib/signals/detail.ts).

  • Citation lost: prompt (linked), topic, platforms and locations, your page cited before and cited now.
  • Citation opportunity: domain, example cited URLs, competitors it names, your best matching page.
  • Visibility: scope (all prompts / topic / platform / location / prompt), platforms, locations, prompts or queries.
  • Mention: prompts, platforms, position, sentiment, excerpt.
  • Traffic: URL or pages, engagement rank, AI referrals by platform, citable prompts.
  • Technical: pages, affected crawlers, failed checks.
  • Competitor: competitor, domain or topic, prompts, positions by prompt, sources behind their wins.

How fields are filled:

  • Not recorded yet: a field no detector records yet (e.g. the lost URL, positions by prompt) reads "Not available" rather than being hidden, as the spec asks. Recording them is server work, which comes as part two.
  • Tracked on / Tracked in: platforms and locations read from a signal's prompts are labelled this way. They say where the prompts are tracked, which can be wider than where the change happened. A platform or country the signal itself names keeps "Platforms" and "Locations".
  • Whole-brand and location signals say "All tracked platforms".

What changed

Every figure has a metric, whose or which window, a unit and the period. No unlabelled numbers remain.

  • Week over week: "Mention rate · previous 7 days 34% → Mention rate · last 7 days 18%, −16 pts", with the period "Last 7 days against the 7 days before".
  • Comparisons inside one window:
    • "Mention rate · United States (best) 22.5%" vs "Mention rate · Turkey 3.1%";
    • "Mentions · Profound" vs "Mentions · you";
    • a source domain's "Answers citing it · all / naming you / naming only competitors".
  • Colours: a fall in the brand's own numbers is red, and a competitor's rise is red too. The old drawer coloured by a per-kind flag that showed drops as good news ("−16" in green).
  • No figures: a signal whose row records none (e.g. a lost citation today) says "Not available".

Evidence and links

  • The page behind the signal:
    • the prompt's AI answers for a one-prompt signal;
    • the Prompts list for a multi-prompt one, whose prompts are each linked under Where;
    • otherwise the topic, Citations, Competitors, Traffic, Site Audit or Insights.
  • First and last detection.
  • Used by actions (spec §10): AC-4 · <action title>, linking to the action. It is read when the drawer opens.

MCP

list_signals (and its REST mirror) returns, beside each raw row:

  • where: snake_case keys, null when not recorded, platforms as {slug, name};
  • change: figures with metric, role, value, unit, subject, plus the period;
  • evidence: detection dates and app paths;
  • used_by_actions.

All of it comes from the same lib/signals/detail.ts the drawer uses.

  • A kind this build doesn't know still comes back as its raw row.
  • A failed actions read leaves used_by_actions empty rather than failing the call.

The tool description and docs/guides/mcp-server.mdx describe the new fields. The prompt places read moved to lib/signals/prompt-places.ts, shared by the page and MCP.

Review

I ran a code review before opening this. Fixed:

  • the inverted delta colour;
  • competitor topic signals losing their prompt count;
  • a multi-prompt signal linking only its first prompt's answers;
  • MCP failing on an actions read error;
  • "Platforms" reading as where the change happened, now "Tracked on";
  • "Not available" for whole-brand platforms;
  • duplicate list keys;
  • a hardcoded loading text;
  • no test of the MCP enrichment.

Left as is: list_signals reads the brand's prompts on each call to resolve places. It is cheap at current sizes.

Related issue

None. Product spec AC-001 (Action Center), part 1. Part 2 records the missing evidence (the lost URL, who is cited now, competitor positions) in the detectors.

Type of change

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

How to test

  1. Open Action Center → Signals and open a signal of each kind.
  2. Platform drop:
    • Where shows Scope: Platform, Platforms: Gemini.
    • What changed shows the two labelled windows and a red "−16 pts".
  3. Source domain ("Competitors win …"): the three labelled counts, and "Not available" for the competitor and positions.
  4. Lost citation:
    • the prompt with "View prompt", Tracked on and Tracked in;
    • "Not available" for the lost URL and who is cited now;
    • "View AI answers".
  5. A signal with an action: "Used by actions" links to it.
  6. MCP: call list_signals, and each signal has where, change, evidence, used_by_actions.
  7. Check light and dark mode, and 1024px.

Checklist

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

Also run:

  • yarn test: 595/595, new tests:
    • detail.test.ts: figures per kind, fields and "Not available", links, the API shape.
    • signal-detail-blocks.test.tsx: labels, colours, Where rows, the action link.
    • mcp/signals.test.ts: list_signals enrichment, unknown kinds, a failed actions read.
  • yarn build: passed.
  • In the browser:
    • drawers for a lost citation (linked to an action), a platform drop, a country gap and a source domain;
    • light and dark mode, 1440px and 1024px.

🤖 Generated with Claude Code

cihan-gyk and others added 3 commits October 15, 2026 14:20
…ls 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]>
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]>
…hat 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]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Part 1 of AC-001, stacked on #1059 and #1058 (please review the third commit or merge those first). The signal drawer now has Where / What changed / Evidence and links: every number is labelled with its metric, window and unit, fields no detector records yet say "Not available", and "Used by actions" links the action. MCP list_signals returns the same detail. Part 2 will record the missing evidence (lost URL, who is cited now, competitor positions) in the server detectors.

cihan-gyk and others added 5 commits October 16, 2026 20:04
…-where

main carries ansvisor#1058 and ansvisor#1059 as squashes, so their files come from main and this branch keeps only its own commit on top. The MCP data imports keep both main's prompt-usage helpers and this branch's signal helpers.
gkhngyk added a commit to cihan-gyk/ansvisor that referenced this pull request Oct 17, 2026
…-evidence

main carries ansvisor#1058 and ansvisor#1059 as squashes; this branch keeps ansvisor#1060's commit and its own on top.
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 17, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, approving. I merged main into the branch. With #1058 and #1059 squashed there, it keeps only its own commit on top, and mcp/data.ts keeps both main's prompt-usage imports and this branch's signal imports. CI is green, and the whole signals chain on top passes server (1343) and web tests.

@gkhngyk
gkhngyk merged commit 6960590 into ansvisor:main Oct 17, 2026
5 checks passed
gkhngyk added a commit to cihan-gyk/ansvisor that referenced this pull request Oct 17, 2026
…-evidence

main now carries ansvisor#1060 as a squash; the tree is unchanged.
gkhngyk added a commit that referenced this pull request Oct 17, 2026
* 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(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]>

* 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]>

* test(action-center): follow the merged signal changes in the AC-007 tests

#1060 moves updateSignalStatus to a list of signal ids (a group's copies
move together) and gives SignalWhere its topics; #1074's tests still called
it with one id and built where without topics. They now do as #1076's merge
of the same two stacks does.

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

* feat(action-center): list every action a signal was used by

A signal drawer's "Used by actions" and list_signals' used_by_actions read
the signal's action_id, its current action only. Once a signal outlived its
action and supported the next cycle's, the earlier action dropped out.

Both now read the signal's links in action_signals (AC-007): every action it
was used by, closed ones included. The current action leads, then the rest
by their latest link, and the drawer shows each action's status. list_signals
reads the links in chunks of 100 signals, so a full page stays within the
request line, and a failed read still costs used_by_actions only.

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants