Skip to content

feat(action-center): show what to do today, the Next 7 and what was done this week (AC-011) - #2146

Merged
gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/ac-011-today
Nov 5, 2026
Merged

gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/ac-011-today

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

AC-011, ROADMAP-plan §06 "One 'do this today' path" (Drive › Ansvisor Product Developments › Diğer › ROADMAP-plan.md), mockup ROADMAP-mockup.html screen 3.

This is the first of the AC-011 PRs. It adds the Today card, with Next 7 and Done this week: web code plus one read-only API route, and no migration. The owner chose this split and its ranking on 2026-11-05.

What the person sees (Action Center › Actions)

  • Today, at the top of the page: up to 3 open actions that are the person's or no one's yet. Each row has:
    • why it matters, with its number: the action's "Why this priority?" text, using the AC-009 counts;
    • its first step and page: the first open task that a person or an agent does, with its AC-010 exact page;
    • who does it, read-only:
      • Agent when the first open task's mode is agent;
      • Me when the action is assigned to the viewer;
      • Team when it is no one's yet;
    • Open, which opens the action's drawer.
  • The action the Inbox suggested to the person today comes first, labelled "Also today's suggestion in your Chat Inbox".
  • Next N, under the card: ranks 4–10 (Action, Category, Priority).
  • Done this week · N: the brand's actions completed since Monday 00:00 in the person's time zone, linked to History. The time zone is the one the person picked in Settings › Account, or else their browser's.
  • While Getting started runs and has steps ready, the card lists its next 3 ready steps instead, with nothing under it. Each step's Open opens its card.
  • The card never holds the page. It reads its order separately from the list, so a slow or failed read only hides the card. It reads again when an action's status, assignee or task count changes on the page.

One ranking, kept in one place (the owner's rule: no second copy of the formula)

  • The ranking function. The Inbox's daily suggestion (CHAT-26) ranks in server/src/lib/chat-suggestions/rules.js. That rule is now one exported function, rankActions, cut out of pickSuggestion with no change to the formula:

    • open actions only (new, in_progress), unassigned or the person's own;
    • the Priority Score, plus the queue's wait lift (scoreCandidate) and START_NOW_LIFT;
    • on a tie, older first, then by id.
  • The Inbox job. pickSuggestion calls rankActions with its Inbox-only skips, then applies variety, exactly as before. The skips are actions suggested in the last 14 days, removed or put off, or waiting in Needs you.

  • Shared reads. loadCandidates, loadStartNow and loadAnswerZones moved byte for byte from job.js to chat-suggestions/reads.js. The job and the Today card now rank the same rows.

  • New route GET /api/action-center/today?brandId= (lib/action-center/today.js), open to any role that can see the brand:

    • it ranks with rankActions;
    • it puts first that day's stored suggestion for the person, unless they removed it or put it off. The suggestion comes from chat_suggestions, read only where CHAT_AGENTIC is on;
    • it returns { today: [3], next: [7] }.

    "Today" is the day the job dates the suggestion in, with the same time-zone resolution.

  • Why a route rather than a shared module. Web and server share no code here. The existing pattern is a web "twin" checked against the server's fixtures, which would be a second copy. So the server ranks with the one function. The web only reads the order and adds what it shows (first step, who, and the week's count), read as the person under RLS in lib/actions/action-center-today.ts.

Help: a Today section in help/action-center/action-center-actions.md (about 140 words) and updated keywords. approved-articles.json is regenerated (yarn test -u src/lib/help).

Not in this PR

  • The other AC-011 parts, as later PRs:
    • other screens create or open the same action, with "Already in Action Center · Action #N · Open": Content Opportunities Send, Content Plan Create / Optimize, Prompt detail Improve, Site Audit Fix;
    • one row per page or prompt, with merged reasons;
    • the mockup's "Also suggested by" and "Where it came from" column.
  • The Agent work setting (the gear). The owner first dropped it, then asked for it after all. It is the next PR, stacked on this one (migration 00481).

Related issue

None. AC-011 (ROADMAP-plan §06), PR 1 of the owner's split of 2026-11-05.

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 (rankActions and reads.js, no change in behaviour)
  • test — Adding or updating tests

How to test

  1. Open Action Center › Actions on a brand with open actions.
    • Today shows up to three actions, best first, then Next and Done this week · N.
    • Complete one from the drawer: the card reads its order again, and that action leaves the card.
  2. Assign one of today's actions to a teammate: it leaves your Today, which only lists your actions and no one's. Assign one to yourself: its row says Me.
  3. With Chat on (CHAT_AGENTIC), the action in today's Inbox suggestion is fix(tracking): keep job active until webhook results drain #1, labelled "Also today's suggestion in your Chat Inbox". Click Not now or Remove on it in the Inbox, and it drops back to its rank.
  4. On a brand running Getting started with steps ready, the card lists the next three steps. Open opens the step's card.
  5. Tests:
    • server: cd server && npx vitest run src/lib/chat-suggestions src/lib/action-center/today.test.js src/routes/action-center-today.test.js
    • web: cd web && npx vitest run src/lib/action-center/today.test.ts src/components/action-center/today-card.test.tsx "src/app/[locale]/(dashboard)/dashboard/action-center/actions/page.test.tsx" src/lib/help

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change) — see help/README.md

Checks run locally on this branch, using CI's jobs:

  • web: format:check, lint, typecheck and build pass.
  • web yarn test: 988 of 989 files passed (10,578 tests, 1 skipped).
    • The failing file was the Actions page test: it couldn't load next-intl's navigation for Today's History link.
    • That is now stubbed (5196ae8). The page, Today and Help tests were rerun: 5 files, 58 tests pass.
  • server: format:check and lint pass.
  • server npm test: 418 of 421 files passed.
    • Three of the new today.test.js cases had wrong expectations (a time zone and a read count). They are fixed in 2d77c12.
    • Two timing tests ran over their wall-clock limits on a busy machine: content-agent "quickly" (467 ms against 400 ms) and content-people (242 ms against 150 ms). This PR touches neither.
    • The 14 affected files, those two included, were rerun: 285 tests pass.
  • supabase/build-schema.sh (no change) and version:check pass.
  • The branch still merges cleanly into current main.

Open questions for the owner

Please confirm these defaults:

  1. Me / Agent / Team is read-only, worked out from the assignee and the first open task's mode. Agent wins over Me when the first step is an agent's.
  2. Refresh is live. The card reads the stored scores when the page opens and whenever an action changes on it; there is no frozen 6:00 list.
  3. On hold actions are left out, as in the Inbox. Top Actions still counts them.
  4. While Getting started runs, the card shows only its next three ready steps, with no Next or Done this week. When no step is ready, it shows the actions.
  5. The candidate pool is the Inbox's: actions that are unassigned or the viewer's. A teammate's action never shows in your Today, so Team means "no one's yet".
  6. Before the morning suggestion goes out (07:00 in the person's time zone), fix(tracking): keep job active until webhook results drain #1 is simply the top of the ranking. It switches to the Inbox's pick once that suggestion is sent.
  7. The week starts on Monday, in the person's time zone.
  8. The row button says Open, not the mockup's Start. It opens the action, where Start, Run agent and Start now already are.
  9. The header says "ranked by Priority Score". The (i) next to it explains the small lifts for days waiting and for writing that "Start now" can open.

Generated by Claude Code

…one this week (AC-011)

The Today card at the top of Action Center › Actions (ROADMAP-plan §06,
mockup screen 3): up to three open actions that are the person's or no
one's yet, each with why it matters, its first step and page, and who does
it (Me / Agent / Team, read from the assignee and the first open task's
mode). Under it the Next 7 and "Done this week" (actions completed since
Monday in the person's time zone, linked to History). While Getting started
runs, the card lists its next three ready steps instead.

The order is the Inbox's daily suggestion ranking (CHAT-26), kept in one
place: rules.js rankActions, which pickSuggestion now uses too, over the
same reads (moved from job.js to chat-suggestions/reads.js). The new
GET /api/action-center/today ranks with it and puts today's suggestion for
the person first, unless they removed it or put it off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…Help reads them

A formatter had spread its keywords and synonyms over several lines, which
help/README.md's front matter doesn't allow and lib/help/articles.ts doesn't
read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…one this week" links to History

next-intl's navigation can't be loaded under vitest, so the page's tests
stub it, as the Action Center's other component tests do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…rday, and count the tables Today reads

At 09:30 UTC no zone is on tomorrow yet, so the zone test uses Pago Pago
(UTC−11), where it's still Oct 29. The open actions are read in two
queries (the unassigned ones and the person's own): the test now checks
that nothing but actions is read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9

@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.

LGTM.

@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.

LGTM. Non-blocking: the Today card keeps only ids found in the page's getActions list (unordered, limit 1000), so a brand past 1000 actions can lose ranked items silently. Returning the rows' fields from /today would avoid the join.

@gkhngyk
gkhngyk merged commit ed1c18a into ansvisor:main Nov 5, 2026
13 checks passed
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 5, 2026
Main brought ansvisor#2146, ansvisor#2148 and ansvisor#2149. help/chat/agents.md's front matter
keeps both keyword and synonym lists; approved-articles.json regenerated;
schema.sql rebuilt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
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.

3 participants