Skip to content

[CI] (e2f7ab0) tanstack-router/tanstack-router-code-based-saas#2435

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

[CI] (e2f7ab0) tanstack-router/tanstack-router-code-based-saas#2435
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-e2f7ab0-tanstack-router-tanstack-router-code-based-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: e2f7ab0
App: tanstack-router/tanstack-router-code-based-saas
App directory: apps/tanstack-router/tanstack-router-code-based-saas
Workbench branch: wizard-ci-e2f7ab0-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-06T22:17:45.991Z
Duration: 297.8s

YARA Scanner

✓ 53 tool calls scanned, 0 violations detected

No violations: ✓ 53 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. The auth is a simple in-memory object — no persistent sessions, so on page refresh the user starts as loggedOut. The missing returning-user identify is not applicable here since auth doesn't persist.


PR Evaluation Report

Summary

This PR integrates PostHog into a TanStack Router code-based SaaS demo app. It adds posthog-js and @posthog/react, wraps the root component in PostHogProvider, configures a Vite dev server reverse proxy, enables exception autocapture, implements user identification on login with reset on logout, and instruments 10 custom events across landing page CTAs, invoice workflows, team management, authentication, and upgrade intent flows.

Files changed Lines added Lines removed
6 +191 -12

Confidence score: 4/5 👍

  • Hardcoded API key in .env file: The .env file contains a real PostHog project token (phc_xxxx...CV6a) committed to the repository. While this is a public project token (not a secret API key), committing it to source control is poor practice. A .env.example with placeholder values should be used instead. [MEDIUM]
  • Reverse proxy is dev-only: The Vite server.proxy configuration only works during local development. Production deployments will have no proxy, causing api_host: '/ingest' to fail unless a separate production reverse proxy is configured. [MEDIUM]

File changes

Filename Score Description
src/main.tsx 4/5 Core integration: PostHogProvider wrapping root, 10 custom events, identify/reset, captureException in mutation error handlers
package.json 5/5 Added posthog-js and @posthog/react dependencies
vite.config.js 4/5 Dev server reverse proxy with correct /ingest/static, /ingest/array, and /ingest routes targeting proper PostHog origins
src/useMutation.tsx 5/5 Added onError callback to custom mutation hook to support error tracking
src/vite-env.d.ts 5/5 Vite client type declaration for import.meta.env TypeScript support
posthog-setup-report.md 5/5 Comprehensive setup report with event table and next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Valid TypeScript/JSX, vite-env.d.ts added for import.meta.env types
Preserves existing env vars & configs Yes Existing code preserved, PostHogProvider wraps without modifying children
No syntax or type errors Yes All code is syntactically valid; types align with SDK APIs
Correct imports/exports Yes PostHogProvider, usePostHog from @posthog/react are correct
Minimal, focused changes Yes Only PostHog-related additions; useMutation.tsx change supports error tracking
Pre-existing issues None

Issues

  • API key committed in .env: The .env file contains a real project token committed to source control. Should use a .env.example with placeholder values and keep .env in .gitignore. [MEDIUM]

Other completed criteria

  • Build configuration is valid — Vite config correctly uses defineConfig with function form and loadEnv
  • The useMutation hook extension for onError is clean and backward-compatible

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.398.0 and @posthog/react@^1.10.3 in package.json
PostHog client initialized Yes PostHogProvider in RootComponent with apiKey from env, api_host: '/ingest', ui_host from env, defaults: '2026-01-30', capture_exceptions: true
capture() Yes 10 meaningful capture calls across multiple user flows
identify() Yes posthog.identify(normalizedUsername, { username, current_plan }) on login; posthog.reset() on logout. Auth is in-memory only (no persistence), so returning-user identify on page refresh is N/A
Error tracking Yes capture_exceptions: true in init + manual posthog.captureException() in invoice creation and update error handlers
Reverse proxy Yes Vite dev server proxy: /ingest/static and /ingest/arrayus-assets.i.posthog.com, /ingest → PostHog host (dev-only)

Issues

  • Reverse proxy is dev-server only: The Vite server.proxy configuration only applies to the development server. In production, /ingest paths will return 404 unless a separate reverse proxy (nginx, Cloudflare, Vercel rewrites, etc.) is configured. The PR should document this or provide production proxy guidance. [MEDIUM]

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 ui_host for PostHog UI features
  • Both /ingest/static and /ingest/array correctly route to us-assets.i.posthog.com per framework rules
  • posthog.reset() correctly called before auth.logout() on both logout paths
  • debug: import.meta.env.DEV enables debug mode only in development

PostHog insights and events ✅

Filename PostHog events Description
src/main.tsx cta_clicked Landing page CTA clicks with destination property (dashboard/login/invoice)
src/main.tsx invoice_creation_submitted Invoice creation with id, title length, has_description
src/main.tsx invoice_updated Invoice edits with id, title length, has_notes
src/main.tsx invoice_notes_toggled Toggle notes visibility with invoice_id and next_state
src/main.tsx team_filter_applied Team member search filter on blur with filter_length
src/main.tsx team_sort_changed Sort mode changes with sort_by value
src/main.tsx team_member_opened Team member profile clicks with team_member_id and role
src/main.tsx user_logged_in Login with auth_method and redirect_present
src/main.tsx user_logged_out Logout from two locations with source property
src/main.tsx subscription_upgrade_clicked Upgrade button click with plan_name and source
src/main.tsx captureException Invoice creation and update mutation errors with source context

Issues

No issues found.

Other completed criteria

  • Events represent real user actions across the full product flow (landing → auth → invoicing → team management → account)
  • Events enable product insights: invoice workflow funnel (create → update), auth lifecycle, upgrade intent tracking
  • All events include enriched contextual properties (source, destination, ids, lengths, states)
  • No PII in event properties — username only in person properties via identify()
  • Consistent snake_case naming convention with descriptive action-oriented 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