Skip to Content
Living documentation — last reviewed 2026-05-28
FeaturesAnalyticsAnalytics — QA Plan

Analytics — QA Plan

Auth

StepExpected
Coach / member calls any /analytics/* endpoint403.
Non-member403.
Owner / admin200.

Revenue summary

StepExpected
Org with 1 active monthly $100 planmrrInCents = 10000.
Org with 1 active yearly $1200 planmrrInCents = 10000 (1200/12).
Org with 1 active quarterly $300 planmrrInCents = 10000 (300/3).
Org with collected $500 this month, $400 last monthcollectedDeltaPct = 0.25.
Org with $0 last monthcollectedDeltaPct = null.
3 subscriptions with debt = [100, 0, 250] centsoutstandingInCents = 350.
Deleted subscription with price > 0Excluded from MRR.

Revenue trend

StepExpected
months=66 buckets returned, oldest → newest.
months=2424 buckets.
Failed paymentsNot included.
Refunded paymentsExcluded.

Members summary

StepExpected
Org with 500 members, 450 active, 200 with Clerk accountsactivatedActive = 200.
10 new this month, 5 new last monthnewDeltaPct = 1.0.
0 churned last monthchurnedDeltaPct = null.

Members activation

StepExpected
100 imported (no Clerk, no invite) + 20 invited (pending) + 50 activatedSums match.
Total = imported + invited + activated.

At-risk

StepExpected
?sample=5 returns max 5 sample rows.
?sample=0 returns 0 sample rows but the correct count.
?sample=100 returns ≤ count rows.
Sample ordered by name ascending.

Classes

StepExpected
?days=30 returns activity in past 30 days only.
popular-classes?limit=5At most 5 entries.
Class type with no bookings in the windowNot present (excluded from popular).
Class utilization for type with mixed full+empty sessionsAverage fill rate reflects both.

Workouts summary

StepExpected
MTD assignments and completions countedYes; PRs MTD counted.
Excludes deleted assignmentsYes.

CSV export

StepExpected
?tab=revenue-summary1-row CSV with header line and value line.
?tab=invalid400.
CSV opens in Excel with Hebrew labelsUTF-8 BOM not present (gap) — consider adding if non-ASCII required.
Cells containing commasQuoted properly.
Cells containing newlinesQuoted properly.

Agent surface

StepExpected
Agent prompt: “what’s our MRR?” → calls analytics.revenue_summaryReturns the same data; agent formats prose + table.
Agent prompt: “Who’s at risk?” → calls analytics.at_risk_membersReturns sample + count.
Member role attempts to readAgent doesn’t expose analytics tools to member.

Performance

  • p95 < 500ms for orgs up to 1000 members.
  • Repeated requests should not regress (no per-call cache, but indexes are warm).
  • Coach overview can be slower for 50-coach orgs; document threshold and consider caching if it crosses 1s.

Negative

  • Pass months=abc → parsed as NaN, defaults applied.
  • Pass sample=-1 → behavior depends on SQL LIMIT; document and ideally clamp to ≥ 0.
  • Pass days=10000 → query returns all historical data; performance scales linearly.