Skip to content

fix(insight): count analytics totals independently#706

Merged
mksglu merged 1 commit into
mksglu:nextfrom
NgoQuocViet2001:review/ctx-insight-pass
May 25, 2026
Merged

fix(insight): count analytics totals independently#706
mksglu merged 1 commit into
mksglu:nextfrom
NgoQuocViet2001:review/ctx-insight-pass

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

Summary

  • count analytics totals with dedicated aggregate queries instead of capped recent detail lists
  • keep recent errors/prompts/tasks capped for dashboard detail sections
  • add an Insight API regression test for capped detail lists vs uncapped totals

Problem

/api/analytics used the recent detail arrays to calculate totalErrors, totalPrompts, and totalTasks. Those arrays are intentionally capped at 20 rows for display, so dashboard KPI totals could be underreported when there were more matching records.

Validation

  • pnpm exec vitest run tests/analytics/insight-cors.test.ts --reporter=dot
  • pnpm exec vitest run tests/core/server.test.ts -t 'ctx_insight|insight-cache' --reporter=dot
  • pnpm run build
  • manual context-mode insight check: analytics error total matches category analytics error total

@mksglu mksglu merged commit d281e9f into mksglu:next May 25, 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