Skip to content

feat(action-center): say on the Action Center when a brand's first analysis is running - #1248

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feature/first-run-note
Oct 20, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feature/first-run-note

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Follow-up from #1238's review: "after payment, a new brand or onboarding, people now land on Actions while the first run is still going, and nothing there shows it; the progress bar appears only on Visibility."

Stacked on #1238 (feature/land-on-actions, b02def9): merge after it. Until then this PR also shows #1238's commit; its own change is cc2ab01.

The note (components/action-center/first-run-note.tsx)

  • It sits under the Action Center's tabs, so Actions, Signals, KPIs and History all show it: they all fill in from the first run.
  • It says "First analysis running" (or "First analysis queued"), adds the progress ("12 of 40 answers") when this browser started the run, and links to Follow it on Visibility.
  • It uses the same look as Visibility's progress banner (border-primary/20 bg-primary/5, spinner); no new colors.

When it shows

  • While the brand has no completed run (getTrackingWindow().lastRunAt is null) and one is under way:
    • from the tracking_runs ledger (activeRun), so a run any browser started counts;
    • or, while the job still waits for the worker (the ledger row is written when the worker starts it), from the job this browser saved (loadTrackingJob, which feat(action-center): land on the Action Center's Actions, its first tab #1238's TrackingJobHandoff fills from ?jobId=): waiting / delayed read as queued, active as running; a failed or missing job shows nothing.
  • It reads every 30 s and stops for good once the brand has a completed run, so a brand past its first run costs one read per visit. A failed read keeps what it says until the next one. Another brand's state never shows after a switch.

The ActionCenterTabs change is the note under the <nav> (the nav's lines are re-indented by the fragment). The page files aren't touched, so it doesn't collide with the Getting started PRs (#1235, #1236, #1243) on actions/page.tsx.

Related issue

Follow-up to #1238.

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

Unit test (first-run-note.test.tsx):

  • running from the ledger;
  • queued from a saved job;
  • the saved job's progress;
  • nothing and no more reads once a run completed;
  • another brand's or a failed job ignored;
  • a failed read keeps the note, which goes when the first run is done.

In the browser (I added a temporary brand with one tracking_runs row and no completed_at, then deleted it):

  1. Open the Action Center on a brand whose first run is going: the note shows under the tabs on Actions, Signals and KPIs, and the link opens Visibility.
  2. Set the run's completed_at: within 30 s the note goes, without a reload.
  3. A brand with completed runs (the demo brand) never shows it.

I checked it in light and dark mode, at 1440 and 1024 px.

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

yarn test (1789) and yarn build pass too.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 20, 2026 04:27
New Ansvisor (AC-ALT2 spec, §3), PR 6 of 7: everything starts at the
Action Center. One home path (config/home.ts, DASHBOARD_HOME) for:

- /dashboard and /dashboard/action-center (was Visibility and KPIs);
- the end of onboarding and the Stripe success route after payment;
- a new brand from the brands page;
- the onboarding preview's highlighted sidebar item.

The Action Center's tabs read Actions · Signals · KPIs · History
(lib/action-center/tabs.ts).

The Stripe success route still passes the first tracking run's ?jobId=;
TrackingJobHandoff, in the dashboard layout, keeps it for Visibility's
progress bar (which used to read it from its own address) and takes it
out of the address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alysis is running

After the payment, a new brand or onboarding, people now land on the
Action Center's Actions (ansvisor#1238) while the first tracking run is still
going, and only Visibility showed it. A note under the Action Center's
tabs now says the first analysis is running (or queued), with the
progress when this browser started it and a link to follow it on
Visibility.

It shows while the brand has no completed run and one is under way:
from the tracking_runs ledger, so any browser's run counts, or, while
the job still waits for the worker, from the job this browser saved.
It reads every 30 s and stops once the brand has a completed run.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk this is the "First analysis running" note you suggested on #1238. It's stacked on #1238, so it should merge after it.

It reads getTrackingWindow every 30 s and shows while the brand has no completed run and either the ledger has an active run or this browser's saved job is still waiting/active. After the first completed run it stops reading for good. One choice to check: it sits under the tabs on all four sections rather than on Actions only, since Signals and KPIs are just as empty until the first run ends.

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

Looks good. It carries #1238's commit, so it merges right after #1238. The note reads the run ledger and the saved job the way Visibility does, and it stops once the brand has a completed run.

Small things, none blocking:

  • Polling never stops for an idle brand. A brand with no completed run and nothing under way, such as one that never started tracking, keeps reading every 30 s for as long as the page is open. Stop once neither the ledger nor the saved job shows a run.
  • A long first run loses the note. getTrackingWindow treats an unfinished run older than 2 hours as crashed. In another browser, the note then disappears during a long first run, and the copy says a first run can take an hour or two at busy times.
  • queuedBody is too specific. It says another analysis is running, but queued also covers a job the worker hasn't picked up yet.

@gkhngyk
gkhngyk merged commit 8550b59 into ansvisor:main Oct 20, 2026
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