Skip to content

[CI] (cc5471b) tanstack-router/tanstack-router-code-based-saas - #4794

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: scheduled
Trigger ID: cc5471b
App: tanstack-router/tanstack-router-code-based-saas
App directory: apps/tanstack-router/tanstack-router-code-based-saas
Workbench branch: wizard-ci-cc5471b-tanstack-router-tanstack-router-code-based-saas
Wizard branch: main
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-28T17:05:33.853Z
Duration: 373.5s

YARA Scanner

✓ 153 tool calls scanned, 0 violations detected

No violations: ✓ 153 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR adds PostHog integration to a TanStack Router code-based SaaS app (client-only React SPA). It installs @posthog/react, initializes PostHog via PostHogProvider, adds error boundary tracking, and captures several custom events across invoice management, login, and profile actions. However, it critically omits user identification and reset despite the app having full authentication flows.

Files changed Lines added Lines removed
5 +75 -3

Confidence score: 5/5 🧙

  • Missing posthog.identify() on login: The app has a auth.login(username) flow but never calls posthog.identify(). All events remain anonymous, breaking the link between sessions, replays, and the known user. Must call posthog.identify(username, {...}) after login. [CRITICAL]
  • Missing posthog.reset() on logout: auth.logout() is called in two places but posthog.reset() is never called. The next user on the same browser inherits the previous user's identity. [CRITICAL]
  • No reverse proxy configured: No reverse proxy is set up for the client-only app, making events susceptible to ad blocker interception. [MEDIUM]
  • Events lack enriched properties: All posthog.capture() calls are bare with no contextual properties (e.g., invoice amount, invoice ID). [MEDIUM]

File changes

Filename Score Description
.env.example 5/5 Adds PostHog env vars with placeholder values
.gitignore 5/5 Adds .env to prevent secrets from being committed
package.json 4/5 Adds @posthog/react dependency (posthog-js comes as peer dep)
src/main.tsx 2/5 Core integration file — has init, events, error boundary, but missing identify/reset
tsconfig.json 5/5 Adds vite/client types for import.meta.env support

App sanity check ✅

Criteria Result Description
App builds and runs Yes Valid TypeScript, correct imports, proper Vite env var usage
Preserves existing env vars & configs Yes Existing code refactored cleanly into RootLayout; no functionality removed
No syntax or type errors Yes All syntax is valid; optional chaining used properly throughout
Correct imports/exports Yes PostHogProvider, PostHogErrorBoundary, usePostHog correctly imported from @posthog/react
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None —

Issues

No issues.

Other completed criteria

  • Environment variables documented in .env.example
  • .env added to .gitignore
  • tsconfig.json updated with vite/client types for import.meta.env support
  • Build configuration remains valid

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes @posthog/react ^1.11.3 added to dependencies
PostHog client initialized Yes PostHogProvider with apiKey and options including api_host, defaults, capture_exceptions
capture() Yes Five meaningful capture calls across login, logout, invoice CRUD, and upgrade
identify() No Never called despite app having full auth with auth.login(username)
Error tracking Yes PostHogErrorBoundary wraps app + capture_exceptions: true in config
Reverse proxy No Not configured; client-only app would benefit from it

Issues

  • Missing posthog.identify(): The app authenticates users via auth.login(username) but never calls posthog.identify(). This means all events stay anonymous, preventing user-level analytics, session replay attribution, and cross-session tracking. Should call posthog.identify(username, { ... }) immediately after auth.login() in the onSubmit handler. [CRITICAL]
  • Missing posthog.reset() on logout: auth.logout() is invoked in two places (ProfileComponent and LoginComponent) but posthog.reset() is never called. Without reset, the next user inherits the previous user's identity. Add posthog.reset() before or after auth.logout(). [CRITICAL]
  • No reverse proxy: No proxy configuration (e.g., Vite rewrites) to route PostHog requests through the app's domain. Events are sent directly to us.i.posthog.com and may be blocked by ad blockers. [MEDIUM]
  • Potentially invalid posthog.logger.info() API: The code calls posthog?.logger.info(...) which is not documented in the PostHog JS SDK reference. The documented method is posthog.captureLog(). This may silently fail at runtime. [MEDIUM]
  • Older defaults snapshot: Uses defaults: '2026-01-30' instead of the latest '2026-08-30'. Not a bug, but misses newer default configuration improvements. [LOW]

Other completed criteria

  • API key loaded from environment variable (VITE_PUBLIC_POSTHOG_PROJECT_TOKEN)
  • Host loaded from environment variable (VITE_PUBLIC_POSTHOG_HOST)
  • Graceful degradation when env vars are missing (renders app without PostHog in production, throws in dev)
  • Error boundary properly wraps the app layout

PostHog insights and events ⚠️

Filename PostHog events Description
src/main.tsx invoice_created Captured on successful invoice creation mutation
src/main.tsx invoice_updated Captured on successful invoice update mutation
src/main.tsx upgrade_clicked Captured on upgrade button click in profile
src/main.tsx user_logged_in Captured on login form submission
src/main.tsx user_logged_out Captured on logout (2 locations)
src/main.tsx captureException Via PostHogErrorBoundary wrapping the app

Issues

  • Events lack contextual properties: All posthog.capture() calls are bare with no properties. For example, invoice_created should include invoice details (title, amount), upgrade_clicked should include current plan info. Without properties, events offer limited analytical value for breakdowns and filtering. [MEDIUM]
  • user_logged_in captured before auth.login() completes: The capture fires before auth.login(username) executes, so if login fails, a false positive event is recorded. Should capture after successful login. [LOW]

Other completed criteria

  • Events represent real user actions (login, logout, CRUD, upgrade)
  • Events enable product insights (login → invoice create → invoice update funnel possible)
  • No PII in event properties
  • Event names use consistent snake_case convention and are descriptive

Reviewed by wizard workbench PR evaluator

@wizard-ci-bot wizard-ci-bot Bot added the CI/CD label Oct 28, 2026
@wizard-ci-bot wizard-ci-bot Bot closed this Oct 28, 2026
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