Skip to content

[CI] (f51b3be) react-router/rrv7-starter - #2645

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-f51b3be-react-router-rrv7-starter
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-f51b3be-react-router-rrv7-starter

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-router/rrv7-starter
App directory: apps/react-router/rrv7-starter
Workbench branch: wizard-ci-f51b3be-react-router-rrv7-starter
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T22:41:31.943Z
Duration: 329.5s

YARA Scanner

✓ 96 tool calls scanned, 0 violations detected

No violations: ✓ 96 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

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


PR Evaluation Report

Summary

This PR integrates PostHog into a React Router v7 framework mode app ("CloutHub"). It adds client-side initialization via entry.client.tsx with PostHogProvider, server-side middleware with posthog-node, error boundary exception capture, a Vite dev proxy for /ingest, and custom analytics events across home, feed, profile, buy-followers, and analytics pages.

Files changed Lines added Lines removed
12 +296 -65

Confidence score: 4/5 👍

  • analytics_summary_viewed and profile_summary_viewed captured in useEffect: These events fire inside useEffect reacting to page load, which is an anti-pattern per React rules — page-view-like events are better handled via autocapture or explicit capture outside useEffect. Additionally, posthog is listed as a dependency, which could cause re-fires. [MEDIUM]
  • .env.example not updated with PostHog variables: The .env.example file still only contains VITE_SITE_URL. The new PostHog env vars (VITE_PUBLIC_POSTHOG_PROJECT_TOKEN, VITE_PUBLIC_POSTHOG_HOST) are only in .env, which is typically gitignored. Collaborators won't know what to set. [MEDIUM]
  • __add_tracing_headers is an internal/private API: The documented option is tracing_headers, not __add_tracing_headers. Using a double-underscore prefixed internal property is fragile and may break without notice. [MEDIUM]
  • No identify() call anywhere: There is no posthog.identify() call in the codebase. All events will be anonymous, preventing linking user actions across sessions or devices. [CRITICAL]
  • No posthog.reset() on logout: Without identify there's nothing to reset, but even structurally there's no logout handling. [LOW]

File changes

Filename Score Description
app/entry.client.tsx 4/5 New file: initializes posthog-js with PostHogProvider, reverse proxy, and tracing headers. Uses internal __add_tracing_headers instead of tracing_headers.
app/lib/posthog-middleware.ts 5/5 Server-side middleware: creates PostHog Node client per request with context from tracing headers, shuts down in finally block. Clean implementation matching docs.
app/root.tsx 4/5 Adds middleware export and error boundary with captureException. Correct pattern.
app/components/PostCard.tsx 5/5 Adds feed_post_liked capture in click handler with good properties.
app/routes/home.tsx 5/5 Adds CTA click captures in event handlers and PostHogCaptureOnViewed for stats section.
app/routes/buy-followers.tsx 5/5 Good funnel events: package_selected, checkout_started, completed — all in handlers.
app/routes/profile.tsx 3/5 profile_summary_viewed in useEffect with [posthog] dependency — anti-pattern. Follow-back capture is correct.
app/routes/analytics.tsx 3/5 analytics_summary_viewed in useEffect with [posthog] dependency — anti-pattern.
package.json 5/5 Adds posthog-js, @posthog/react, posthog-node.
vite.config.ts 4/5 Adds dev proxy for /ingest with correct static/array/main routing. Adds posthog-js to SSR noExternal.
react-router.config.ts 5/5 Enables v8_middleware future flag needed for middleware support.
posthog-setup-report.md 5/5 Useful setup report with event table and next steps.

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Wizard report confirms typecheck and build passed
Preserves existing env vars & configs Yes Existing configs preserved; PostHog additions are additive
No syntax or type errors Yes Build and typecheck verified per report
Correct imports/exports Yes All imports from correct packages (posthog-js client-side, posthog-node server-side)
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None No pre-existing issues noted

Issues

  • .env.example not updated: The PostHog env vars VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST are only in .env (not committed). The .env.example was not updated, so collaborators won't know what variables to set. [MEDIUM]

Other completed criteria

  • Build configuration is valid — vite.config.ts changes are syntactically correct and functional
  • Package.json dependencies are properly added with valid version ranges
  • react-router.config.ts correctly enables middleware future flag

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.399.1, @posthog/react@^1.10.3, posthog-node@^5.40.0 in package.json
PostHog client initialized Yes posthog.init() in entry.client.tsx with env vars, wrapped in PostHogProvider. Server-side middleware creates PostHog Node client per request.
capture() Yes 9 meaningful capture calls across components and routes
identify() No No posthog.identify() call anywhere in the codebase. All events remain anonymous.
Error tracking Yes posthog?.captureException(error) in root ErrorBoundary. Server-side middleware has enableExceptionAutocapture: true.
Reverse proxy Yes Vite dev proxy at /ingest with correct /ingest/static → us-assets.i.posthog.com, /ingest/array → us-assets.i.posthog.com, and /ingest → us.i.posthog.com. api_host set to /ingest.

Issues

  • Missing identify() call: No user identification is implemented. The docs state "Identifying users is required." All events will have anonymous distinct IDs, preventing cross-session or cross-device user linking. Should add posthog.identify(userId, { email, name }) after login. [CRITICAL]
  • __add_tracing_headers instead of tracing_headers: The entry client uses __add_tracing_headers which is an internal/undocumented API. The documented option is tracing_headers. This could break without notice in future SDK updates. [MEDIUM]
  • Reverse proxy is dev-only: The Vite dev server proxy only works during development. No production reverse proxy (e.g., Vercel rewrites) is configured, so the /ingest path will 404 in production. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable (import.meta.env.VITE_PUBLIC_POSTHOG_PROJECT_TOKEN)
  • Host correctly configured via env var and reverse proxy
  • PostHogProvider wraps the app correctly in framework mode pattern
  • Server-side middleware correctly extracts tracing headers and uses withContext
  • posthog.shutdown() called in finally block on server

PostHog insights and events ⚠️

Filename PostHog events Description
app/routes/home.tsx cta_clicked, home_stats_preview_viewed CTA clicks tracked in click handlers with destination/location properties. Stats preview tracked via PostHogCaptureOnViewed component.
app/routes/buy-followers.tsx buy_followers_package_selected, buy_followers_checkout_started, buy_followers_completed Full purchase funnel: selection → checkout → completion with price, amounts, and totals.
app/components/PostCard.tsx feed_post_liked Like/unlike toggle with post metadata. Captured in click handler.
app/routes/profile.tsx profile_follow_back_clicked, profile_summary_viewed Follow-back in handler (good). Summary view in useEffect (anti-pattern).
app/routes/analytics.tsx analytics_summary_viewed Analytics page view with metrics context. Captured in useEffect (anti-pattern).
app/root.tsx captureException Error boundary captures unhandled exceptions.

Issues

  • useEffect capture anti-pattern: analytics_summary_viewed and profile_summary_viewed are captured inside useEffect with [posthog] as a dependency. Per React rules, analytics capture should not be placed in useEffect reacting to state changes. If posthog reference changes (e.g., provider re-renders), these events will fire again. These are essentially page-view events that could be handled by autocapture or a more controlled pattern. [MEDIUM]

Other completed criteria

  • Events represent real user actions (CTA clicks, purchases, likes, follows)
  • Events enable product insights — full purchase funnel can be built from package_selected → checkout_started → completed
  • Events include relevant properties (prices, counts, usernames, locations)
  • No PII in event properties — usernames are fake app data, no emails/names/phones in capture properties
  • Event names are descriptive and use 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