Skip to content

feat(action-center): show each action's priority and work the list by it - #1072

Merged
gkhngyk merged 37 commits into
ansvisor:mainfrom
cihan-gyk:feature/action-priority-ui
Oct 17, 2026
Merged

gkhngyk merged 37 commits into
ansvisor:mainfrom
cihan-gyk:feature/action-priority-ui

Conversation

@cihan-gyk

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

Copy link
Copy Markdown
Collaborator

Summary

AC-006, part 2 of 2 (web and MCP). The score #1071 stores is now what the Action Center shows and sorts by, in place of action impact. Each list has a Priority Score column, filters and sorts by priority, and the drawers say why. Copy Data, the exports and MCP carry the score too.

Stacked on #1071 (which sits on #1070 and #1058). Please review this PR's two commits, or merge those first:

  1. feat(action-center): show each action's priority and work the list by it
  2. feat(action-center): use the priority score wherever actions showed impact

This PR reads the columns #1071 adds.

Spec: AC-006-priority-score.md and AC-spec-priority-score-signal-intelligence.md.

Why priority replaces impact

Impact is one of the score's seven factors (20 of 100 points). Showing both read as two answers to one question. A "Medium" impact next to an "84 High" priority looked like a contradiction, though it is the model working: a medium-impact loss on ground the brand held can matter as much as a high-impact gap. So wherever the Action Center showed an action's impact, it now shows its priority.

  • Signals keep their impact: they have no score, and the Signals tab, its filter, its card and the signal drawer are unchanged.
  • Impact stays as data: it is still a factor on the server, and still a field in the MCP responses.

Actions list

  • Priority Score column where Impact was: the score in a badge coloured by level (red critical, orange high, amber medium, grey low, each with a dark-theme colour) and the level's name, e.g. [84] High. Unscored actions show "—".
  • Sorted by priority by default: highest score first, unscored actions last, ties broken by impact. The Impact sort option is gone.
  • Priority filter (Critical / High / Medium / Low) replaces the Impact filter.
  • Top Actions counts the five highest-priority open actions (the spec's limit), and clicking it filters the list to them.
  • Highest Priority card replaces Potential Impact: the highest level among open actions.
  • The list's CSV has priority_score and priority_level instead of impact.

Action drawer

  • The header shows the priority, e.g. [84] High, where impact was.
  • "Why this priority?" opens the Overview with one sentence written from the stored facts, for example: Lost ground on 7 high-demand prompts 2 days ago — commercial intent, previously visible.
    • Every word and the punctuation come from en.json (actionsPage.priority.reason), so another language can reorder the sentence.
    • "2 days ago" is counted to today, not to the last scoring, so it stays true between nightly runs.
    • When nothing open supports the action any more, it says Its findings have resolved.
  • Copy Data and Export Excel say Priority: 84 (High) and give the sentence. They no longer list impact.

History

The same change on the History tab:

  • the Priority Score column;
  • the priority filter;
  • the Priority sort, which replaces the Impact sort;
  • the priority in the drawer's header.

An action still running is scored every night. A closed one keeps the score it last had.

MCP and the REST API

  • list_actions and get_action return priority: { score, level, reason }, or null before an action is scored.
  • ⚠️ list_actions now lists the highest priority first by default, unscored last, the order the app shows. This is a behaviour change for API clients. sort: "updated" (or GET /api/mcp/actions?sort=updated) gives the old order, most recently updated first. A client that polls for recent changes should add it.
  • docs/guides/mcp-server.mdx is updated.

Small moves

  • comparePriority moved from display.ts to the new lib/action-center/priority.ts, which holds the parsing, ordering, level helpers and sentence.
  • OPEN_ACTION_STATUSES now lives in registry.ts, so Top Actions and the other cards agree on what "open" means.
  • The History sort moved into compareHistory in lib/action-center/history.ts so it can be tested.
  • ACTION_IMPACTS and the unused actionsPage.impact messages are removed.

Review

I ran a code review on each commit.

First commit: five of six findings fixed.

  • "N days ago" was counted to the last scoring, not to today.
  • The sentence's punctuation was written in code, not in en.json.
  • A score whose stored level was unknown showed only "—". The level is now read from the score.
  • "Open" was defined in two places.
  • get_action's priority had no test.

One was left as is: an Improve action reads "Lost ground on 1 platform". It is scored from its platforms' states (#1071), so the platforms are what changed.

Second commit: three of five findings fixed.

  • The API's new default order was undocumented. It is now called out above and in the docs.
  • Copy Data had a dead fallback.
  • ACTION_IMPACTS was left unused.

Two were left as is:

  • History's topPriority: it is not shown yet. It took the place of topImpact, which was not shown either.
  • The page-level filter wiring: it has no test of its own. The helpers it calls are tested.

Related issue

None. Product spec AC-006 (Action Center), part 2.

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. Apply feat(action-center): score every action's priority on the server #1071's migration, 00144_action_priority_score.sql, and run a signal pass for a brand so its open actions are scored.
  2. Open Action Center → Actions:
    • There is no Impact column. Priority Score shows e.g. [84] High, and the list is sorted by it.
    • The Priority filter narrows the list by level.
    • Highest Priority shows the top level among open actions.
    • Top Actions shows at most 5; click it to filter to them.
  3. Open an action:
    • Its priority is in the header.
    • Why this priority? is the first section of Overview.
  4. Click Copy Data: the second line starts with Priority: 84 (High) · Category:, and a "Why this priority" line follows the tags. Do the same with Export Excel.
  5. Move an action to In progress and open History: it shows the Priority Score column, filter and sort, and its drawer shows the priority.
  6. Open Signals: Impact is unchanged there.
  7. Over MCP, call list_actions. The highest score comes first and each action carries priority. With sort: "updated", the most recently updated comes first.
  8. Switch to the dark theme and to a 1024px window: the badge colours and the columns still fit.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): no errors; the 7 warnings are in files this PR does not 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 and changed tests:
    • priority.test.ts:
      • ordering, with nulls last and ties by impact;
      • the top 5 open actions;
      • parsing the stored facts;
      • the evidence's age counted to today;
      • the level read from a score, or kept when stored;
      • the highest level for the cards;
      • the sentences.
    • history.test.ts: History's priority sort, with never-scored actions last, and the highest priority in range.
    • action-priority.test.ts (MCP): list_actions' priority, its default and updated orders, and get_action's priority.
    • export.test.ts and action-export-buttons.test.tsx: Priority: 84 (High) and the sentence in Copy Data and the workbook, with no impact line.
  • yarn build: passes.
  • In the browser: checked against the dev database's scored demo actions, in the light and dark themes:
    • the Actions list and drawer, at 1440px and 1024px;
    • History, at 1440px and 1024px, with a demo action set to In progress for the check and set back after;
    • the History drawer;
    • Signals, unchanged.

🤖 Generated with Claude Code

cihan-gyk and others added 4 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]>
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]>
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]>
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]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 15, 2026
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk this is ready for review. It's the second part of AC-006 (priority score), stacked on #1071 (the server scoring) and the PRs under it. Until those merge, this part is the last commit.

It puts the score to work in the Action Center: a Priority column beside Impact, priority as the default sort, Top Actions limited to the 5 highest, "Why this priority?" in the drawer, and the score in Copy Data, the exports and MCP.

Things to look at:

  • The column shows the score only. Impact already says High / Medium / Low, so the level (critical / high / medium / low) is in the tooltip and screen-reader text, not printed beside the score.
  • Impact and priority can disagree, by design. Impact is one of the seven factors (20 of 100 points). On the demo, a high-impact gap and a medium-impact loss both score 84: the loss is on ground the brand held before.
  • "Why this priority?" is written in the app from the facts feat(action-center): score every action's priority on the server #1071 stores. The words and punctuation are in en.json, and "N days ago" is counted to today.
  • MCP: list_actions and get_action return priority, and list_actions takes sort: "priority".

Code review (5 of 6 findings fixed, the other noted in the description). Web tests (592/592), lint, typecheck, format and build pass. Checked in the browser at 1440px and 1024px, light and dark.

…mpact

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]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk one more commit on this PR: use the priority score wherever actions showed impact.

The score already weighs impact in, and showing both read as a contradiction ("Medium" impact beside an "84 High" priority). So the Actions and History tabs now show a Priority Score column ([84] High) instead of Impact, filter and sort by priority, and Potential Impact became Highest Priority. The drawers, Copy Data and Excel follow. Signals keep their own impact; the server is unchanged.

One thing to look at: list_actions (MCP and REST) now lists the highest priority first by default. sort: "updated" gives the old order. It's called out in the description and the docs.

Web tests (595/595), lint, typecheck, format and build pass; checked in the browser in both themes at 1440px and 1024px.

cihan-gyk and others added 18 commits October 16, 2026 00:26
# Conflicts:
#	web/src/components/action-center/action-drawer.tsx
# Conflicts:
#	server/src/lib/action-center/from-prompt-improve.js
#	supabase/schema.sql
#	web/src/types/supabase.ts
…rity-ui

# Conflicts:
#	web/src/lib/actions/action-center.ts
#	web/src/lib/actions/action-history.ts
…ure/action-priority-score

# Conflicts:
#	supabase/schema.sql
…ure/action-priority-score

# Conflicts:
#	supabase/schema.sql
@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.

Reviewed. Merged main into the branch: the history select now reads priority_score and priority_level, and the drawer and history fixtures carry the priority fields in place of impact. Tested on the full Action Center chain.

@gkhngyk
gkhngyk merged commit 95be2f6 into ansvisor:main Oct 17, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants