Repository navigation
feat(chat): show "For you now" on Chat Home, each job with its count (W2-05) - #1889
Conversation
…(W2-05) Chat Home's "For you now" (mockup #s-home .scut, CHAT-08 v2): Ask anything first, then the jobs with something to do, each with its count from the brand's data, then More, the composer's / menu. Complete tasks counts this week's Action Center tasks (it replaces the Action Center line), Win back citations the pages the open lost-citation signals name, Ready to publish the drafts marked ready. A chip starts a new chat with its words. Quality pass and Weekly report wait for their data (drafts' quality scores aren't kept; schedules come in Wave 3). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s' words (W2-05 review) The jobs ask in W2-04's skills' words: Complete tasks prepares the work and the person closes the tasks; Ready to publish checks the drafts, fills their page fields and sends them to the CMS as drafts, going live staying the person's click. Someone who can't change things (Analyst, Agency partner) gets the jobs that only read and no More, which their composer has no menu for; a job whose menu section an Admin hid isn't counted. One action reads the person once and the three counts together; the lost-citation pages are read a page of signals at a time, keyed as the server keys them. The chips get the focus ring, a named group, a spoken count and a hidden arrow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good as is, no fix needed.
What we checked
-
Chat off. The page answers
notFound()withoutCHAT_AGENTICor outsideCHAT_AGENTIC_ORGS.readHomeShortcutsreads the person's profile, then returns{ ok: false }before it reads the role menu or any count. A test covers signed out, Chat off, a bad brand id and a bad date. -
Whose counts. All four reads use the person's own session client, so RLS decides. The
actions,signalsandcontent_draftsselect policies all reach the brand throughbrandsjoined to the caller's profile. A brand of another organization counts 0. The brand-access work (00389 narrowsbrandsitself) carries over to these three policies without any change here. Someone with Selected brands will only get counts for their own brands. -
Counts match the pages they stand for.
- Complete tasks: the same query as the old Action Center line (
new/in_progress/on_hold, due by the end of the person's week). Theactionspolicy already leaves deleted ones out. - Ready to publish:
status = 'ready'and not archived. That's the same filter as the Library's Ready tab (libraryTabCounts/countLibraryTabs). - Win back: the distinct pages named in the open (
new,acknowledged) lost-citation signals' evidence. Those are the pages the signals' detail panels list. The key follows the server'spageKey(no scheme,www, query, hash or trailing slash).
- Complete tasks: the same query as the old Action Center line (
-
Role.
canChangeisuseUserRole().canManage(Admin, Manager), the same rule the composer uses for its read-only mode. Analysts and Agency partners get only Win back in its read form, and no More, which matches their composer having no/button. -
Menu access. Win back follows
citationsand Ready to publish followscontent, usinghiddenByAdmin(the Admin's role and person settings, not the person's own work areas). A hidden section isn't counted at all. Action Center is always on, so Complete tasks can't be hidden. -
Query cost. One profile read and the role-menu row, then the three counts in parallel. Two are
head: truecounts. The signals read selects onlypayload->lostUrls, a page of 1,000 at a time, with a 20-page stop. On the largest brand in production the plans are:- signals:
signals_brand_status_idx, about 1.6 ms; - actions: the brand index, about 1 ms;
- drafts: about 0.2 ms.
There's no N+1. It runs once per brand and week, with no polling.
- signals:
-
Stale answers. A brand switch drops the older answer (the
currentflag), and the counts are keyed by brand, so the previous brand's counts never show. A rejected action hides the jobs and keeps Ask anything. -
Read-only and demo. The action only reads. A chip starts a chat through the existing
/api/chat/runspath. That path keeps its 402 → upgrade dialog and the demo guard. Theguid()check accepts the demo brand's id, and a test covers it. -
Targets. Ask anything and More find
composer.inputandcomposer.openSlash, which the composer renders (More only when the composer isn't read-only, which is the same rule). Nothing links to a route. -
A11y. The row is a
role="group"named by its title. The chips are real buttons with the focus ring, and they're disabled while a chat starts. The count is part of the button's name. The arrow isaria-hidden. Numbers use ICUnumber/plural. -
Removed strings.
countDueActions,completeWithChat,completeTasksMessageandhome.completeTaskshave no callers left. -
Embeds: none.
Follow-ups (not blocking)
- A lost-citation signal raised before its evidence was stored names no page, so its brand gets no Win back chip. Production has one brand like that (3 open signals, no evidence). Falling back to the signal count, or re-recording the evidence, would cover it.
- Each signal stores at most 3 lost pages (
MAX_LISTED), so the count is the pages the signals name, not every page that lost citations. The help text's "pages that lost citations" reads fine as it is. - Nit: More could carry
aria-haspopuplike the composer's/button.
Tests
Run on the PR head (dac323a21):
chat-home.test.tsx(14),chat-home.test.ts(6) andplan-row.test.ts(2): passing.components/chat,lib/chat, the Chat pages,lib/guards,lib/demo,subscription-guard-coverageanddemo-gate-routes: 1,241 of 1,242 pass. The one failure ischat-menu.test.tsx's clock case, in a file this PR doesn't touch, which #1876 fixes.tsc --noEmit: clean. eslint and prettier on the changed web files: clean.- Merging on current main: the PR is already on main's tip, so it's clean.
- Conflicts with other open PRs:
gkhngyk
left a comment
There was a problem hiding this comment.
Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.
…uns next (#2213) #1889 (W2-05) left Quality pass and Weekly report out of Chat Home's For you now until their data existed. Scheduled jobs have merged (W3-01 to W3-04b), so Weekly report joins the jobs, as CHAT-08 v2's mockup has it: "Weekly report · Mon". - readHomeShortcuts also reads, as the person, when their own Weekly report job for the brand runs next: a recurring /report job that is on, within the next 7 days. Reports taken off their menu hides it, as for the other jobs; a failed read hides the jobs. - The chip carries that run's weekday in the person's time and asks "/report Write this week's report on our AI visibility." in a new chat. It only reads, so read-only roles get it too. With a focus picked, the seo area's Weekly report shortcut carries the same day. Quality pass still waits: drafts' Quality scores are worked out in the editor and never kept, so nothing can count drafts under 60. Help: help/chat/chat.md's For you now paragraph; Since you left gets its own section so Chat Home stays within 150 words. Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 Co-authored-by: Claude <[email protected]> Co-authored-by: Cihan <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]> Co-authored-by: Copilot App <[email protected]>
Summary
Chat W2-05: "For you now" on Chat Home (v2 mockup
#s-home .scut, CHAT-08 v2). BehindCHAT_AGENTIC. The owner approved the screen in a preview.What it shows: Ask anything first, then each job that has something to do, with a count from the brand's data, then More ▾, which opens the composer's / menu. The jobs:
new,in_progressoron_hold, due by Sunday in the person's time, overdue included. It replaces Home's old Action Center line.lost_citationssignals. They're keyed as the server keys them (pageKey: no query or hash, nowww, no trailing slash), so a page counts once.readyand not archived. This is the same count as the Library's Ready tab.A chip starts a new chat with its words. The words follow W2-04's skills (#1885):
Who sees what
Reads: one server action (
readHomeShortcuts) reads the person once and the three counts in parallel (count: 'exact', head: truewhere it can). The lost-citation pages are read 1,000 signals a page, with onlypayload->lostUrlsselected.Accessibility:
{count, number}.Help: the Chat Home paragraph in
help/chat/chat.mdis updated.Related issue
None. Chat Wave 2 (W2-05).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
yarn vitest run src/components/chat/chat-home.test.tsx src/lib/actions/chat-home.test.ts.Checklist
yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change)On dac323a:
format:checkandtypecheckpass,linthas 0 errors (7 old warnings),yarn buildpasses, and the chat, lib/chat and app suites pass 3,030 of 3,031. The one failure ischat-menu.test.tsx's clock case, fixed in #1876.Follow-ups, not in this PR
chat-home.tsx.🤖 Generated with Claude Code