Skip to content

[CI] (6b2dc8b) react-router/react-router-v7-project - #3738

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-6b2dc8b-react-router-react-router-v7-project
Closed

[CI] (6b2dc8b) react-router/react-router-v7-project#3738
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-6b2dc8b-react-router-react-router-v7-project

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 6b2dc8b
App: react-router/react-router-v7-project
App directory: apps/react-router/react-router-v7-project
Workbench branch: wizard-ci-6b2dc8b-react-router-react-router-v7-project
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-09-01T15:58:16.029Z
Duration: 465.9s

YARA Scanner

✓ 148 tool calls scanned, 0 violations detected

No violations: ✓ 148 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Author

Now I have enough context. Let me produce the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into a React Router v7 framework-mode app by adding posthog-js initialization in entry.client.tsx, user identification in AuthContext.tsx, and custom event captures for country interactions in countries.tsx. Environment variables are documented in a new .env.example.

Files changed Lines added Lines removed
5 +127 -6

Confidence score: 5/5 🧙

  • The ErrorBoundary in root.tsx does not call posthog.captureException(error), so React rendering errors caught by the boundary are silently lost despite capture_exceptions being configured in init (which only covers window-level unhandled errors). [MEDIUM]
  • No reverse proxy is configured, so client-side events are susceptible to ad-blocker interception. [MEDIUM]

File changes

Filename Score Description
.env.example 5/5 New file documenting VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST
app/entry.client.tsx 4/5 PostHog init with defaults, capture_exceptions, env var validation with dev-only error throwing
app/context/AuthContext.tsx 5/5 Identify on login/signup/page-load, reset on logout, handles account-switching with reset-before-identify
app/routes/countries.tsx 5/5 Captures country_claimed, country_liked, country_visited with enriched properties; guards against duplicate actions
package.json 5/5 posthog-js added to dependencies

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax/type errors; posthog-js only imported client-side or via dynamic import
Preserves existing env vars & configs Yes No existing config modified; only additions
No syntax or type errors Yes All TypeScript is valid
Correct imports/exports Yes posthog-js imported correctly in client-only file and via dynamic import() elsewhere
Minimal, focused changes Yes All changes directly related to PostHog integration
Pre-existing issues vite.config.ts missing ssr.noExternal for posthog-js The React Router v7 framework mode docs recommend ssr: { noExternal: ['posthog-js'] } in vite.config.ts. However, since posthog-js is only imported in entry.client.tsx (a client-only file) and via dynamic imports, this may not cause issues in practice.

Issues

  • Missing ssr.noExternal config: The React Router v7 framework mode docs recommend adding ssr: { noExternal: ['posthog-js'] } to vite.config.ts. Since posthog-js is only used in client-only contexts here, this likely won't cause build failures, but it's a deviation from the recommended pattern. [LOW]

Other completed criteria

  • Environment variables documented in .env.example
  • package.json has valid dependency entry for posthog-js
  • Existing app code and structure preserved

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js: ^1.424.0 added to package.json
PostHog client initialized Yes posthog.init() in entry.client.tsx with api_host, defaults: "2026-05-30", and capture_exceptions config
capture() Yes 6 distinct capture calls: login_completed, signup_completed, logout_completed, country_claimed, country_liked, country_visited
identify() Yes posthog.identify(user.id, { email, name }) on login, signup, and page load; posthog.reset() on logout and account switch
Error tracking Yes capture_exceptions configured in init with capture_unhandled_errors: true and capture_unhandled_rejections: true
Reverse proxy No No reverse proxy configured

Issues

  • ErrorBoundary not capturing exceptions: The existing ErrorBoundary in root.tsx catches React rendering errors but does not call posthog.captureException(error). The capture_exceptions config in init only handles window-level unhandled errors/rejections — errors caught by React's error boundary never reach window.onerror and are silently lost. Add posthog.captureException(error) in the ErrorBoundary component. [MEDIUM]
  • No reverse proxy: No reverse proxy is configured (via Vite rewrites, Vercel rewrites, or managed proxy). Client-side PostHog events are directly sent to us.i.posthog.com and will be blocked by common ad blockers. [MEDIUM]
  • Missing @posthog/react package: The React Router v7 framework mode docs recommend installing @posthog/react alongside posthog-js and using PostHogProvider. The PR uses direct imports instead, which works but misses out on usePostHog, PostHogErrorBoundary, and feature flag hooks. [LOW]

Other completed criteria

  • API key loaded from VITE_PUBLIC_POSTHOG_PROJECT_TOKEN env variable (not hardcoded)
  • API host loaded from VITE_PUBLIC_POSTHOG_HOST env variable
  • Dev-only validation errors thrown when env vars are missing
  • Account-switching handled correctly: reset() called before identify() when switching users
  • posthog.reset() called on logout
  • Identify called on page load for returning users

PostHog insights and events ✅

Filename PostHog events Description
AuthContext.tsx login_completed, signup_completed, logout_completed Full auth lifecycle tracking with identify/reset; enables auth funnel analysis
AuthContext.tsx posthog.identify(), posthog.reset() User identification with user.id as distinct_id, email and name as person properties
countries.tsx country_claimed, country_liked, country_visited Core product interaction events with enriched properties (country_name, region, count)
entry.client.tsx captureException (auto) Unhandled errors and promise rejections auto-captured via capture_exceptions config

Issues

  • No issues with event quality.

Other completed criteria

  • Events represent real user actions (auth flow + country interactions)
  • Events enable product insights (auth funnel, country engagement trends, retention by region)
  • Events include enriched properties (country_name, region, running counts)
  • No PII in capture properties — email/name correctly placed in identify person properties
  • Event names are descriptive, 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