Skip to content

[CI] (137243f) tanstack-start/tanstack-start-saas - #1973

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 137243f
App: tanstack-start/tanstack-start-saas
App directory: apps/tanstack-start/tanstack-start-saas
Workbench branch: wizard-ci-137243f-tanstack-start-tanstack-start-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-06-18T16:29:52.396Z
Duration: 398.1s

@wizard-ci-bot

wizard-ci-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. Here's my evaluation:


PR Evaluation Report

Summary

This PR integrates PostHog into a TanStack Start SaaS invoicing app. It adds posthog-js, @posthog/react, and posthog-node, wraps the app in PostHogProvider, configures a Vite reverse proxy, adds client-side event captures for invoice CRUD actions, server-side event captures in API routes, and error tracking via the error boundary. No user identification (identify) is implemented.

Files changed Lines added Lines removed
12 +209 -4

Confidence score: 4/5 👍

  • No identify() call anywhere: The app has no user identification. Without posthog.identify(), all events are anonymous and cannot be linked to real users. This is a critical gap for any analytics integration. [CRITICAL]
  • Reverse proxy only works in development: The /ingest proxy is configured via vite.config.ts server.proxy, which only applies during vite dev. In production (Nitro server), /ingest routes will 404 and all PostHog client events will silently fail. A Nitro server middleware or route handler is needed. [CRITICAL]
  • captureException called during render without safe guard: In DefaultCatchBoundary, posthog.captureException(error) is called directly in the component body (during render), not in a useEffect. This fires on every re-render and risks errors if PostHog isn't initialized. Should use posthog?.captureException(error) inside a useEffect. [MEDIUM]

File changes

Filename Score Description
package.json 5/5 Adds posthog-js, @posthog/react, posthog-node with correct versions
src/routes/__root.tsx 3/5 PostHogProvider added correctly to shell; uses outdated defaults: '2025-05-24' instead of '2026-01-30'
src/utils/posthog-server.ts 4/5 Singleton server client with correct flushAt: 1 and flushInterval: 0
vite.config.ts 3/5 Correct proxy rules for /ingest/static, /ingest/array, /ingest, but dev-only
src/components/DefaultCatchBoundary.tsx 2/5 captureException called during render without optional chaining
src/routes/posts.index.tsx 5/5 Clean invoice_created capture in event handler
src/routes/posts..tsx 5/5 Clean invoice_paid capture in event handler
src/routes/posts_..deep.tsx 5/5 Good invoice_paid and invoice_pdf_downloaded captures
src/routes/api/invoices.ts 4/5 Server-side invoice_created with enriched properties
src/routes/api/invoices..ts 4/5 Server-side invoice_updated and invoice_deleted
src/routes/api/invoices..pay.ts 4/5 Server-side invoice_paid
posthog-setup-report.md 3/5 Useful report but mentions env setup as TODO rather than completing it

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; all imports resolve to installed packages
Preserves existing env vars & configs Yes Existing code preserved; PostHog additions are additive
No syntax or type errors Yes Valid TypeScript/JSX throughout
Correct imports/exports Yes All imports are correct (@posthog/react, posthog-node, posthog-js)
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None —

Issues

  • captureException called during render: In DefaultCatchBoundary, posthog.captureException(error) is called in the component body, executing on every render. It should be wrapped in useEffect and use optional chaining (posthog?.captureException(error)). [MEDIUM]
  • Outdated defaults date: defaults: '2025-05-24' should be '2026-01-30' per current PostHog docs. [LOW]

Other completed criteria

  • Environment variables documented in .env file with correct VITE_PUBLIC_ prefix
  • Build configuration valid; Vite config is syntactically correct
  • No unrelated changes or gratuitous reformatting

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.390.2, @posthog/react@^1.10.2, posthog-node@^5.38.0 in package.json
PostHog client initialized Yes PostHogProvider in __root.tsx shell with apiKey from env and reverse proxy host
capture() Yes Multiple meaningful captures across client and server routes
identify() No No posthog.identify() or posthog.reset() calls anywhere in the codebase
Error tracking Yes captureException in error boundary + capture_exceptions: true in init config
Reverse proxy Yes Vite proxy correctly routes /ingest/static and /ingest/array to us-assets.i.posthog.com and /ingest to us.i.posthog.com

Issues

  • No user identification: There is no posthog.identify() call anywhere. For a SaaS app, this is essential — all events remain anonymous, making it impossible to build user-level funnels or retention analysis. Should call identify() on login/auth and reset() on logout. [CRITICAL]
  • Reverse proxy is dev-only: The Vite server.proxy config only applies during development (vite dev). In production (Nitro server from node .output/server/index.mjs), there is no proxy handler for /ingest routes. Since api_host is set to '/ingest', all PostHog events will silently fail in production. A Nitro server route or middleware is needed. [CRITICAL]
  • Server-side distinctId fallback to 'anonymous': All server-side captures fall back to 'anonymous' as the distinctId when headers are missing. If tracing headers aren't configured on the client (they aren't — no tracing_headers option in init), every server-side event will share the same 'anonymous' distinct ID, creating a single merged user. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable (VITE_PUBLIC_POSTHOG_PROJECT_TOKEN)
  • Host correctly configured via reverse proxy (/ingest → us.i.posthog.com)
  • Server-side client uses singleton pattern with flushAt: 1 and flushInterval: 0
  • Both /ingest/static and /ingest/array correctly route to us-assets.i.posthog.com

PostHog insights and events ⚠️

Filename PostHog events Description
src/routes/posts.index.tsx invoice_created Client-side capture when user submits the create invoice form with invoice ID, title, amount, due date
src/routes/posts..tsx invoice_paid Client-side capture when user marks invoice as paid from list view
src/routes/posts_..deep.tsx invoice_paid, invoice_pdf_downloaded Client-side captures for marking paid and downloading PDF from detail page
src/components/DefaultCatchBoundary.tsx captureException Error tracking for unhandled errors in the error boundary
src/routes/api/invoices.ts invoice_created Server-side capture for API invoice creation
src/routes/api/invoices..ts invoice_updated, invoice_deleted Server-side captures for API invoice update and delete
src/routes/api/invoices..pay.ts invoice_paid Server-side capture for API invoice payment

Issues

  • Server-side events will all map to 'anonymous': Without tracing_headers in the client PostHog init, the X-PostHog-Distinct-Id header will never be sent, so all server events share one distinct ID. This produces misleading analytics. [MEDIUM]

Other completed criteria

  • Events represent real user actions (invoice CRUD operations, PDF download)
  • Events enable product insights (invoice_created → invoice_paid funnel is directly actionable)
  • Events include relevant properties (invoice_id, title, amount, status, source)
  • No PII in event properties (no emails, names, or phone numbers)
  • 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