Skip to content

[CI] (f51b3be) react-native/expo-react-native-hacker-news - #2642

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

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

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: f51b3be
App: react-native/expo-react-native-hacker-news
App directory: apps/react-native/expo-react-native-hacker-news
Workbench branch: wizard-ci-f51b3be-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-09T22:37:43.396Z
Duration: 258.5s

YARA Scanner

✓ 74 tool calls scanned, 0 violations detected

No violations: ✓ 74 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

Now I have enough context. This is a React Native (Expo) app — not a web React app. The framework detection says "javascript_web, react" but it's actually React Native. Let me evaluate accordingly.


PR Evaluation Report

Summary

This PR integrates PostHog into an Expo React Native Hacker News app using the posthog-react-native SDK. It adds a PostHog client initialization module, wraps the app with PostHogProvider, implements manual screen tracking, and adds extensive custom event capture across story feeds, item details, comments, and user profiles. Exception capture is also included for error scenarios.

Files changed Lines added Lines removed
13 +284 -28

Confidence score: 4/5 👍

  • useEffect for user action tracking: Multiple useEffect hooks are used to capture events that should be in event handlers (e.g., story_type_selected in index.tsx fires on mount AND on change, not just when the user selects). This is an anti-pattern for React and will produce misleading data. [MEDIUM]
  • Excessive data-loaded events in useEffect: Events like story_feed_loaded, comment_thread_loaded, and user_activities_loaded fire inside useEffect watching data arrays, meaning they re-fire on every re-render where data reference changes. These are noisy and don't represent deliberate user actions. [MEDIUM]
  • No .env.example file: The .env file contains a real API key (phc_nmum...) but there's no .env.example documenting the required variables. The setup report mentions this as a TODO but it wasn't done. [MEDIUM]
  • No identify() call: There is no user identification anywhere in the app. While this is a Hacker News reader without authentication, the lack of identify() means all users remain anonymous with no way to link sessions. [MEDIUM]

File changes

Filename Score Description
lib/posthog.ts 4/5 New PostHog client initialization with env var fallback, validation, and graceful degradation
app/_layout.tsx 4/5 PostHogProvider wrapper and manual screen tracking with previous screen reference
app/[itemId].tsx 3/5 Event capture for item details, but uses useEffect for view tracking
app/index.tsx 2/5 story_type_selected event fires in useEffect — fires on initial mount (not a user action)
app/users/[userId].tsx 3/5 User profile view tracking via useEffect
components/posts/Post.tsx 4/5 Good event capture in click handlers for story navigation and external links
components/posts/Posts.tsx 3/5 Feed loaded event in useEffect, plus exception capture for query errors
components/comments/comment.tsx 4/5 Event capture in press handlers for comment author and thread navigation
components/comments/comments.tsx 3/5 Comment thread loaded event in useEffect
components/posts/user-activities/UserActivities.tsx 3/5 Activities loaded event in useEffect
package.json 4/5 Correct SDK and peer dependencies added
app.json 3/5 Extra config for env vars but uses string interpolation syntax that may not work in app.json
posthog-setup-report.md N/A Setup documentation

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes All imports resolve, correct SDK used for React Native
Preserves existing env vars & configs Yes Existing config preserved, PostHog additions are additive
No syntax or type errors Yes Code is syntactically valid TypeScript/TSX
Correct imports/exports Yes posthog-react-native correctly used throughout (not posthog-js)
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None Base app appears functional

Issues

  • app.json string interpolation: The "" syntax in app.json is not standard JSON interpolation — this only works with app.config.js/app.config.ts. However, the code in lib/posthog.ts has a fallback to process.env.EXPO_PUBLIC_POSTHOG_KEY, so the app will still work. [LOW]

Other completed criteria

  • Environment variables documented in setup report (though no .env.example file created)
  • Build configuration is valid with correct peer dependencies added
  • Code follows existing codebase patterns and naming conventions

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-react-native@^4.55.0 added with peer deps (expo-application, expo-device, expo-file-system, expo-localization)
PostHog client initialized Yes Correct React Native initialization pattern in lib/posthog.ts using new PostHog() with host, lifecycle events, and debug mode
capture() Yes Multiple meaningful capture calls across components
identify() N/A App has no authentication — it's a read-only Hacker News browser
Error tracking Yes captureException() used for failed item loads and story feed errors
Reverse proxy N/A React Native app — reverse proxy is not applicable for mobile SDKs

Issues

  • No .env.example: The .env file exists with a real API key but no .env.example template was created for documentation purposes. The setup report acknowledges this as a TODO. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable via Expo Constants and process.env fallback
  • API host correctly configured pointing to https://us.i.posthog.com
  • PostHogProvider correctly wraps the app with autocapture configuration
  • Manual screen tracking implemented with previous screen reference
  • Graceful degradation when env vars are missing (disabled mode)

PostHog insights and events ⚠️

Filename PostHog events Description
app/_layout.tsx `` (via posthog.screen()) Manual screen tracking with previous screen context and route params
app/index.tsx story_type_selected Fires when story type changes (but also on mount — see issues)
app/[itemId].tsx item_detail_viewed, comment_author_opened, story_external_link_opened, parent_item_opened, captureException Item detail view tracking with metadata, interaction tracking in handlers, error capture for missing items
app/users/[userId].tsx user_profile_viewed Profile view with karma and about metadata
components/posts/Post.tsx story_opened, story_comments_opened, story_external_link_opened Navigation and external link tracking in press handlers
components/posts/Posts.tsx story_feed_loaded, captureException Feed load tracking and error capture for failed queries
components/comments/comment.tsx comment_author_opened, comment_thread_opened Comment interaction tracking in press handlers
components/comments/comments.tsx comment_thread_loaded Comment thread load tracking
components/posts/user-activities/UserActivities.tsx user_activities_loaded User activity list load tracking

Issues

  • useEffect for story_type_selected: In app/index.tsx, the story_type_selected event fires inside a useEffect watching storyType. This fires on initial component mount with the default value "topstories", creating a misleading event that looks like the user actively selected a story type. The event should be captured in the onChange handler of StoriesSelect. [MEDIUM]
  • Noisy data-loaded events: Events like story_feed_loaded, comment_thread_loaded, and user_activities_loaded fire in useEffect hooks watching data arrays. These can re-fire when data references change (e.g., React Query background refetches). They represent system behavior, not user actions, and will create noise. [MEDIUM]

Other completed criteria

  • Events represent real user actions (navigation, link clicks, profile views) when placed in handlers
  • Events enable product insights — can build funnel from feed → story → comments → external link
  • Events include relevant properties (item_id, item_type, source, url_host, comment counts)
  • No PII in event properties — only item IDs, types, and counts
  • 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