Skip to content

[CI] (4c70a79) react-native/react-native-saas - #3871

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-4c70a79-react-native-react-native-saas
Closed

[CI] (4c70a79) react-native/react-native-saas#3871
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-4c70a79-react-native-react-native-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 4c70a79
App: react-native/react-native-saas
App directory: apps/react-native/react-native-saas
Workbench branch: wizard-ci-4c70a79-react-native-react-native-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-09-09T22:31:25.845Z
Duration: 390.8s

YARA Scanner

✓ 198 tool calls scanned, 0 violations detected

No violations: ✓ 198 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
Author

Now I have all the information I need. Here's my evaluation:


PR Evaluation Report

Summary

This PR integrates PostHog into a React Native SaaS app using the posthog-react-native SDK. It adds SDK initialization via react-native-config for env vars, wraps the app in PostHogProvider with PostHogErrorBoundary, adds identify on sign-in, reset on sign-out, and captures meaningful events across auth, team, project, and member sagas. However, it has notable issues with user identification (email as distinct_id), incorrect person property setting, and missing screen view tracking.

Files changed Lines added Lines removed
11 +89 -7

Confidence score: 5/5 🧙

  • Email used as distinct_id in identify(): The identifyAuthenticatedUser(email) function passes the raw email as the distinct ID. The PostHog docs recommend a stable ID from your auth system. If a user changes their email, they fragment into two distinct people. The app likely has a user ID available from the API response that should be used instead. [CRITICAL]
  • **Incorrect wrapping in `identify()` call**: The code calls `posthog?.identify(email, { : { email } })`. In the React Native SDK, the second argument to `identify()` already acts as properties. Wrapping in { : ... } creates a person property literally named `` with a nested object, rather than setting email as a top-level person property. Should be `posthog?.identify(userId, { email })`. [MEDIUM]
  • No screen view tracking: The app uses NavigationContainer from @react-navigation/native but does not integrate PostHog's screen view tracking. For React Native, you need to use useNavigationContainerRef with PostHog's navigation tracking or manually capture screen views. Without this, no `` events are sent. [MEDIUM]

File changes

Filename Score Description
src/config/posthog.js 4/5 New file: initializes PostHog SDK with env vars, lifecycle events, and dev-only debug/error
src/routes.js 4/5 Wraps navigator in PostHogProvider + PostHogErrorBoundary with graceful fallback
src/store/modules/auth/sagas.js 2/5 Adds identify (with email as distinct_id + incorrect wrapping), capture, and reset
src/store/modules/members/sagas.js 5/5 Adds capture events for member updates and invites with useful properties
src/store/modules/projects/sagas.js 5/5 Adds capture events for project creation with creation method
src/store/modules/teams/sagas.js 5/5 Adds capture events for team creation with creation method
src/components/TeamSwitcher/index.js 5/5 Adds team_selected capture using usePostHog hook
.env.example 5/5 Documents required env vars
.gitignore 5/5 Excludes .env and .env.local
package.json 5/5 Adds posthog-react-native, react-native-config, react-native-svg
android/app/build.gradle 5/5 Applies dotenv.gradle for react-native-config

App sanity check ✅

Criteria Result Description
App builds and runs Yes Dependencies added correctly, no syntax errors, build.gradle updated for react-native-config
Preserves existing env vars & configs Yes Existing code preserved; PostHog wrapped conditionally with fallback when unconfigured
No syntax or type errors Yes All changed files have valid JavaScript syntax
Correct imports/exports Yes posthog-react-native imports are correct (PostHog, PostHogProvider, PostHogErrorBoundary, usePostHog)
Minimal, focused changes Yes All changes are PostHog-related; no scope creep
Pre-existing issues None

Other completed criteria

  • Environment variables documented in .env.example with placeholder values
  • .gitignore updated to exclude .env and .env.local
  • Build configuration valid — build.gradle change applies dotenv.gradle correctly

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-react-native@^4.68.4 added to package.json
PostHog client initialized Yes new PostHog(token, { host, captureAppLifecycleEvents: true }) in src/config/posthog.js; wrapped in PostHogProvider in routes
capture() Yes 9 meaningful capture calls across auth, teams, projects, members, and team switcher
identify() No Uses raw email as distinct_id; person properties incorrectly wrapped in ``
Error tracking Yes PostHogErrorBoundary wraps the entire navigator tree with a fallback component
Reverse proxy N/A Mobile app — reverse proxy only benefits browser-based posthog-js
Screen views No No screen view tracking integration — NavigationContainer is used without PostHog's navigation tracking
All targets initialized Yes posthog-react-native JS init covers both iOS and Android from a single codebase

Issues

  • Email as distinct_id: identifyAuthenticatedUser(email) passes the raw email address as the distinct ID. PostHog docs recommend using a stable ID from your auth system (e.g., a database user ID). If a user changes their email, events before and after the change will belong to different person profiles, fragmenting analytics data. The app's API likely returns a user ID that should be used instead. [CRITICAL]
  • Incorrect person property nesting: posthog?.identify(email, { : { email } }) is wrong. The second argument to identify() in the React Native SDK already applies semantics. This creates a person property literally named with a nested object value. Fix: posthog?.identify(userId, { email }). [MEDIUM]
  • No screen view tracking: The app uses NavigationContainer from @react-navigation/native without any PostHog screen view integration. For React Native, PostHog does not autocapture screen views — you need to wire up navigation state changes (e.g., using useNavigationContainerRef and PostHogProvider's navigation integration or manually calling posthog.screen()). Without this, no `` events are captured. [MEDIUM]
  • No re-identification on app restart: The init() saga checks for a stored token but never re-identifies the user with PostHog. If the app is killed and reopened, events during that session won't be linked to the identified user until they sign in again. [LOW]

Other completed criteria

  • API key loaded from environment variable via react-native-config
  • Host correctly configured from environment variable
  • Helpful dev-only error thrown when env vars are missing
  • Graceful degradation when PostHog is unconfigured (conditional rendering in routes)
  • posthog.reset() correctly called on sign-out

PostHog insights and events ⚠️

Filename PostHog events Description
src/store/modules/auth/sagas.js user_signed_in, user_signed_out, identify(), reset() Tracks sign-in with authentication_method property (demo/password), sign-out, and user identification
src/store/modules/teams/sagas.js team_created Captures team creation with creation_method (demo/api)
src/store/modules/projects/sagas.js project_created Captures project creation with creation_method (demo/api)
src/store/modules/members/sagas.js member_roles_updated, member_invited Captures member role updates (with role_count) and invitations (with invitation_method)
src/components/TeamSwitcher/index.js team_selected Captures when user switches teams
src/routes.js captureException (via ErrorBoundary) Automatically captures unhandled exceptions via PostHogErrorBoundary

Issues

  • PII as distinct_id: Raw email address is used as the distinct ID in identify(). Per PostHog best practices, email should be a person property, not the distinct ID. Use a stable user ID instead. [CRITICAL]

Other completed criteria

  • Events represent real user actions mapped to actual product flows (sign-in, team management, project creation, member management)
  • Events enable product insights — can build sign-in → team selection → project creation funnel
  • Events include relevant contextual properties (authentication_method, creation_method, role_count, invitation_method)
  • Event names are descriptive and follow consistent snake_case convention

Reviewed by wizard workbench PR evaluator

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.

0 participants