Skip to content

[CI] (38ef7e6) react-router/shopper - #2607

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-react-router-shopper
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-react-router-shopper

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: 38ef7e6
App: react-router/shopper
App directory: apps/react-router/shopper
Workbench branch: wizard-ci-38ef7e6-react-router-shopper
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:35:06.579Z
Duration: 384.3s

YARA Scanner

✓ 35 tool calls scanned, 0 violations detected

No violations: ✓ 35 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. Here is my full evaluation:


PR Evaluation Report

Summary

This PR integrates PostHog into a React Router v7 framework mode e-commerce (shopper) app. It adds client-side initialization via entry.client.tsx with a PostHogProvider, server-side middleware for request-scoped PostHog context, error boundary exception capture, a Vite reverse proxy, and custom event tracking across the full shopping funnel (product browsing, cart management, checkout).

Files changed Lines added Lines removed
11 +187 -3

Confidence score: 4/5 👍

  • Missing identify() call: The checkout form collects fullName and email but no posthog.identify() is ever called. This is a critical gap — all events remain anonymous and cannot be linked to known users. The checkout handleSubmit is the natural place to call identify() with a user-derived ID and set person properties like email/name. [CRITICAL]
  • __add_tracing_headers is an internal/undocumented option: The posthog.init() call uses __add_tracing_headers (double-underscore prefix), which is not the documented public API. The correct option is tracing_headers. Using internal APIs risks breakage on SDK updates. [MEDIUM]
  • Environment variables not documented: No .env.example file exists or was updated. VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST are not documented anywhere for other developers. The setup report even calls this out as a TODO. [MEDIUM]

File changes

Filename Score Description
app/entry.client.tsx 3/5 PostHog client init with PostHogProvider — uses undocumented __add_tracing_headers option
app/lib/posthog-middleware.ts 5/5 Server-side middleware with per-request PostHog Node client, session/distinct ID threading, and shutdown
app/root.tsx 4/5 Registers middleware and adds captureException in ErrorBoundary
app/routes/cart.tsx 5/5 Captures cart_item_removed, cart_item_quantity_updated, checkout_started with rich properties
app/routes/checkout.tsx 3/5 Captures order_placed but misses identify() opportunity with collected user data
app/routes/products.tsx 4/5 Captures product_added_to_cart, product_searched, product_category_filtered — search fires on every keystroke
app/routes/products..tsx 5/5 Captures product_added_to_cart from detail page with quantity and source
package.json 5/5 Adds posthog-js, @posthog/react, posthog-node
vite.config.ts 5/5 Adds SSR noExternal for PostHog packages and reverse proxy with /static, /array, and /ingest routes
react-router.config.ts 5/5 Enables v8_middleware future flag required for middleware
posthog-setup-report.md N/A Setup report documentation

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Valid TypeScript/JSX, correct Vite config, proper SSR noExternal for PostHog packages
Preserves existing env vars & configs Yes Existing root.tsx layout, routes, and cart context preserved unchanged
No syntax or type errors Yes All changed files have valid syntax and proper TypeScript types
Correct imports/exports Yes All imports resolve to correct packages — posthog-js for client, posthog-node for server, @posthog/react for hooks
Minimal, focused changes Yes All changes directly serve the PostHog integration
Pre-existing issues None Base app appears clean

Issues

  • Environment variables undocumented: VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST are not added to any .env.example file. Other developers won't know what to set. [MEDIUM]

Other completed criteria

  • Build configuration is valid — vite.config.ts properly structured with loadEnv, SSR config, and proxy rules
  • react-router.config.ts correctly enables v8_middleware future flag for middleware support
  • Package.json adds all three required PostHog packages with reasonable version ranges

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.399.1, @posthog/react@^1.10.3, posthog-node@^5.40.0 added to package.json
PostHog client initialized Yes posthog.init() in entry.client.tsx with env vars and PostHogProvider wrapping HydratedRouter; server middleware creates per-request PostHog Node client
capture() Yes 8 distinct capture events across 4 route files covering the full shopping funnel
identify() No No posthog.identify() call anywhere — checkout collects fullName and email but never identifies the user
Error tracking Yes posthog?.captureException(error) in ErrorBoundary using usePostHog() hook
Reverse proxy Yes Vite dev server proxy at /ingest routing to PostHog host, with /ingest/static and /ingest/array routing to us-assets.i.posthog.com

Issues

  • No user identification: The app never calls posthog.identify(). The checkout form collects fullName and email — these should be used to identify the user at checkout (e.g., posthog.identify(email, { name: fullName, email })). Without identification, all events are anonymous and cannot be linked across sessions or to real users. Also missing posthog.reset() since there's no auth flow, but identify at checkout is still expected. [CRITICAL]
  • Undocumented __add_tracing_headers option: The init call uses __add_tracing_headers which is a private/internal API (double-underscore prefix). The documented public option is tracing_headers. This may break without notice on SDK updates. Should be: tracing_headers: [window.location.host, 'localhost']. [MEDIUM]

Other completed criteria

  • API key correctly loaded from import.meta.env.VITE_PUBLIC_POSTHOG_PROJECT_TOKEN (client) and process.env.VITE_PUBLIC_POSTHOG_PROJECT_TOKEN (server)
  • Host configured via env var with reverse proxy at /ingest for client, direct host for server
  • Reverse proxy correctly routes /ingest/static/* and /ingest/array/* to us-assets.i.posthog.com and /ingest/* to the PostHog host
  • Server middleware properly extracts X-POSTHOG-SESSION-ID and X-POSTHOG-DISTINCT-ID headers and uses posthog.withContext() for request-scoped context
  • posthog.shutdown() called after each server request

PostHog insights and events ✅

Filename PostHog events Description
app/routes/products.tsx product_added_to_cart, product_searched, product_category_filtered Tracks add-to-cart from listing with product details and source, search queries (>2 chars), and category filter selection
app/routes/products..tsx product_added_to_cart Tracks add-to-cart from product detail page with quantity and source differentiation
app/routes/cart.tsx cart_item_removed, cart_item_quantity_updated, checkout_started Tracks cart modifications with full product context and checkout initiation with cart total
app/routes/checkout.tsx order_placed Tracks completed orders with total, item count, item details, and city
app/root.tsx captureException Captures unhandled exceptions via ErrorBoundary

Issues

  • product_searched fires on every keystroke: handleSearch is called on every input change and fires a product_searched event for every character typed beyond 2 characters. Typing "shoes" generates 3 events ("sho", "shoe", "shoes"). This should be debounced or fired on form submit to avoid excessive event volume. [LOW]

Other completed criteria

  • Events represent real user actions in a shopping funnel: browsing → adding to cart → cart management → checkout → order placement
  • Events enable product insights — purchase funnel (product_added_to_cart → checkout_started → order_placed), category analysis, search behavior
  • Events are enriched with contextual properties: product_id, product_name, product_category, product_price, quantity, source, cart totals
  • No PII in capture event properties — city is the most granular location data, email/name from checkout form are not passed to capture calls
  • Event names follow consistent snake_case convention and are descriptive of the action

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