Skip to content

Insights: real per-stat sparklines and a running-now strip - #249

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-ui-insights-redesign
Aug 21, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
cl-ui-insights-redesign

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

Redesigns the Insights KPI row against the owner's mock without touching the working data layer — the Insights page (real-data-backed: KPIs, activity, token mosaic, cost-by-model, tool calls, run history/trace) is evolved, not rebuilt.

  • Every KPI tile now carries a real sparkline (react-ui's StatGridItem sparkline slot) — Activity/Tokens/Runs use the per-day series already driving the activity chart; Cost only renders a trend when every model's rate is known this window (never a shape that would silently undercount an unpriced model).
  • A "Running now" strip lists runs genuinely in flight (status: running | updating), styled with react-ui's RUN_STATUS_TONE/RUN_STATUS_LABEL/StatusDot rather than an invented palette. It renders nothing when nothing is running — same convention as react-ui's WorkflowDock, not a permanent empty-state fixture.
  • The mock's third delta, a "Recommendations" rail, is intentionally omitted — there is no real heuristic or data model behind it today (no credential-expiry, skill-version-regression, or model-fit signal reaches this page), and fabricating advice strings would violate this page's own no-invented-data convention.

Nothing else changed: KPI values, activity/token/cost/tool tables, run history and trace detail are untouched.

Test plan

  • bun test on the touched suites: apps/web/src/pages/insights-page.test.ts, insights-page-render.test.tsx, plus the full existing Insights suite (insights-stats, insights-api, insights-route, insights-row-activation, insights-timeline, insights-path, insights-deeplinks, insights-workbench-scope) — 84 pre-existing + 16 new tests, all green.
  • Full apps/web package test run: 793 pass / 3 pre-existing failures (tailwind-build.test.ts, needs a local bun run build artifact — unrelated to this change).
  • bunx prettier --write on every touched file.

Covers the new per-day run/cost bucketing helpers and elapsed-time
formatting backing the redesigned Insights KPI row, plus the
"Running now" strip's real-data-only behavior (absent when nothing
is in flight, present with the actual in-flight run's name).
Restyles the KPI row and adds two of the three redesign deltas from
the owner's mock, both backed by data the page already queries:

- Each KPI tile now carries a real trend line via react-ui's
  StatGridItem sparkline slot — turns/tokens/runs per day from the
  activity series already driving the activity chart, and cost per
  day only when every model's rate is known this window (never a
  shape that would silently undercount an unpriced model).
- A "Running now" strip lists runs genuinely in flight (status
  running/updating), using react-ui's RUN_STATUS_TONE/LABEL and
  StatusDot rather than an invented status palette. It renders
  nothing when nothing is running, same convention as react-ui's
  WorkflowDock — not a permanent "nothing running" fixture.

The mock's third delta, a "Recommendations" rail, is intentionally
not built: there is no real heuristic or data model behind it today
(no credential-expiry, skill-version-regression, or model-fit
signal reaches this page), and fabricating advice strings would
violate this page's own no-invented-data convention. Everything
else — KPI values, activity/token/cost/tool tables, run history and
trace detail — is unchanged.
- runsPerDay's day-count Map inferred value type 0 (a literal, not
  number) from the `as const` tuple spread, so incrementing a count
  failed to typecheck — the counts genuinely needed a number-typed
  Map, not a readonly-tuple one.
- Two exactOptionalPropertyTypes violations: the Cost tile's
  sparklineValues can be genuinely absent (unpriced model this
  window) and must be omitted via spread rather than passed as an
  explicit undefined; same fix for the render test's optional runs
  stub.
- Typed the render test's runs stub to the real InsightsRun shape
  instead of unknown[], so a real mismatch there stays visible.
@TheGreatAxios
TheGreatAxios merged commit daeac27 into main Aug 21, 2026
2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-ui-insights-redesign branch August 25, 2026 15:29
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.

1 participant