Skip to content

fix(admin): restore frontend onboarding analytics - #2996

Merged
WcaleNieWolny merged 3 commits into
mainfrom
wolny/fix-frontend-onboarding-hogql
Aug 11, 2026
Merged

fix(admin): restore frontend onboarding analytics#2996
WcaleNieWolny merged 3 commits into
mainfrom
wolny/fix-frontend-onboarding-hogql

Conversation

@WcaleNieWolny

@WcaleNieWolny WcaleNieWolny commented Aug 11, 2026

Copy link
Copy Markdown
Member

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 toIntOrZero and parseDateTimeBestEffort

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.ts
  • bun test:unit
  • bun run lint
  • bun run lint:backend
  • bun run typecheck:frontend
  • bun run typecheck:backend
  • CHOKIDAR_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.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 77ae4238-0e2e-4cbf-a971-ab598b13439a

📥 Commits

Reviewing files that changed from the base of the PR and between 2fefd30 and 789d90d.

📒 Files selected for processing (3)
  • src/pages/admin/dashboard/frontend-onboarding.vue
  • tests/admin-frontend-onboarding-dashboard.unit.test.ts
  • tests/frontend-onboarding-analytics.unit.test.ts
📝 Walkthrough

Walkthrough

The PR adds explicit PostHog failure handling for frontend onboarding analytics. The admin dashboard now shows a localized error alert and hides analytics content when loading fails. Query parsing and related unit tests use the updated best-effort functions.

Changes

Frontend onboarding analytics

Layer / File(s) Summary
Analytics query and failure handling
supabase/functions/_backend/utils/frontend_onboarding_analytics.ts, tests/frontend-onboarding-analytics.unit.test.ts
The query uses toIntOrZero and parseDateTimeBestEffort. PostHog failures reject the analytics request. Tests cover query construction, empty results, parser behavior, timeouts, and oversized responses.
Dashboard analytics error state
src/pages/admin/dashboard/frontend-onboarding.vue, messages/en.context.json, messages/en.json
The dashboard tracks load failures, displays a translated alert, and hides analytics content while an error exists.
Dashboard validation
tests/admin-frontend-onboarding-dashboard.unit.test.ts
Tests cover error state tracking, alert rendering, conditional content, and the English translation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: codex

Suggested reviewers: riderx, cursor

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix that restores frontend onboarding analytics.
Description check ✅ Passed The description explains the issue, impact, implementation, and detailed test plan, but omits the template checklist and frontend screenshots.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low. Cursor Bugbot was not present after the initial check poll, so that signal was skipped. Approved based on the narrow admin onboarding-analytics HogQL/error-handling change with unit coverage; no reviewers assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@coderabbitai coderabbitai Bot added the codex label Aug 11, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing wolny/fix-frontend-onboarding-hogql (789d90d) with main (4e98e9b)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@supabase/functions/_backend/utils/frontend_onboarding_analytics.ts`:
- Around line 114-120: Replace parseDateTimeBestEffort with
parseDateTime64BestEffort at all timestamp comparison points in the frontend
onboarding analytics query, specifying millisecond precision for startDate,
followupEndDate, and cohortEndDate boundaries. Update both test cases in
tests/frontend-onboarding-analytics.unit.test.ts at lines 50-66 and 192-210 to
assert the millisecond-preserving expressions and fractional-second boundary
behavior.

In `@tests/frontend-onboarding-analytics.unit.test.ts`:
- Around line 134-146: Extend the parameterized cases in the PostHog failure
test to include configured=false with failureReason=null and connected=false
with failureReason=null, while keeping the existing failureReason cases. Ensure
these additions independently exercise the configured and connected status
predicates used by getAdminFrontendOnboardingAnalytics.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ebe61cda-83e4-45aa-8c90-3ddd8a7eaff5

📥 Commits

Reviewing files that changed from the base of the PR and between 4e98e9b and 598067f.

📒 Files selected for processing (6)
  • messages/en.context.json
  • messages/en.json
  • src/pages/admin/dashboard/frontend-onboarding.vue
  • supabase/functions/_backend/utils/frontend_onboarding_analytics.ts
  • tests/admin-frontend-onboarding-dashboard.unit.test.ts
  • tests/frontend-onboarding-analytics.unit.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Cap-go/capacitor-updater (manual)

Comment thread supabase/functions/_backend/utils/frontend_onboarding_analytics.ts
Comment thread tests/frontend-onboarding-analytics.unit.test.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/pages/admin/dashboard/frontend-onboarding.vue

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/frontend-onboarding-analytics.unit.test.ts
@sonarqubecloud

Copy link
Copy Markdown

@WcaleNieWolny
WcaleNieWolny merged commit 9788892 into main Aug 11, 2026
113 of 114 checks passed
@WcaleNieWolny
WcaleNieWolny deleted the wolny/fix-frontend-onboarding-hogql branch August 11, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant