Skip to content

[CI] (9da603e) tanstack-router/tanstack-router-file-based-saas - #4410

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-9da603e-tanstack-router-tanstack-router-file-based-saas
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-9da603e-tanstack-router-tanstack-router-file-based-saas

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 9da603e
App: tanstack-router/tanstack-router-file-based-saas
App directory: apps/tanstack-router/tanstack-router-file-based-saas
Workbench branch: wizard-ci-9da603e-tanstack-router-tanstack-router-file-based-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-06T16:07:05.073Z
Duration: 338.3s

YARA Scanner

✓ 166 tool calls scanned, 0 violations detected

No violations: ✓ 166 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a TanStack Router file-based SaaS demo app (client-only SPA). It adds posthog-js and @posthog/react, wraps the root layout with PostHogProvider and PostHogErrorBoundary, captures custom events for login/logout and invoice CRUD, and uses the logger API for structured log entries. However, it is missing posthog.identify() on login and posthog.reset() on logout, meaning all events remain anonymous.

Files changed Lines added Lines removed
8 +69 -4

Confidence score: 5/5 🧙

  • Missing posthog.identify() on login: The app has a clear login flow with auth.login(username), yet posthog.identify() is never called. All events remain anonymous, defeating the purpose of user-level analytics. [CRITICAL]
  • Missing posthog.reset() on logout: The logout handler captures a user_logged_out event but never calls posthog.reset(), so the next user on the same browser inherits the previous session identity. [MEDIUM]
  • No reverse proxy configured: Client-side posthog-js events are susceptible to ad blockers without a reverse proxy. [MEDIUM]
  • Events lack enriching properties: invoice_updated, invoice_created are bare captures with no contextual properties (e.g., invoice ID, amount). [MEDIUM]

File changes

Filename Score Description
.env.example 5/5 Correctly documents both env vars with placeholder values
.gitignore 5/5 Adds .env to prevent secret leakage
package.json 5/5 Adds posthog-js and @posthog/react as dependencies
src/routes/__root.tsx 4/5 Well-structured PostHogRoot wrapper with dev-mode guards, PostHogProvider, and PostHogErrorBoundary
src/routes/dashboard.invoices..tsx 3/5 Captures invoice_updated but with no properties; logger usage is valid
src/routes/dashboard.invoices.index.tsx 3/5 Captures invoice_created but with no properties
src/routes/login.tsx 2/5 Captures login/logout events but critically missing identify() and 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 No syntax errors, valid TypeScript, dependencies properly added
Preserves existing env vars & configs Yes Existing code/configs untouched; PostHog additions are additive
No syntax or type errors Yes All imports resolve, posthog.logger is a valid SDK property with .info() method
Correct imports/exports Yes usePostHog, PostHogProvider, PostHogErrorBoundary all correctly imported from @posthog/react
Minimal, focused changes Yes All changes are PostHog-related; no scope creep
Pre-existing issues None Base app is clean

Issues

No app sanity issues.

Other completed criteria

  • Environment variables documented in .env.example
  • Build configuration valid — package.json additions are well-formed
  • .gitignore updated to exclude .env files
  • tsconfig.json updated with vite/client types for proper import.meta.env typing

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.438.1 and @posthog/react ^1.11.3 added to package.json
PostHog client initialized Yes PostHogProvider with apiKey and options including api_host, defaults, capture_exceptions, and logs config
capture() Yes Four custom events: user_logged_in, user_logged_out, invoice_created, invoice_updated
identify() No Never called — login handler calls auth.login(username) and posthog.capture('user_logged_in') but never posthog.identify()
Error tracking Yes PostHogErrorBoundary wraps children, capture_exceptions: true in init options
Reverse proxy No No reverse proxy configured for this client-only app

Issues

  • Missing posthog.identify() on login: The login handler at login.tsx:26 calls auth.login(username) — the username is available — then captures user_logged_in, but never calls posthog.identify(username). All events remain anonymous, breaking user-level analytics, session replay attribution, and person profiles. Add posthog.identify(username, { name: username }) after the login call. [CRITICAL]
  • Missing posthog.reset() on logout: The logout handler at login.tsx:63-68 captures user_logged_out but never calls posthog.reset(). Without this, the next user on the same browser inherits the previous user's identity. Add posthog.reset() after the logout event capture. [MEDIUM]
  • No reverse proxy: Client-side events from posthog-js can be blocked by ad blockers. Consider configuring Vite rewrites or a managed reverse proxy. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable (VITE_PUBLIC_POSTHOG_PROJECT_TOKEN)
  • API host loaded from environment variable (VITE_PUBLIC_POSTHOG_HOST)
  • Dev-mode guard in PostHogRoot throws a helpful error if env vars are missing
  • PostHogErrorBoundary wraps the entire app tree
  • capture_exceptions: true enables automatic exception capture
  • Logger integration (posthog.logger.info()) provides structured log entries

PostHog insights and events ⚠️

Filename PostHog events Description
__root.tsx captureException (via ErrorBoundary) Captures uncaught React errors via PostHogErrorBoundary
login.tsx user_logged_in, user_logged_out Tracks login and logout actions; lacks identify/reset calls
dashboard.invoices..tsx invoice_updated Fires on successful invoice mutation; no properties attached
dashboard.invoices.index.tsx invoice_created Fires on successful invoice creation; no properties attached

Issues

  • Events lack enriching properties: invoice_updated and invoice_created are bare captures with no contextual properties. invoice_updated should include at minimum { invoice_id: invoice.id } (the invoice data is available via Route.useLoaderData()). invoice_created could include the new invoice details from the mutation response. [MEDIUM]

Other completed criteria

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

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