[CI] (cef44b4) react-router/react-router-v7-project#1405
Closed
wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
Closed
[CI] (cef44b4) react-router/react-router-v7-project#1405wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a React Router v7 framework-mode app ("RESTExplorer"), adding client-side SDK initialization via
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax errors; dependencies added correctly; SSR config valid |
| Preserves existing env vars & configs | Yes | Existing configs extended, not replaced |
| No syntax or type errors | Yes | All TypeScript/JSX is valid |
| Correct imports/exports | Yes | All imports resolve to correct packages |
| Minimal, focused changes | Yes | All changes relate to PostHog integration |
| Pre-existing issues | None | — |
Issues
leaderboard_viewedcapture in render body:posthog?.capture('leaderboard_viewed', ...)instats.tsxis called directly during render, not inside auseEffector event handler. This violates React best practices and will send duplicate events on every re-render. Move to auseEffectwith appropriate dependencies. [MEDIUM]- No .env.example committed: The
.envfile exists locally but is not committed. New developers won't know which environment variables are required. The setup report mentions them, but a.env.exampleis the standard approach. [LOW]
Other completed criteria
- All changes are relevant to PostHog integration
- Correct files modified for React Router v7 framework mode (entry.client.tsx, root.tsx, middleware, vite.config.ts)
- Code follows existing codebase patterns (naming, structure, indentation)
- Build configuration is valid (package.json scripts unmodified, vite config extended properly)
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.372.6, @posthog/react@^1.9.0, posthog-node@^5.32.1 in package.json |
| PostHog client initialized | Yes | posthog.init() in entry.client.tsx with env vars, defaults, and tracing headers; PostHogProvider wraps app; server middleware creates posthog-node client per request |
| capture() | Yes | 10+ meaningful capture calls across routes |
| identify() | Yes | Called on login (username) and signup (username + email as person props); reset() called on logout |
| Error tracking | Yes | posthog.captureException(error) in ErrorBoundary in root.tsx |
| Reverse proxy | No | Vite dev server proxy configured for /ingest/* with correct /static and /array asset routes, but api_host in posthog.init() points to import.meta.env.VITE_PUBLIC_POSTHOG_HOST (raw PostHog URL), not /ingest. The proxy is never hit. |
Issues
- Reverse proxy not wired to client: The Vite proxy at
/ingest/*is correctly set up with/ingest/staticand/ingest/arrayrouting tous-assets.i.posthog.com, butposthog.init()usesapi_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOSTwhich resolves tohttps://us.i.posthog.com. Theapi_hostshould be set to/ingest(or the proxy path) for the reverse proxy to be used. Additionally, this Vite proxy only works in dev mode — a production reverse proxy (e.g., via server rewrites) would be needed for production. [CRITICAL] - Username as distinct_id:
posthog.identify(username, ...)uses a username string as the distinct ID. For a production app, a stable internal user ID is preferred. Acceptable for this fake/demo app. [LOW]
Other completed criteria
- API key loaded from
VITE_PUBLIC_POSTHOG_PROJECT_TOKENenvironment variable (not hardcoded) - Host correctly configured from environment variable
- Server-side middleware correctly extracts session/distinct IDs from tracing headers
posthog.reset()called on logout to unlink userv8_middlewarefuture flag enabled in react-router.config.ts for middleware supportssr.noExternalconfigured for posthog-js and @posthog/react to avoid SSR bundling issues
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
app/routes/signup.tsx |
user_signed_up |
Fires on successful signup with username and email properties; also calls identify |
app/routes/login.tsx |
user_logged_in |
Fires on successful login with username; also calls identify |
app/routes/profile.tsx |
user_logged_out |
Fires on logout button click; followed by posthog.reset() |
app/routes/home.tsx |
explore_now_clicked |
CTA click on homepage — top of conversion funnel |
app/routes/countries.tsx |
country_claimed, country_liked, country_visited, country_region_filtered, achievement_unlocked |
Rich interaction tracking with country/region properties and achievement detection |
app/routes/stats.tsx |
leaderboard_viewed |
Page view with user_rank, total_points, claimed_countries — but fires on every render |
app/root.tsx |
captureException |
Error boundary captures exceptions automatically |
Issues
- PII in
user_signed_upevent properties:posthog.capture('user_signed_up', { username: newUser.username, email: newUser.email })includesemaildirectly in event properties. Email is PII and should only appear in person properties (viaidentify()). Theidentify()call on the line above already sets email correctly. Removeemailfrom the capture call properties. [MEDIUM] leaderboard_viewedfires on every re-render: The capture call is in the render body ofStatscomponent, not guarded byuseEffect. Every state change or parent re-render will send a duplicate event. Wrap inuseEffect(() => { posthog?.capture(...) }, []). [MEDIUM]
Other completed criteria
- Events represent real user actions (signup, login, logout, claim, like, visit, filter, view leaderboard)
- Events enable product insights — can build signup→explore→claim funnel, engagement trends, achievement analysis
- Events include relevant properties (country, region, user_rank, total_points, achievement_name)
- Event names are descriptive and use consistent snake_case convention
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: context-mill-pr
Trigger ID:
cef44b4App:
react-router/react-router-v7-projectApp directory:
apps/react-router/react-router-v7-projectWorkbench branch:
wizard-ci-cef44b4-react-router-react-router-v7-projectWizard branch:
mainContext Mill branch:
basic-skills-v2PostHog (MCP) branch:
masterTimestamp: 2026-05-01T21:08:20.538Z
Duration: 370.2s