Repository navigation
feat(action-center): number each brand's actions from AC-1 - #2422
Merged
Merged
Conversation
…numbers Brings in actionCode and matchesActionCode (action-ref.ts), which this branch extends with each brand's own numbers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
… actions by title
The owner asked Chat "what are the most important actions?" on a brand
with 53 actions. Chat read 10 (its row default for the Action Center
read), judged only those, and named actions by bare numbers ("AC-251,
249, 250") that the Actions list doesn't show.
- list_action_center_tasks reads a page from a new Chat read,
listActionsPageFor: every open action (New, In progress, On hold) is
counted and ranked on the server by Priority Score, 50 to a page with
the total, next_offset and a "Showing N of M" note; offset pages on.
Rows are compact: ref, title (as the Actions list words it), category,
status, score and level, stale_since, due, assignee, tasks, updated.
Still scoped to the caller's organization and brand access.
- The page is never probed for one more row (it counts itself) and gets
a 20,000-character result share, so all 50 rows reach the model.
- The writer's rules and the tool's description require a title with
the linked number ("**Title** (AC-12)"), never a number alone, a run of
bare numbers or a range, and saying "the top 50 of 53" when a read
didn't cover them all. The 30-day plan skill names actions the same way.
- Every action code Chat shows or links comes from actionRef (the
action-ref helper), examples included, so a change of numbering only
changes its input.
- The agents' eval flags an answer with a bare "AC-251" (must check).
- Help: "Ask about your actions" in Use Chat.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…umbers Brings in actionRef and Chat's own list of actions, which this branch names by each brand's code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The owner asked for each brand's actions to be numbered from 1 instead of
the global action_no, which hinted at other customers' volume and read as
unrelated to the brand's list ("AC-648" beside "AC-251"). Signals get their
own brand numbers too (schema and backfill here; their codes come next).
- 00534: actions.brand_no and signals.brand_no, a server-only counter per
brand and kind (brand_number_counters), and a before-insert trigger that
gives the next number under the counter's row lock. Schema and functions
only; nothing existing is numbered in the migration. The unique indexes
are built after the backfill (only on an empty table in the migration).
- backfill_brand_numbers numbers one brand's rows per call by creation
order, idempotent and resumable, run by src/scripts/backfill-brand-numbers.js
(--dry-run, --kind, --brand, --from-brand). Until a brand is numbered its
new rows wait too, so a brand never mixes old and new codes.
- One formatter: actionCode / actionCodeNo (web action-ref.ts, server
action-code.js): "AC-03", padded to two digits, falling back to the old
"AC-648" while brand_no is null. Used by the Action Center (list, drawer,
exports, History, review, run agent), Chat (tool results, cards, Undo,
agent run scope and prompt, Inbox suggestions, its list of actions), the
MCP tools (a `code` beside action_no), Reports, Content, Products,
Prompts and the send toasts.
- Old links keep their meaning: actions/AC-n still opens the old global
number, in the person's workspace. A code in Chat's text links to
actions/code/AC-n, which opens the one action with that code or old
number and otherwise the list searched for it, never a guess. Other new
links point by id.
- The drawer shows "Previously AC-648" beside the new code, and the list
search matches the old number as well as the new code.
- Help: Action Center actions (Action codes) and Chat.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
dismissed
gkhngyk’s stale review
November 15, 2026 07:29
The merge-base changed after approval.
Conflicts: - help/chat/chat.md: main's keywords (Settings in the chat menu) plus this branch's (most important actions, top actions, action title); main's new text and this branch's "Ask about your actions" section both kept. - action-ref.test.ts: both sets of tests (actionRef from this branch; actionCode, searchedActionNo and matchesActionCode from main's ansvisor#2418). actionCode now builds its code with actionRef, so one formatter remains. - web/src/lib/chat/skills/library.json: regenerated from skills/*/SKILL.md (yarn vitest run -u src/lib/chat/skills). - approved-articles.json: regenerated (yarn vitest run -u src/lib/help). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…umbers Brings the updated ansvisor#2420, which carries upstream main. Conflicts: - action-ref.ts and action-ref.test.ts: this branch's versions (actionCode from the brand's number via actionCodeNo, with every test from both branches and ansvisor#2418). - server/src/lib/action-center/from-chat.js: main's Ads source (`source` param, verifiedPlace without a conversation for Ads) and this branch's `brandNo` in the answer and actionCode in the duplicate message. - from-chat.test.js: main's Ads test now expects the answer's brandNo for the same key again (this branch's answer shape). - server/src/lib/demo/coverage.js: both SKIPPED entries, brand_number_counters (00534) and mentions_terms_packed_ready (00540). - supabase/schema.sql: regenerated (bash supabase/build-schema.sh); 00534 sits before 00535-00540 by file order. - library.json and approved-articles.json: regenerated, unchanged from the automatic merge. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Earn (from main) sends through from-chat.js and answered only the old global number, so its card read "Open AC-1300" while the Action Center shows the brand's code. It now also answers brandNo (sent, the same key again, the duplicate, and the covering action the drawer reads), and the card shows actionCodeNo: "Open AC-03", or the old number until the brand is numbered. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 16, 2026
…-numbers Brings the updated ansvisor#2422 (with ansvisor#2420 and upstream main). No conflicts; schema.sql, library.json and approved-articles.json regenerated and unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 16, 2026
Brings in ansvisor#2446 (no row counts), ansvisor#2442, ansvisor#2447, ansvisor#2441 and ansvisor#2377. Conflicts: - approved-articles.json: regenerated (yarn vitest run -u src/lib/help). help/chat/chat.md merged cleanly: main's "Watch the work" text (no row counts) and this branch's action-title line are both kept (132 words); updated stays 2026-11-16, last_checked 2026-11-15. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Takes the updated ansvisor#2420, which now includes upstream main (ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377). Conflicts: - approved-articles.json: regenerated (yarn vitest run -u src/lib/help). help/chat/chat.md merged cleanly: updated 2026-11-16, last_checked 2026-11-15. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 16, 2026
Takes the updated ansvisor#2422, which now includes ansvisor#2420 and upstream main (ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377). No conflicts; approved-articles.json checked with yarn vitest run -u src/lib/help (no change). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 16, 2026
Takes the updated ansvisor#2423, which now includes ansvisor#2422, ansvisor#2420 and upstream main (ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377). Conflicts: - help/chat/chat.md: front matter only; took the later last_checked (2026-11-16). Both sides' text is kept: main's "Watch the work" (no row counts, 148 words) and this branch's look-up-by-code paragraph in "Ask about your actions" (146 words). - approved-articles.json: regenerated (yarn vitest run -u src/lib/help). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
dismissed
gkhngyk’s stale review
November 16, 2026 16:36
The merge-base changed after approval.
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.
Summary
The owner asked for each brand's actions to be numbered from 1. Today an action's code is its global
actions.action_no, a single counter shared by every workspace. A brand with 53 actions shows codes like "AC-648" next to "AC-251". Those codes look unrelated to the brand's own list, and they hint at how many actions other customers have.From now on, each brand numbers its actions from 1 and shows them padded to two digits: AC-01, AC-02 … AC-53. An action keeps its number for life. Numbers are never reused, so a brand's list keeps gaps where actions were done, dismissed or removed. That is by design.
Signals get the same per-brand numbers in the same migration and backfill. Their display (S-01 …) is in the stacked branch
feature/signal-brand-numbers.This branch merges #2418 (
fix/action-center-date-sort,actionCode/matchesActionCode) andfix/chat-reads-all-actions(actionRef), and extends their helpers. Merge it after both.Merged with main (16 Nov)
mainis merged in, through the updated #2420. The conflicts were infrom-chat.js(its JSDoc),coverage.js,schema.sql(regenerated),library.jsonand Help (regenerated).One addition is in its own commit,
c02324304, so it's easy to review or revert. Ads' Earn card (merged since) creates actions throughfrom-chat.js, but it passed on only the global number. Its button would read "Open AC-1300" while the Action Center shows the brand's code.server/src/lib/ads/earn.jsnow passesbrandNoback when Earn:AdsActionRefinweb/src/lib/ads/api.tsgains an optionalbrandNo._earn-card.tsxusesactionCodeNo. The button reads "Open AC-03" once the brand is numbered, and the old code until then.earn.test.jsand_opportunity-drawer.test.tsx.After the merge, these checks pass:
tsc.Release applies missing migrations in number order (
scripts/release/migrations.mjs), so 00534 applies even though 00540 is already on production.What customers will see
/dashboard/action-center/actions/AC-648in Slack, email, History or a note) still means the old number, within the person's own workspace.Changes
00534_actions_brand_number.sql. Schema and functions only. It applies in seconds and numbers nothing that already exists.brand_no integertoactionsandsignals.brand_number_counters (brand_id, kind, last_no), one row per brand and kind (actionorsignal). It is server-only: RLS is on, there are no member grants, and the counters are removed when their brand is deleted.before inserttrigger,set_brand_no. It gives each new row the next number, taken under the counter row's lock, so two inserts can't get the same number. A failed insert gives its number back. An upsert over an existing row (the demo rebuild) keeps that row's number.brand_idis not null), so there's no organization-level case.backfill_brand_numbers(kind, brand), which numbers one brand's unnumbered rows per call.created_at, thenaction_no; signals bycreated_at, thenid(a signal'sdetected_atmoves when it reopens).brand_numbers_backfill_brands(kind), the list of brands the script walks.(brand_id, brand_no)are built after the backfill (see the runbook). The migration builds them only on a table that is still empty, such as a new install.server/src/scripts/backfill-brand-numbers.jsandserver/src/lib/brand-numbers-backfill.js, modelled on fix(db): split 00536 into a quick migration and a chunked backfill #2352's fast-rollups backfill.--dry-run,--kind action|signal,--brand,--from-brand,--pause-ms.--kindand--from-brandto resume with.actionCode/actionCodeNoinweb/src/lib/action-center/action-ref.ts. They return "AC-03", or the old "AC-648" whilebrand_nois null, andactionRefstays the single "AC-" prefixer.previousActionCodesupplies the "Previously" code.actionCodeinserver/src/lib/action-center/action-code.js.codebesideaction_noandbrand_no), the sent and added cards, Undo and Activity lines, the agent run's scope and prompt, Inbox suggestions, and Chat's own list of actions.list_actions,get_action,list_action_history, task reviews, and a signal's linked actions now include acode.action_nois kept, so the change is additive.brandNoonce the brand is numbered.actions/AC-nkeeps its old meaning: globalaction_no, read with the person's own access.actions/code/AC-nroute. It opens the single action of the workspace with that brand number or old number; otherwise it opens the list searched for the code. It never picks between two.?action=).brand_number_countersis listed as skipped, since the trigger fills it as the demo's rows are written.Migration and backfill
Runbook for Gökhan, in this order:
Apply 00534 before this code reaches production. The new code reads
brand_no.supabase db pushor the SQL Editor.Deploy. Every existing brand keeps showing its old codes. A brand created from now on is numbered from AC-01 straight away.
Run the backfill, dry run first. From
server/:Resume with: --kind … --from-brand ….--kind action --brand <id>. This changes nothing if the brand is already numbered.Check that nothing was missed. All four counts should be 0.
Build the unique indexes without blocking writes, by hand, one statement at a time:
A concurrent build that fails leaves an invalid index with that name, and
if not existswould keep it. If that happens, drop the index and build it again.How to test
node src/scripts/backfill-brand-numbers.js --dry-run, then run it without--dry-run./dashboard/action-center/actions/AC-<old number>: it opens that old action.list_actionsandget_actionreturncode.Checks
brand-access*, demo coverage, health and the backfill.tsc --noEmitis clean.src/lib/chat, Chat components, MCP,src/lib/actions, Content, Reports, Prompts, signals, Products, AI Traffic, Site Audit, Help anduse-server-exports.audit/[id]/page.tsxwas already there.yarn vitest run -u src/lib/help.🤖 Generated with Claude Code
https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9