Skip to content

[CI] (0ae2102) tanstack-start/tanstack-start-saas - #1243

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-0ae2102-tanstack-start-tanstack-start-saas
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-0ae2102-tanstack-start-tanstack-start-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Apr 15, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 0ae2102
App: tanstack-start/tanstack-start-saas
App directory: apps/tanstack-start/tanstack-start-saas
Workbench branch: wizard-ci-0ae2102-tanstack-start-tanstack-start-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-04-15T19:44:49.869Z
Duration: 321.4s

@wizard-ci-bot

wizard-ci-bot Bot commented Apr 15, 2026

Copy link
Copy Markdown
Author

Now I have all the information I need for a thorough evaluation. Let me compile the review.


PR Evaluation Report

Summary

This PR integrates PostHog into a TanStack Start SaaS invoice management app. It adds client-side tracking via @posthog/react with PostHogProvider in the root layout, server-side event capture via posthog-node in API routes, a Vite dev-server reverse proxy, and error tracking via captureException in the error boundary. No user identification (identify) is implemented.

Files changed Lines added Lines removed
10 +138 -3

Confidence score: 4/5 👍

  • Missing identify() call: No posthog.identify() is called anywhere in the app. This is a client-only app component, yet no user identification is set up. This means all events are anonymous and cannot be linked to specific users, severely limiting the value of the analytics integration. [CRITICAL]
  • Missing __add_tracing_headers configuration: The server-side API routes read X-PostHog-Session-Id and X-PostHog-Distinct-Id headers, but posthog.init() in __root.tsx never sets the __add_tracing_headers option. These headers will always be null, causing all server-side events to use distinctId: 'anonymous' and lose session linkage. [CRITICAL]
  • Reverse proxy only works in Vite dev server: The /ingest proxy is configured in vite.config.ts under server.proxy, which only applies during local development. In production, /ingest requests will 404. The api_host is set to /ingest unconditionally, so PostHog will be completely broken in production. [CRITICAL]
  • .env file not committed but no .env.example: The .env file exists locally but is not in the committed changeset. There is no .env.example to document the required environment variables for other developers. [MEDIUM]
  • captureException called during render in error boundary: In DefaultCatchBoundary.tsx, posthog.captureException(error) is called directly in the render body (not in a useEffect). This will fire on every re-render and in Strict Mode will fire twice. [MEDIUM]

File changes

Filename Score Description
package.json 5/5 Correctly adds @posthog/react, posthog-js, and posthog-node dependencies
src/routes/__root.tsx 3/5 Adds PostHogProvider wrapping body; api_host: '/ingest' will fail in production; missing __add_tracing_headers
src/utils/posthog-server.ts 4/5 Good singleton pattern with flushAt: 1 and flushInterval: 0; dual env var access is pragmatic for TanStack Start
vite.config.ts 2/5 Dev-only proxy; will not work in production builds
src/components/DefaultCatchBoundary.tsx 3/5 Captures exceptions but called in render body, not in useEffect
src/routes/posts..tsx 4/5 Good event capture in event handler with relevant properties
src/routes/posts_..deep.tsx 4/5 Good event capture with source: 'deep_view' differentiator
src/routes/api/invoices.ts 3/5 Server-side capture is good but headers will always be null without __add_tracing_headers
src/routes/api/invoices..pay.ts 3/5 Same issue — headers won't be populated; no shutdown() call
posthog-setup-report.md 3/5 Setup report; not code, but contains useful documentation

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Dependencies are correct, syntax is valid, should build
Preserves existing env vars & configs Yes No existing env vars or configs were removed
No syntax or type errors Yes All changed files have valid syntax
Correct imports/exports Yes All imports resolve to correct packages
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None No pre-existing issues noted

Issues

  • captureException in render body: posthog.captureException(error) in DefaultCatchBoundary.tsx is called during render, not inside a useEffect. This means it fires on every re-render and will double-fire in React Strict Mode. It should be wrapped in useEffect to ensure it only fires once per error. [MEDIUM]
  • No .env.example committed: The .env file is not committed and there is no .env.example to document required variables (VITE_PUBLIC_POSTHOG_PROJECT_TOKEN, VITE_PUBLIC_POSTHOG_HOST). [MEDIUM]

Other completed criteria

  • All imports are correct (@posthog/react, posthog-js, posthog-node from proper packages)
  • No unnecessary changes or reformatting outside PostHog integration
  • Code follows existing codebase patterns (naming, structure, indentation)
  • Build configuration additions are syntactically valid

PostHog implementation ❌

Criteria Result Description
PostHog SDKs installed Yes @posthog/react ^1.9.0, posthog-js ^1.369.0, posthog-node ^5.29.2 added to package.json
PostHog client initialized Yes PostHogProvider with apiKey and options in __root.tsx; server singleton in posthog-server.ts
capture() Yes Client-side capture() in event handlers; server-side capture() in API routes
identify() No No posthog.identify() call anywhere in the app. No user identification is implemented.
Error tracking Yes capture_exceptions: true in init config + manual captureException() in error boundary
Reverse proxy No Vite server.proxy only works during development. In production, /ingest will 404, completely breaking PostHog.

Issues

  • No identify() implementation: There is no call to posthog.identify() anywhere. All events are anonymous. For a SaaS app this severely limits analytics value — you cannot associate events with users, build user-level funnels, or use person properties. [CRITICAL]
  • Reverse proxy is dev-only: The /ingest proxy in vite.config.ts server.proxy only works in the Vite dev server. In production (using Nitro/Node), requests to /ingest will fail with 404. Since api_host is unconditionally set to '/ingest', PostHog will not work at all in production. A production-ready reverse proxy (e.g., via Nitro route handler, Vercel rewrites, or Cloudflare) is needed. [CRITICAL]
  • Missing __add_tracing_headers: Server API routes attempt to read X-PostHog-Session-Id and X-PostHog-Distinct-Id headers, but the client-side init does not include __add_tracing_headers. These headers will never be sent, so all server-side events will have distinctId: 'anonymous' and no session linkage. [CRITICAL]
  • No posthog.shutdown() in server routes: The posthog-node docs for short-lived server functions recommend calling await posthog.shutdown() to flush events. Since the singleton pattern is used with flushAt: 1, events should send immediately, but there's no guarantee without shutdown(). [LOW]

Other completed criteria

  • API key loaded from environment variable (VITE_PUBLIC_POSTHOG_PROJECT_TOKEN)
  • Host correctly configured (points to https://us.i.posthog.com for server; /ingest → same for client dev)
  • Both client and server SDKs properly installed
  • PostHogProvider correctly wraps the app shell
  • Server-side singleton pattern matches documentation recommendations

PostHog insights and events ⚠️

Filename PostHog events Description
src/routes/posts..tsx invoice_marked_paid Client-side: user marks invoice as paid from detail page, with invoice_id, title, amount
src/routes/posts_..deep.tsx invoice_marked_paid Client-side: user marks invoice as paid from deep view, with invoice_id, title, amount, source
src/routes/api/invoices.ts invoice_created Server-side: new invoice created via API, with invoice_id, title, amount
src/routes/api/invoices..pay.ts invoice_payment_processed Server-side: invoice payment processed via API, with invoice_id, title, amount
src/components/DefaultCatchBoundary.tsx captureException Error boundary captures unhandled React errors

Issues

  • No PII concerns but invoice_title may contain user-generated content: The invoice_title property is included in event properties across multiple events. If invoice titles contain client names or personal information, this could be considered PII in event properties. [LOW]

Other completed criteria

  • Events represent real user actions (marking invoices as paid, creating invoices, payment processing)
  • Events enable product insights (can build invoice creation → payment funnels)
  • Events include relevant contextual properties (invoice_id, amount, title, source)
  • Event names are descriptive and use consistent snake_case convention
  • No emails, names, or phone numbers in event properties

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