Skip to content

[CI] (e2f7ab0) react-native/expo-react-native-hacker-news#2428

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-e2f7ab0-react-native-expo-react-native-hacker-news
Closed

[CI] (e2f7ab0) react-native/expo-react-native-hacker-news#2428
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-e2f7ab0-react-native-expo-react-native-hacker-news

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: e2f7ab0
App: react-native/expo-react-native-hacker-news
App directory: apps/react-native/expo-react-native-hacker-news
Workbench branch: wizard-ci-e2f7ab0-react-native-expo-react-native-hacker-news
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-06T22:10:27.916Z
Duration: 303.7s

YARA Scanner

✓ 81 tool calls scanned, 0 violations detected

No violations: ✓ 81 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into an Expo React Native Hacker News reader app by adding the posthog-react-native SDK, initializing it in lib/posthog.ts, wrapping the app with PostHogProvider, and adding 14 custom analytics events across story feeds, comments, and user profiles. Screen tracking is implemented manually via posthog.screen() in the root layout.

Files changed Lines added Lines removed
12 +346 -35

Confidence score: 4/5 👍

  • No error tracking: No captureException, error boundary, or capture_exceptions config present — error tracking is entirely missing. [CRITICAL]
  • Excessive useEffect analytics: Many capture calls (story_list_loaded, comment_thread_loaded, story_details_loaded, etc.) fire inside useEffect reacting to data state changes rather than in event handlers. These can fire multiple times as data references change (e.g., on each infinite query page load), producing duplicate/inflated events. [MEDIUM]
  • Environment variables not documented: No .env.example committed; collaborators won't know which env vars to configure. [MEDIUM]

File changes

Filename Score Description
lib/posthog.ts 4/5 New file: initializes PostHog client with env vars, graceful disabled mode when unconfigured
app/_layout.tsx 4/5 Wraps app in PostHogProvider, adds manual screen tracking with deduplication
app/[itemId].tsx 3/5 Adds story detail events; mix of good handler-based and problematic useEffect-based captures
app/users/[userId].tsx 3/5 Adds user_profile_loaded in useEffect
components/Select.tsx 5/5 Clean story_type_selected capture in onPress handler
components/comments/comment.tsx 5/5 Clean comment_opened capture in onPress handler
components/comments/comments.tsx 3/5 Two useEffect-based captures; comment_thread_loaded fires on every data change
components/posts/Post.tsx 4/5 Good handler-based captures for story opens and link opens
components/posts/Posts.tsx 3/5 useEffect-based story_list_loaded fires whenever posts/storyType deps change
components/posts/user-activities/UserActivities.tsx 3/5 Same useEffect pattern as Posts/Comments
package.json 5/5 Correct SDK and peer dependencies added
posthog-setup-report.md 2/5 Wizard report file — unnecessary artifact committed to the repo

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Syntax is valid, imports resolve, peer deps added
Preserves existing env vars & configs Yes Existing app logic preserved; only additions
No syntax or type errors Yes All code syntactically valid
Correct imports/exports Yes posthog-react-native imports are correct (usePostHog, PostHogProvider, default PostHog)
Minimal, focused changes No posthog-setup-report.md is an unnecessary artifact
Pre-existing issues None N/A

Issues

  • No .env.example committed: The .env file exists locally but isn't listed in changed files, and no .env.example is committed. Collaborators won't know which environment variables (EXPO_PUBLIC_POSTHOG_KEY, EXPO_PUBLIC_POSTHOG_HOST) are required. [MEDIUM]
  • Unnecessary report file: posthog-setup-report.md is a wizard artifact that doesn't belong in the committed codebase. [LOW]

Other completed criteria

  • App builds without syntax errors — all TypeScript/JSX is valid
  • Existing app functionality preserved — no existing behavior broken
  • Correctly adds expo-application, expo-device, expo-file-system, expo-localization as peer dependencies of posthog-react-native
  • Removed unused isFetchingNextPage destructuring (confirmed no remaining usage in codebase)

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-react-native@^4.54.4 added to package.json with required peer deps
PostHog client initialized Yes lib/posthog.ts creates instance with env vars, passed to PostHogProvider in _layout.tsx
capture() Yes 14 custom events captured across stories, comments, and user profiles
identify() N/A App is a read-only Hacker News reader with no authentication system
Error tracking No No captureException, error boundary, or exception autocapture configured
Reverse proxy N/A React Native app — reverse proxy is not applicable

Issues

  • No error tracking: No error boundary, no captureException calls, and no capture_exceptions config option. For a React Native app, PostHog supports exception autocapture and manual captureException(). Neither is implemented. [CRITICAL]

Other completed criteria

  • API key correctly loaded from EXPO_PUBLIC_POSTHOG_KEY environment variable
  • Host correctly loaded from EXPO_PUBLIC_POSTHOG_HOST environment variable
  • PostHogProvider correctly wraps the app with client={posthog}
  • Manual screen tracking implemented with pathname deduplication via useRef
  • Touch autocapture enabled with captureTouches: true
  • App lifecycle events enabled with captureAppLifecycleEvents: true
  • Graceful degradation when env vars are missing (disabled: !isPostHogConfigured)

PostHog insights and events ⚠️

Filename PostHog events Description
app/_layout.tsx screen (via posthog.screen()) Manual screen tracking on route changes with previous screen context
components/posts/Posts.tsx story_list_loaded, story_feed_paginated Tracks story feed loads and infinite scroll pagination
components/Select.tsx story_type_selected Tracks category filter changes (top, new, best, etc.)
components/posts/Post.tsx story_opened, story_link_opened Tracks story detail navigation and external link opens
app/[itemId].tsx story_details_loaded, story_author_opened, story_link_opened, comment_replied_context_opened Tracks detail view loads, author profile opens, and parent comment navigation
components/comments/comment.tsx comment_opened Tracks opening nested comments
components/comments/comments.tsx comment_thread_loaded, comment_thread_paginated Tracks comment thread loads and pagination
app/users/[userId].tsx user_profile_loaded Tracks user profile screen loads
components/posts/user-activities/UserActivities.tsx user_activities_loaded, user_activities_paginated Tracks user activity feed loads and pagination

Issues

  • useEffect-based analytics produce duplicate events: Events like story_list_loaded, comment_thread_loaded, and user_profile_loaded are captured inside useEffect with dependency arrays that include mutable references (posts, comments, posthog). These fire on every data reference change, not just on initial load. For example, story_list_loaded fires again whenever posts useMemo recalculates (on every new infinite query page), making it indistinguishable from a pagination event. [MEDIUM]
  • story_link_opened duplicated: The same event name is used in both Post.tsx and [itemId].tsx with slightly different property shapes, which can cause confusion in analytics. [LOW]

Other completed criteria

  • Events use consistent snake_case naming convention
  • Events include rich contextual properties (item_id, score, comment_count, etc.)
  • No PII in event properties — only HN public identifiers like author IDs
  • Event names are descriptive and map to real product flows (story browsing, commenting, user profiles)
  • Pagination tracking uses useRef to avoid re-firing for already-tracked pages
  • Events enable product insights — can build funnels from story_list → story_opened → story_link_opened

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