Skip to content

[CI] (9da603e) react-router/react-router-v7-project - #4406

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-9da603e-react-router-react-router-v7-project

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 9da603e
App: react-router/react-router-v7-project
App directory: apps/react-router/react-router-v7-project
Workbench branch: wizard-ci-9da603e-react-router-react-router-v7-project
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-06T16:00:00.980Z
Duration: 477.4s

YARA Scanner

✓ 191 tool calls scanned, 0 violations detected

No violations: ✓ 191 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. Let me produce the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into a React Router v7 framework mode app. It adds posthog-js initialization in entry.client.tsx, user identification via the AuthContext, custom event captures for country interactions, a logging utility, and environment variable documentation. The integration uses vanilla posthog-js directly rather than the recommended @posthog/react provider pattern.

Files changed Lines added Lines removed
6 +172 -5

Confidence score: 4/5 👍

  • Missing @posthog/react and PostHogProvider: The React Router v7 framework mode docs recommend using @posthog/react with PostHogProvider wrapping the app in entry.client.tsx. This PR uses vanilla posthog-js with dynamic imports scattered across components instead. [MEDIUM]
  • Missing ssr.noExternal for posthog-js: The React Router v7 framework mode docs explicitly require adding posthog-js to ssr.noExternal in vite.config.ts to avoid SSR errors. This is absent. [CRITICAL]
  • No reverse proxy configured: No rewrite rules or proxy setup to route PostHog requests through a first-party domain, which is recommended to avoid ad blockers. [MEDIUM]
  • ErrorBoundary does not capture exceptions to PostHog: The existing ErrorBoundary in root.tsx was not modified to call posthog.captureException(), missing a key error tracking integration point. [MEDIUM]
  • posthog.logger API usage is incorrect: The posthog-logs.client.ts file calls posthog.logger.info(), posthog.logger.warn(), and posthog.logger.error(). The documented API method is posthog.captureLog() — posthog.logger is the SDK's internal debug logger, not the log capture API. [CRITICAL]

File changes

Filename Score Description
.env.example 4/5 Adds VITE_POSTHOG_PROJECT_TOKEN and VITE_POSTHOG_HOST env vars
app/context/AuthContext.tsx 4/5 Adds identify on login/signup/restore, reset on logout, with account-switch handling
app/entry.client.tsx 3/5 Initializes PostHog with error tracking; missing PostHogProvider, outdated defaults date
app/lib/posthog-logs.client.ts 1/5 Uses incorrect posthog.logger.* API instead of posthog.captureLog()
app/routes/countries.tsx 4/5 Adds capture calls for country actions with enriched properties
package.json 3/5 Adds posthog-js but missing @posthog/react

App sanity check ⚠️

Criteria Result Description
App builds and runs No Missing ssr.noExternal config for posthog-js will likely cause SSR errors in framework mode
Preserves existing env vars & configs Yes No existing env vars or configs were modified
No syntax or type errors No posthog.logger.info/warn/error is an internal debug logger, not the public log capture API
Correct imports/exports Yes All imports resolve correctly
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None

Issues

  • Missing ssr.noExternal in vite.config.ts: React Router v7 framework mode docs require ssr: { noExternal: ['posthog-js'] } in vite.config.ts to prevent SSR bundling errors. Without this, the build may fail or throw runtime errors during server rendering. [CRITICAL]
  • Incorrect posthog.logger API: posthog.logger is the SDK's internal debug logging facility. The correct method for sending structured logs to PostHog is posthog.captureLog({ body, level, attributes }). The entire posthog-logs.client.ts utility won't send any logs to PostHog. [CRITICAL]
  • defaults date is outdated: Uses "2026-01-30" but the docs show "2026-05-30" as the current defaults snapshot. [LOW]

Other completed criteria

  • Environment variables are documented in .env.example
  • Build configuration (package.json) is valid with correct dependency added

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.438.1 added to package.json
PostHog client initialized Yes posthog.init() called in entry.client.tsx with env-based token and host, with error tracking config
capture() Yes Multiple meaningful captures: country_claimed, country_liked, country_visited, user_logged_in, user_signed_up, user_logged_out
identify() Yes posthog.identify(user.id, { email, username }) on login, signup, and session restore with reset() for account switching
Error tracking No capture_exceptions is configured in init() for unhandled errors, but the existing ErrorBoundary in root.tsx was not updated to call posthog.captureException(error) for caught route errors
Reverse proxy No No reverse proxy or rewrite configuration found

Issues

  • No PostHogProvider wrapper: The React Router v7 framework mode docs recommend wrapping the app with PostHogProvider from @posthog/react in entry.client.tsx. Without it, React hooks like usePostHog, useFeatureFlagEnabled, etc. won't work. The current approach uses dynamic import('posthog-js') throughout, which is functional but non-idiomatic for React. [MEDIUM]
  • ErrorBoundary not wired to PostHog: The ErrorBoundary in root.tsx renders error UI but does not call posthog.captureException(error). This means route-level errors caught by React Router are not reported to PostHog's error tracking. [MEDIUM]
  • No reverse proxy: Client-side PostHog requests go directly to us.i.posthog.com (or configured host), making them vulnerable to ad blockers. [MEDIUM]

Other completed criteria

  • API key loaded from VITE_POSTHOG_PROJECT_TOKEN environment variable
  • Host configured from VITE_POSTHOG_HOST environment variable
  • posthog.reset() called on logout and before identify when switching accounts
  • Identity restored on page load via useEffect with hasRestoredIdentity ref guard
  • user.id used as distinct_id (stable identifier, not email)

PostHog insights and events ⚠️

Filename PostHog events Description
AuthContext.tsx user_logged_in, user_signed_up, user_logged_out Auth lifecycle events with identify/reset; no additional properties on captures
countries.tsx country_claimed, country_liked, country_visited Country interaction events with country_region, total_claimed_countries, total_liked_countries, total_visited_countries, total_points properties
entry.client.tsx captureException (auto) Unhandled errors and rejections captured automatically
posthog-logs.client.ts (broken) Attempts to send structured logs but uses wrong API (posthog.logger.* instead of posthog.captureLog())

Issues

  • Broken log capture utility: posthog-logs.client.ts calls posthog.logger.info/warn/error which is the SDK's internal debug logger (used for console output), not the posthog.captureLog() API for sending structured logs to PostHog. All log calls in countries.tsx are effectively no-ops for analytics purposes. [CRITICAL]
  • Auth events lack properties: user_logged_in, user_signed_up, and user_logged_out are captured without any enriching properties (e.g., login method, signup source). [LOW]

Other completed criteria

  • Events represent real user actions (auth flows, country interactions)
  • Events enable product insights (can build funnels: signup → claim → like)
  • Country action events include rich contextual properties
  • No PII in event properties (email/username only in identify() person properties)
  • Event names use consistent snake_case convention and are descriptive

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