[CI] (6fb03e7) tanstack-start/tanstack-start-saas#1490
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
[CI] (6fb03e7) tanstack-start/tanstack-start-saas#1490wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a TanStack Start SaaS invoicing app (CloudFlow). It adds client-side tracking via
Confidence score: 5/5 🧙
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | All syntax is valid, dependencies added correctly |
| Preserves existing env vars & configs | Yes | Only adds PostHog-related config; existing code intact |
| No syntax or type errors | Yes | All files are syntactically valid TypeScript/TSX |
| Correct imports/exports | Yes | @posthog/react, posthog-js, posthog-node all imported correctly |
| Minimal, focused changes | Yes | All changes relate to PostHog integration |
| Pre-existing issues | None | Base app appears functional |
Issues
- No
posthog.shutdown()on server routes: Server-side captures inapi/invoices.tsandapi/invoices..pay.tsnever callawait posthog.shutdown(). WithflushAt: 1this may still work in many cases since the singleton persists, but events could be lost on cold starts or process termination. The TanStack Start docs explicitly recommend calling shutdown. [MEDIUM]
Other completed criteria
- All changes are PostHog-related with no unrelated edits
- Package.json correctly updated with all three PostHog packages
- Environment variables documented in
.envfile and wizard report - Build configuration (vite.config.ts) is valid
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.373.4, @posthog/react@^1.9.0, posthog-node@^5.34.1 added |
| PostHog client initialized | Yes | PostHogProvider in __root.tsx with apiKey from env var; server singleton in posthog-server.ts |
| capture() | Yes | invoice_created and invoice_paid on both client and server |
| identify() | No | No posthog.identify() call anywhere in the app. No posthog.reset() on logout either |
| Error tracking | Yes | capture_exceptions: true in config + manual posthog.captureException() in catch blocks |
| Reverse proxy | Yes | Vite dev proxy routes /ingest/* to PostHog with correct /ingest/static and /ingest/array routing to us-assets.i.posthog.com |
Issues
- No user identification: There is no
posthog.identify()call anywhere in the codebase. The docs state this is required to link events to known users. All client and server events will remain anonymous, making it impossible to build user-level funnels or retention analysis. [CRITICAL] - Fabricated
distinctIdon server: Server-side captures usedistinctId: \invoice-`— an invoice identifier, not a user identifier. This creates phantom person profiles in PostHog (one per invoice) and fragments data. Should use a real user ID from authentication context, or at minimum theX-PostHog-Distinct-Id` header from the client. [CRITICAL] - Reverse proxy is dev-only: The Vite
server.proxyconfiguration only applies duringvite dev. In production,api_host: '/ingest'will fail since no production proxy (e.g., Nitro middleware or hosting provider rewrite) is configured. [MEDIUM]
Other completed criteria
- API key loaded from
VITE_PUBLIC_POSTHOG_PROJECT_TOKENenvironment variable - Host correctly configured via reverse proxy pointing to
us.i.posthog.comandus-assets.i.posthog.com - Server-side PostHog client uses correct singleton pattern with
flushAt: 1andflushInterval: 0 capture_exceptions: trueenables automatic exception capture
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
src/routes/posts.index.tsx |
invoice_created, captureException |
Captures invoice creation on form submit with title, amount, due_date properties; exceptions on failure |
src/routes/posts..tsx |
invoice_paid, captureException |
Captures invoice payment on button click with invoice_id, title, amount; exceptions on failure |
src/routes/api/invoices.ts |
invoice_created |
Server-side duplicate of creation event with additional source and session_id properties |
src/routes/api/invoices..pay.ts |
invoice_paid |
Server-side duplicate of payment event with session_id correlation |
Issues
- Fabricated distinctId undermines event quality: Server events with
distinctId: \invoice-`` cannot be correlated to real users, making server-side events analytically useless for person-level analysis. The events themselves are well-structured but orphaned from user profiles. [CRITICAL] - Duplicate client+server events: Both
invoice_createdandinvoice_paidare captured on client AND server. Without proper distinct_id alignment, these will appear as events from different "users" and cannot be deduplicated. With proper user IDs this would be fine for data validation, but as-is it doubles noise. [MEDIUM]
Other completed criteria
- Events represent real user actions (creating invoices, paying invoices)
- Events enable product insights (invoice_created → invoice_paid funnel)
- Events include relevant properties (amounts, titles, IDs, source)
- No PII in event properties
- Event names are descriptive and use consistent snake_case naming
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: scheduled
Trigger ID:
6fb03e7App:
tanstack-start/tanstack-start-saasApp directory:
apps/tanstack-start/tanstack-start-saasWorkbench branch:
wizard-ci-6fb03e7-tanstack-start-tanstack-start-saasWizard branch:
mainContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-05-13T17:51:13.104Z
Duration: 345.3s