Skip to content

[CI] (6fb03e7) react-native/react-native-saas#1480

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

[CI] (6fb03e7) react-native/react-native-saas#1480
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-6fb03e7-react-native-react-native-saas

Conversation

@wizard-ci-bot
Copy link
Copy Markdown

@wizard-ci-bot wizard-ci-bot Bot commented May 13, 2026

Automated wizard CI run

Source: scheduled
Trigger ID: 6fb03e7
App: react-native/react-native-saas
App directory: apps/react-native/react-native-saas
Workbench branch: wizard-ci-6fb03e7-react-native-react-native-saas
Wizard branch: main
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-05-13T17:36:23.121Z
Duration: 352.3s

@wizard-ci-bot
Copy link
Copy Markdown
Author

wizard-ci-bot Bot commented May 13, 2026

Now I have all the context needed for a thorough evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog analytics into a React Native SaaS app using the posthog-react-native SDK. It adds a PostHog config singleton, wraps the navigation with PostHogProvider, implements manual screen tracking, user identification on sign-in, session reset on sign-out, and captures 8 meaningful product events across auth, teams, projects, and members sagas.

Files changed Lines added Lines removed
9 +184 -27

Confidence score: 4/5 👍

  • Email used as distinct_id: posthog.identify(email, { email }) uses the raw email address as the distinct ID. This causes fragmented analytics if users change emails. Should use a stable user ID (e.g., from response.data user ID or token payload). [CRITICAL]
  • No error tracking: No captureException() calls or exception autocapture setup. Error tracking is completely absent. [MEDIUM]
  • No .env.example committed: The .env file is gitignored (correctly), but no .env.example template is committed, so new developers won't know which env vars are required without reading the report doc. [MEDIUM]
  • No re-identification on app resume: The init() saga restores the token from AsyncStorage but never re-calls posthog.identify(), so returning users are not identified until they sign in again. [MEDIUM]

File changes

Filename Score Description
src/config/posthog.js 4/5 New PostHog singleton with env-based config, graceful fallback when unconfigured, debug in dev
src/routes.js 4/5 PostHogProvider added inside NavigationContainer with manual screen tracking via onStateChange
src/store/modules/auth/sagas.js 3/5 Identify, capture, and reset added but uses email as distinct_id; no re-identify on init
src/store/modules/teams/sagas.js 4/5 team_created and team_switched events with relevant properties
src/store/modules/projects/sagas.js 4/5 project_created event with title property
src/store/modules/members/sagas.js 4/5 member_invited and member_role_updated events
package.json 5/5 Correct SDK and peer dependencies added
.gitignore 5/5 .env properly gitignored
posthog-setup-report.md 4/5 Comprehensive report documenting all changes and next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Dependencies added correctly, no syntax errors, valid JSX
Preserves existing env vars & configs Yes Existing app code preserved; only PostHog additions and minor reformatting
No syntax or type errors Yes All JS syntax is valid
Correct imports/exports Yes posthog-react-native imports are correct (PostHog, PostHogProvider)
Minimal, focused changes No Gratuitous reformatting throughout (arrow function parens, multiline wrapping of existing code)
Pre-existing issues None Base app appears functional

Issues

  • Gratuitous reformatting: Arrow function parameters and multi-line wrapping changed in several sagas (e.g., state => state.auth.token(state) => state.auth.token, multiline getPermissionsSuccess calls). These are style-only changes unrelated to PostHog. [LOW]
  • No .env.example committed: A .env file exists locally but is gitignored. No .env.example is committed, making it hard for other developers to discover required env vars (POSTHOG_PROJECT_TOKEN, POSTHOG_HOST). [MEDIUM]

Other completed criteria

  • App builds without errors — dependencies and syntax are valid
  • Existing navigation structure, screens, and saga flows preserved
  • Import statements all resolve to correct packages
  • package.json dependencies are valid and parseable

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-react-native ^4.45.5 added with peer deps (react-native-device-info, react-native-localize, react-native-svg)
PostHog client initialized Yes new PostHog(apiKey, { host, disabled, captureAppLifecycleEvents, debug }) — correct pattern for bare React Native
capture() Yes 8 meaningful events across auth, teams, projects, and members sagas
identify() No Uses raw email as distinct_id — should use a stable user ID from the API response
Error tracking No No captureException() calls, no exception autocapture setup
Reverse proxy N/A React Native mobile app — reverse proxy is not applicable

Issues

  • Email as distinct_id: posthog.identify(email, { email }) on lines 61 and 73 of auth/sagas.js uses the user's email as the distinct ID. Per best practices, distinct IDs should be stable, unique identifiers (database user ID, UUID). Emails can change and are PII, leading to fragmented user profiles. For the real (non-demo) login path, response.data likely contains a user ID or the JWT token could be decoded. [CRITICAL]
  • No error tracking: No captureException() usage anywhere in the codebase. The catch blocks in sagas only show toasts. Adding posthog.captureException(err) in catch blocks would enable error tracking. [MEDIUM]
  • No re-identification on app resume: The init() saga in auth/sagas.js restores the session token from AsyncStorage but does not call posthog.identify(). Users returning to the app after a cold start will send events anonymously until they sign in again. [MEDIUM]

Other completed criteria

  • PostHog SDK correctly added to package.json with appropriate peer dependencies
  • API key and host loaded from environment variables via react-native-config
  • Host correctly configured (pointing to https://us.i.posthog.com via env)
  • PostHogProvider correctly wraps navigator inside NavigationContainer
  • Manual screen tracking via onStateChange avoids duplicate events (captureScreens: false)
  • posthog.reset() correctly called on sign-out
  • Graceful degradation when PostHog env vars are missing (disabled: !isPostHogConfigured)

PostHog insights and events ✅

Filename PostHog events Description
src/routes.js screen (via posthog.screen()) Tracks screen navigation changes with previous_screen property
src/store/modules/auth/sagas.js user_signed_in, sign_in_failed, user_signed_out Core auth lifecycle: sign-in success (with demo flag), failure, and sign-out with session reset
src/store/modules/teams/sagas.js team_created, team_switched Team management: creation with name, switching with team ID and name
src/store/modules/projects/sagas.js project_created Project creation with title property
src/store/modules/members/sagas.js member_invited, member_role_updated Member management: invitation and role changes

Issues

  • member_invited missing invite email property: The non-demo path for member_invited has no properties at all. Adding the count or role of invited members would enrich analytics. [LOW]
  • sign_in_failed has no properties: No error type or reason is captured, limiting debugging value. [LOW]

Other completed criteria

  • Events represent real user actions mapping to actual product flows (auth, team management, project management, member management)
  • Events enable product insights — can build sign-in funnel, team activation funnel, retention by team/project creation
  • Most events include relevant properties (is_demo, team_name, team_id, project_title, member_id)
  • No PII in event properties — email is only in identify() person properties, not in capture() calls
  • Event names are descriptive, consistent snake_case convention

Reviewed by wizard workbench PR evaluator

@wizard-ci-bot wizard-ci-bot Bot added the CI/CD label May 13, 2026
@wizard-ci-bot wizard-ci-bot Bot closed this May 13, 2026
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