Identify authenticated PostHog users - #2326
Conversation
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideAdds a typed PostHog user identity lifecycle to the web app by introducing identify/reset helpers, wiring them into auth bootstrap and logout flows, and covering the behavior with focused unit and auth-context tests plus accompanying documentation of the TDD plan. Sequence diagram for PostHog identity during auth bootstrap and logoutsequenceDiagram
participant AuthProvider
participant AuthAdapter
participant PostHogAdapter
participant Telemetry
AuthProvider->>AuthAdapter: fetchCurrentUser
alt [authenticated user]
AuthProvider->>PostHogAdapter: identifyPostHogUser
else [unauthenticated visitor]
Note over AuthProvider,PostHogAdapter: No identifyPostHogUser call
end
AuthProvider->>AuthAdapter: logout
alt [logout succeeds]
AuthProvider->>PostHogAdapter: resetPostHogUser
else [logout fails]
AuthProvider->>Telemetry: captureException
Note over AuthProvider,PostHogAdapter: No resetPostHogUser call
end
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Summary by QodoIdentify authenticated PostHog users in web auth lifecycle
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
167 rules✅ Skills:
fix-provider, write-tests, cloudflare 1.
|
|
Storybook previews for This comment updates automatically on each PR push. |
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
|
Addressed all three actionable Qodo findings in 00cde77:
Focused auth/PostHog validation passes (41 tests), all four TypeScript checks pass, and the web production build passes. |
Summary
Validation
pnpm exec vitest run packages/web/src/lib/posthog.test.ts packages/web/src/lib/auth-context.test.tsx(13 passed)pnpm test(14,881 passed, 21 skipped)pnpm lintpnpm tsc --noEmitpnpm tsc --noEmitinpackages/server,packages/web, andpackages/mobilepnpm buildinpackages/webFixes #2321
Summary by Sourcery
Align web analytics with authentication by tying PostHog identity to the authenticated user lifecycle and documenting the approach.
New Features:
Enhancements:
Documentation:
Summary by cubic
Identify authenticated web users in PostHog and keep identity in sync with auth, including resets on logout and session changes. Logout flow is sequenced: server logout completes, then analytics identity resets, then we redirect.
AuthProvideridentifies on bootstrap with stableid,name, andemail; anonymous visitors are not identified.redirectToLogin; on failure, keep identity, do not navigate, and capture the error.identifyPostHogUser/resetPostHogUserinpackages/webviaposthog-js, with adapter and auth lifecycle tests and updated docs.Written for commit 00cde77. Summary will update on new commits.