fix(admin): restore frontend onboarding analytics
Merged
WC
2mo ago+144+144+012345678901234567890123456789-99-99-01234567890123456789
Summary
- replace unsupported PostHog HogQL functions with supported equivalents
- fail the analytics request when PostHog is unavailable instead of returning misleading zero metrics
- show a clear dashboard error state while preserving legitimate zero-result analytics
- add regression coverage for query syntax, all PostHog failure modes, successful empty results, and the UI error state
Motivation
The production Frontend onboarding dashboard displayed 0 attempts even though PostHog contained onboarding events. The deployed query used toInt64OrZero and parseDateTime64BestEffort, which PostHog rejects. The PostHog read helper translated that failure into empty rows, and the dashboard rendered those rows as real zero metrics.
Business impact
Admins can once again use the dashboard to measure onboarding drop-off. Future PostHog query failures will be visible instead of silently appearing as zero customer activity.
Production evidence
- the live project contained 84 unique frontend onboarding attempts in the selected 90-day window
- PostHog rejected the deployed function names
- the same query returned 84 attempts after switching to
toIntOrZeroandparseDateTimeBestEffort
Test plan
bunx vitest run tests/frontend-onboarding-analytics.unit.test.ts tests/admin-frontend-onboarding-dashboard.unit.test.ts tests/translation-queue.unit.test.tsbun test:unitbun run lintbun run lint:backendbun run typecheck:frontendbun run typecheck:backendCHOKIDAR_USEPOLLING=1 bun run build
Summary by CodeRabbit
-
Bug Fixes
- Added a clear, localized error alert when onboarding analytics fail to load.
- Hid analytics cards and charts while data is unavailable to prevent misleading results.
- Improved handling of invalid dates, versions, timeouts, and analytics service failures.
- Empty successful analytics responses are now handled correctly.
-
Tests
- Added coverage for dashboard error states, translated messaging, and analytics failure scenarios.