Skip to content

[CI] (a5131dd) react-router/saas-template - #2490

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-a5131dd-react-router-saas-template
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-a5131dd-react-router-saas-template

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: a5131dd
App: react-router/saas-template
App directory: apps/react-router/saas-template
Workbench branch: wizard-ci-a5131dd-react-router-saas-template
Wizard branch: fix/warlock-smoke-test-remove-killswitch
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-07T22:10:57.248Z
Duration: 985.4s

YARA Scanner

✓ 115 tool calls scanned, 0 violations detected

No violations: ✓ 115 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown
Author

Now I have enough context to produce the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into a React Router v7 framework-mode SaaS template with both client-side (posthog-js, @posthog/react) and server-side (posthog-node) instrumentation. It adds 14 custom events covering the full user lifecycle, a PostHog middleware for server-side context, user identification, logout reset, and error boundary exception capture.

Files changed Lines added Lines removed
21 +349 -62

Confidence score: 4/5 👍

  • Stripe webhook handlers use non-user distinct IDs: subscription_started uses organizationId and subscription_cancelled uses stripe_customer_id as distinctId. These are not real user IDs and will create orphaned person profiles in PostHog, fragmenting analytics data. Should use the actual user ID who initiated the action, or omit distinctId if unavailable. [MEDIUM]
  • No reverse proxy configured: No rewrites or proxy setup for client-side PostHog requests. Ad blockers will intercept tracking calls. [MEDIUM]
  • No .env.example updated: While env.server.ts validates the new vars, there's no .env.example or equivalent file updated to document VITE_POSTHOG_PROJECT_TOKEN and VITE_POSTHOG_HOST for other developers. [MEDIUM]

File changes

Filename Score Description
app/entry.client.tsx 5/5 Initializes posthog-js with PostHogProvider, tracing_headers, env vars
app/lib/posthog-middleware.ts 5/5 Server-side middleware with context-based distinct/session ID extraction
app/root.tsx 5/5 Registers middleware, adds ErrorBoundary exception capture
app/features/organizations/layout/nav-user.tsx 5/5 Calls posthog.reset() on logout
app/routes/.../\_sidebar-layout.tsx 4/5 identify() with real user ID in useEffect; exposes user data in loader
app/features/billing/stripe-event-handlers.server.ts 2/5 Uses organizationId/customerId as distinctId instead of user IDs
app/routes/.../pastes.tsx 3/5 Good event captures but heavy reformatting mixed with functional changes
vite.config.ts 5/5 Correct ssr.noExternal for posthog-js and @posthog/react
package.json 5/5 All three packages added correctly
app/utils/env.server.ts 5/5 Server-side env validation for PostHog vars
Other server action files 5/5 Consistent pattern: extract posthog from context, capture with properties

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors, correct imports, proper TypeScript
Preserves existing env vars & configs Yes Existing configs preserved, new vars added alongside existing ones
No syntax or type errors Yes All code is syntactically valid TypeScript/TSX
Correct imports/exports Yes All imports reference correct packages and paths
Minimal, focused changes No pastes.tsx has extensive reformatting (prop reordering, whitespace) mixed with PostHog changes
Pre-existing issues None

Issues

  • Unnecessary reformatting in pastes.tsx: Alphabetical reordering of JSX props and object keys, whitespace changes, and code style modifications account for ~80 lines of the diff that are unrelated to PostHog integration. [LOW]

Other completed criteria

  • Environment variables validated in env.server.ts schema
  • .env added to .gitignore (good practice)
  • ssr.noExternal correctly configured in vite.config.ts per docs
  • All PostHog imports use correct package names

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js, @posthog/react, and posthog-node added to package.json
PostHog client initialized Yes Client: posthog.init() in entry.client.tsx with PostHogProvider. Server: middleware creates per-request PostHog Node client with withContext
capture() Yes 14 custom events across server actions and routes
identify() Yes posthog.identify(currentUser.id, { email, name }) in authenticated layout with real database user ID
Error tracking Yes posthog.captureException(error) in root ErrorBoundary
Reverse proxy No No reverse proxy configured; client-side requests go directly to us.i.posthog.com

Issues

  • No reverse proxy: Client-side PostHog requests will be blocked by ad blockers. Should configure Next.js-style rewrites or Vercel proxy. [MEDIUM]
  • Stripe handlers use non-user distinct IDs: In stripe-event-handlers.server.ts, subscription_started uses event.data.object.metadata.organizationId as distinctId and subscription_cancelled uses the Stripe customer ID. These create orphaned person profiles that don't correlate with actual users. The middleware's withContext isn't available in webhook handlers, so these standalone PostHog instances also lack session correlation. [MEDIUM]
  • No .env.example updated: The posthog-setup-report.md acknowledges this as a TODO but the PR doesn't include an .env.example update. [MEDIUM]

Other completed criteria

  • API key loaded from import.meta.env.VITE_POSTHOG_PROJECT_TOKEN (client) and process.env.VITE_POSTHOG_PROJECT_TOKEN (server)
  • Host configured via import.meta.env.VITE_POSTHOG_HOST / process.env.VITE_POSTHOG_HOST
  • posthog.reset() called on logout in nav-user.tsx
  • tracing_headers configured for server-side session correlation
  • Server middleware uses posthog.withContext() and posthog.shutdown() correctly
  • flushAt: 1 and flushInterval: 0 set for server-side instances per docs

PostHog insights and events ✅

Filename PostHog events Description
register-action.server.ts user_registered Tracks email registration initiation
auth.callback.ts user_logged_in, user_signed_up Tracks OAuth/magic-link login and new account creation
logout.ts user_logged_out Tracks explicit sign-out
onboarding-user-account-action.server.ts onboarding_profile_completed Tracks onboarding profile setup
onboarding-organization-action.server.ts organization_created Tracks org creation during onboarding
create-organization-action.server.ts organization_created Tracks org creation from app
general-organization-settings-action.server.ts organization_deleted Tracks org deletion
billing-action.server.ts subscription_checkout_started Tracks Stripe checkout initiation
stripe-event-handlers.server.ts subscription_started, subscription_cancelled Tracks subscription lifecycle via webhooks
pastes.tsx paste_created, paste_deleted Tracks core product CRUD actions
account-settings-action.server.ts user_account_deleted Tracks account deletion
_sidebar-layout.tsx identify() User identification on authenticated layout mount
root.tsx captureException Error tracking in root error boundary
nav-user.tsx reset() Session reset on logout

Issues

  • No critical or medium issues with event quality.

Other completed criteria

  • Events represent real user actions mapping to actual product flows (registration → onboarding → subscription → product usage → deletion)
  • Events enable product insights: signup funnel, subscription conversion, paste activity, churn analysis
  • Events include relevant properties (organization_id, user_id, source, method, language, is_public, paste_id)
  • No PII in capture properties — email/name only in identify() person properties
  • Event names use consistent snake_case convention with descriptive action names
  • organization_created event distinguishes source via source property ("onboarding" vs "app")

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