Skip to content

[CI] (38ef7e6) tanstack-router/tanstack-router-code-based-saas - #2611

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-tanstack-router-tanstack-router-code-based-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-router/tanstack-router-code-based-saas
App directory: apps/tanstack-router/tanstack-router-code-based-saas
Workbench branch: wizard-ci-38ef7e6-tanstack-router-tanstack-router-code-based-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:44:48.166Z
Duration: 469.2s

YARA Scanner

✓ 42 tool calls scanned, 0 violations detected

No violations: ✓ 42 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 Router code-based SaaS app (CloudFlow). It adds posthog-js and @posthog/react as dependencies, wraps the root component with PostHogProvider, instruments 10 meaningful custom events across invoices, team members, auth, and upgrade flows, configures a Vite dev-server reverse proxy, and enables error tracking via capture_exceptions.

Files changed Lines added Lines removed
6 +140 -9

Confidence score: 4/5 👍

  • No .env.example committed: The .env file is gitignored (correctly), but no .env.example or equivalent is committed to document the required VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST variables for other developers. [MEDIUM]
  • No identify on returning visitors: posthog.identify() is only called on fresh login. If a user reloads with an active session, events remain on an anonymous distinct ID. The setup report acknowledges this as a TODO. [MEDIUM]
  • Reverse proxy is dev-server only: The Vite proxy configuration only applies during development. In production, the api_host: '/ingest' path would require a separately configured proxy at the hosting layer, otherwise requests would fail. [LOW]

File changes

Filename Score Description
src/main.tsx 4/5 Core integration: PostHogProvider wrapper, identify on login, reset on logout, 10 custom capture calls across invoices, team, profile, and auth flows
vite.config.js 4/5 Vite dev-server reverse proxy with correct /ingest/static, /ingest/array, and /ingest routes targeting appropriate PostHog origins
package.json 5/5 Added posthog-js and @posthog/react dependencies
.gitignore 5/5 Added .env to gitignore
src/vite-env.d.ts 5/5 Vite client type reference for import.meta.env support
posthog-setup-report.md 4/5 Detailed setup report documenting all events and next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax or type errors; dependencies correctly added
Preserves existing env vars & configs Yes Existing vite config, plugins, and app code preserved; PostHog additions are additive
No syntax or type errors Yes All JSX, TypeScript, and config syntax is valid
Correct imports/exports Yes PostHogProvider and usePostHog correctly imported from @posthog/react
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None Base app appears functional

Issues

  • No .env.example committed: Environment variables VITE_PUBLIC_POSTHOG_PROJECT_TOKEN and VITE_PUBLIC_POSTHOG_HOST are referenced in code but not documented in a committed file. Other developers cloning the repo won't know which variables to set. Add a .env.example with placeholder values. [MEDIUM]

Other completed criteria

  • Build configuration is valid — Vite config uses proper defineConfig with loadEnv pattern
  • .env correctly added to .gitignore to prevent secret leakage
  • vite-env.d.ts added for TypeScript import.meta.env support

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.399.1 and @posthog/react@^1.10.3 added to package.json
PostHog client initialized Yes PostHogProvider wraps root component with apiKey from env var, reverse proxy host, defaults: '2026-01-30', and capture_exceptions: true
capture() Yes 10 meaningful capture calls across auth, invoicing, team, and profile flows
identify() Yes posthog.identify(username, { username }) called on login; posthog.reset() called on both logout paths. However, no identify on returning visitors with active sessions
Error tracking Yes capture_exceptions: true set in PostHogProvider options
Reverse proxy Yes Vite dev-server proxy correctly routes /ingest/static and /ingest/array to us-assets.i.posthog.com, and /ingest to the PostHog host

Issues

  • Missing identify on returning visitors: If a user reloads the page while already logged in, no posthog.identify() call is made, leaving the session on an anonymous distinct ID. Add an identify call when the app detects an existing authenticated session. [MEDIUM]
  • Dev-only reverse proxy: The Vite server.proxy config only applies during development. Production deployments need a separately configured reverse proxy for the /ingest path to work. [LOW]

Other completed criteria

  • API key loaded from import.meta.env.VITE_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable
  • Host correctly configured through reverse proxy pattern with proper /static and /array asset routes
  • posthog.reset() correctly called on both logout code paths (ProfileComponent and LoginComponent)
  • ui_host correctly set to https://us.posthog.com for toolbar access

PostHog insights and events ✅

Filename PostHog events Description
src/main.tsx user_logged_in Captured on login form submission, enables login funnel tracking
src/main.tsx user_logged_out Captured on both sign-out buttons with posthog.reset(), enables session lifecycle analysis
src/main.tsx invoice_created Captured in mutation onSuccess with invoice_id, tracks invoice creation conversion
src/main.tsx invoice_updated Captured in update mutation onSuccess with invoice_id, tracks edit activity
src/main.tsx invoice_viewed Captured via useEffect on invoice detail mount with invoice_id, tracks invoice engagement
src/main.tsx invoice_notes_toggled Captured on notes toggle click with invoice_id and action (show/hide)
src/main.tsx upgrade_clicked Captured on upgrade button click, tracks monetization intent
src/main.tsx team_member_viewed Captured via useEffect on user detail mount with user_id
src/main.tsx team_member_searched Captured on search input change (when non-empty), tracks search engagement
src/main.tsx team_member_sort_changed Captured on sort change with sort_by value
src/main.tsx captureException (auto) Automatic exception capture via capture_exceptions: true

Issues

  • Noisy search event: team_member_searched fires on every keystroke (when input is non-empty) rather than being debounced. This could generate excessive events in PostHog. Consider debouncing or capturing on search submission/blur. [LOW]

Other completed criteria

  • Events represent real user actions across the full SaaS workflow (auth → invoicing → team → billing)
  • Events enable product insights: login-to-invoice funnel, invoice lifecycle, team engagement, upgrade conversion
  • Events include enriched properties where relevant (invoice_id, user_id, sort_by, action)
  • No PII in capture properties — username only passed to identify() as person property
  • Event names use consistent snake_case convention with descriptive action names

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