Skip to content

[CI] (38ef7e6) tanstack-start/tanstack-start-saas - #2616

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

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

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: tanstack-start/tanstack-start-saas
App directory: apps/tanstack-start/tanstack-start-saas
Workbench branch: wizard-ci-38ef7e6-tanstack-start-tanstack-start-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:48:19.425Z
Duration: 525.2s

YARA Scanner

✓ 67 tool calls scanned, 0 violations detected

No violations: ✓ 67 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a TanStack Start SaaS application ("CloudFlow") with both client-side (@posthog/react) and server-side (posthog-node) analytics. It adds a PostHogProvider wrapper, error tracking via captureException, a Vite dev-server reverse proxy, and multiple custom event captures across invoice and team member flows.

Files changed Lines added Lines removed
13 +231 -4

Confidence score: 4/5 👍

  • defaults date is outdated: The PostHogProvider in __root.tsx uses defaults: '2025-05-24' instead of the current recommended date (2026-05-30 per docs). This means the SDK initializes with older default configuration. [MEDIUM]
  • ui_host uses wrong domain: ui_host is set to https://us.posthog.com but should be https://us.i.posthog.com. The us.posthog.com domain is the dashboard UI, not the ingestion host. [MEDIUM]
  • Server-side events never flushed: The server-side getPostHogClient() singleton uses flushAt: 1 and flushInterval: 0, but none of the API route handlers call await posthog.shutdown() or await posthog.flush() after capturing. With a singleton pattern, events may be lost if the process exits. The TanStack Start docs recommend calling shutdown() after server-side captures. [MEDIUM]
  • useEffect for tracking team_member_viewed: The users..tsx file uses useEffect to capture a team_member_viewed event. Per React rules, this is acceptable as a sync-with-external-system effect, but the dependency array [user.id] is missing posthog and role, which would cause React lint warnings. [LOW]
  • No identify() call: No user identification is implemented anywhere despite this being a SaaS app with user concepts. [MEDIUM]
  • Reverse proxy is dev-only: The Vite server.proxy configuration only applies during development — it does not work in production builds. No production reverse proxy is configured. [MEDIUM]
  • No .env.example updated: Environment variables VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST are not documented in any .env.example file. [MEDIUM]

File changes

Filename Score Description
package.json 4/5 Adds @posthog/react and posthog-node dependencies — correct packages for full-stack TanStack Start
src/routes/__root.tsx 3/5 Wraps app with PostHogProvider but uses outdated defaults date and wrong ui_host
src/utils/posthog-server.ts 3/5 Server singleton with correct pattern but uses import.meta.env fallback which may not resolve on server
src/components/DefaultCatchBoundary.tsx 4/5 Correctly adds captureException for error boundary errors
src/routes/index.tsx 5/5 Clean event handler–based capture for CTA clicks with destination property
src/routes/posts..tsx 5/5 Good capture for invoice_paid and invoice_details_viewed with properties
src/routes/posts_..deep.tsx 5/5 Clean captures for invoice_paid (deep view) and PDF download
src/routes/users..tsx 3/5 Uses useEffect for tracking (acceptable for page view tracking), but incomplete dependency array
src/routes/api/invoices.ts 3/5 Server-side capture works but no flush/shutdown call
src/routes/api/invoices..ts 3/5 Same flush concern; otherwise good CRUD event tracking
src/routes/api/invoices..pay.ts 3/5 Same flush concern; captures payment processing event
vite.config.ts 3/5 Correct proxy rules for dev, but no production proxy
posthog-setup-report.md 4/5 Good documentation of changes made

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; dependencies added correctly
Preserves existing env vars & configs Yes Only adds PostHog-related code; existing configs preserved
No syntax or type errors Yes All code is syntactically valid TypeScript/TSX
Correct imports/exports Yes @posthog/react for client, posthog-node for server — correct separation
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None Base app appears functional

Issues

  • Incomplete useEffect dependency array: users..tsx has [user.id] but should include posthog and role to satisfy React exhaustive-deps rule. [LOW]
  • Environment variables not documented: VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST are not added to any .env.example file. The setup report mentions this as a TODO but it should have been done. [MEDIUM]

Other completed criteria

  • All changes are relevant to PostHog integration
  • Correct files modified for TanStack Start framework
  • Code follows existing codebase patterns (naming, structure, indentation)
  • No unnecessary modifications or reformatting

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes @posthog/react ^1.10.3 and posthog-node ^5.40.0 added to package.json
PostHog client initialized Yes PostHogProvider wraps the app in __root.tsx with API key from env vars; server client via singleton in posthog-server.ts
capture() Yes Multiple meaningful capture() calls across client and server routes
identify() No No identify() call anywhere — this is a SaaS app with user/team concepts but no user identification is implemented
Error tracking Yes captureException in DefaultCatchBoundary + capture_exceptions: true in init config
Reverse proxy No Vite server.proxy only works in dev mode — no production reverse proxy configured

Issues

  • No user identification: This SaaS app has user profiles (users.) but never calls posthog.identify(). Without identification, all events are anonymous and cannot be linked to specific users across sessions. Add posthog.identify(userId, { email, name }) on login or session restore. [CRITICAL]
  • defaults date is stale: Uses '2025-05-24' instead of the current '2026-05-30' from the docs. This means older default SDK behavior will be used. [MEDIUM]
  • ui_host uses wrong domain: Set to https://us.posthog.com (the dashboard) instead of https://us.i.posthog.com (the ingestion API). While ui_host is specifically for toolbar/UI purposes, this is still incorrect as it should point to the PostHog app URL, not a bare domain. [LOW]
  • Reverse proxy is dev-only: The Vite proxy config doesn't apply in production. Users will need a separate production proxy (e.g., Nitro server middleware, Vercel rewrites, or Cloudflare). [MEDIUM]
  • Server-side events may be lost: No shutdown() or flush() calls after server-side captures. While flushAt: 1 triggers immediate sends, there's no guarantee the event is sent before the response returns. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable (not hardcoded)
  • API host correctly configured via /ingest proxy path
  • Both posthog-js (via @posthog/react) and posthog-node correctly used in their respective contexts

PostHog insights and events ⚠️

Filename PostHog events Description
src/routes/index.tsx dashboard_cta_clicked Tracks CTA clicks with destination property (invoices, team, pending_invoice)
src/routes/posts..tsx invoice_paid, invoice_details_viewed Tracks invoice payment and navigation to detail view with invoice properties
src/routes/posts_..deep.tsx invoice_paid, invoice_pdf_downloaded Tracks payment from deep view (with source: 'deep_view') and PDF download
src/routes/users..tsx team_member_viewed Page view tracking for team member profiles with user_id and role
src/routes/api/invoices.ts invoice_created Server-side: tracks new invoice creation with invoice properties
src/routes/api/invoices..ts invoice_updated, invoice_deleted Server-side: tracks invoice CRUD operations
src/routes/api/invoices..pay.ts invoice_payment_processed Server-side: tracks payment processing with invoice details
src/components/DefaultCatchBoundary.tsx captureException Error boundary captures all React errors

Issues

  • No issues with event quality — events represent real user actions, enable funnel analysis (view → pay), include relevant properties, and use descriptive snake_case naming.

Other completed criteria

  • Events represent real user actions (invoice CRUD, CTA clicks, profile views)
  • Events enable product insights (invoice payment funnel, CTA effectiveness, team engagement)
  • Events include relevant properties (invoice_id, amount, status, source)
  • No PII in event properties (user_id is an internal ID, not email/name)
  • 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