Repository navigation
[CI] (cc5471b) stripe/stripe-saas-demo - #4803
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
|
Now I have full context. Let me write the evaluation. PR Evaluation ReportSummaryThis PR adds PostHog revenue analytics integration to a Stripe SaaS demo app by attaching
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax errors or missing dependencies introduced |
| Preserves existing env vars & configs | No | client_reference_id change from userId to posthogDistinctId breaks the webhook handler's getUser() lookup |
| No syntax or type errors | Yes | All TypeScript is syntactically valid with correct types |
| Correct imports/exports | Yes | getUser import correctly added to checkout.ts |
| Minimal, focused changes | Yes | Only metadata additions and one refactor in subscriptions.ts |
| Pre-existing issues | See below | Webhook handler uses Stripe customer ID as distinctId for subscription/invoice events (not PostHog distinct ID) |
Issues
client_reference_idchange breaks webhook user lookup: Inwebhooks.tsline 40,getUser(session.client_reference_id)expects an internal user ID (e.g.,user_1698...), but the PR changesclient_reference_idtoposthogDistinctId.getUser()usesusers.get(id)which indexes by internal ID, so it will always returnundefined. The PostHog distinctId for captures still resolves correctly via the?? session.client_reference_idfallback, but the user lookup and console logging on lines 43-48 are broken. Fix: either add agetUserByPosthogDistinctId()function, or store both values in the Checkout Session metadata. [MEDIUM]
Other completed criteria
- Environment variables already documented in base app's
.env.example - Build configuration unchanged and valid
- No unrelated code modifications
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-node v5.29.0 in backend, posthog-js v1.205.2 in frontend (pre-existing) |
| PostHog client initialized | Yes | Backend uses PostHog from posthog-node, frontend uses posthog-js (pre-existing) |
| capture() | No | This PR adds no new posthog.capture() calls; base app has captures in webhooks.ts |
| identify() | Yes | Pre-existing in customers.ts route (not modified by PR) |
| Error tracking | No | No error tracking setup added |
| Reverse proxy | No | No reverse proxy configured for the frontend posthog-js client |
Issues
- No capture events added: The revenue-analytics wizard should ideally add revenue-specific capture events (e.g., tracking subscription changes, MRR events). The PR only adds Stripe metadata linking without any new PostHog event captures. [MEDIUM]
- No error tracking: No
captureExceptionor error boundary setup was added to either frontend or backend. [MEDIUM] - No reverse proxy: The frontend uses posthog-js directly against
us.i.posthog.comwithout a reverse proxy, making it susceptible to ad blockers. [MEDIUM]
Other completed criteria
- API key correctly loaded from environment variables (
POSTHOG_API_KEYfor backend,VITE_POSTHOG_API_KEYfor frontend) - Host correctly configured via environment variables
posthog_person_distinct_idmetadata correctly uses the real PostHog distinct ID from the user object, not fabricated values
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
backend/routes/checkout.ts |
(metadata only) | Adds posthog_person_distinct_id to Checkout Session metadata and subscription_data.metadata — enables PostHog revenue analytics to link checkout-created subscriptions to persons |
backend/routes/customers.ts |
(metadata only) | Adds posthog_person_distinct_id to Stripe Customer metadata — enables PostHog to link Stripe customers to PostHog persons |
backend/routes/subscriptions.ts |
(metadata only) | Adds posthog_person_distinct_id to direct Subscription metadata — enables PostHog to link subscriptions to persons |
Issues
- No new events captured: The PR only adds Stripe metadata without introducing new PostHog events. Revenue-specific events like
subscription_started,plan_upgraded, orpayment_receivedwould significantly improve the analytics value. [MEDIUM] - Webhook events use Stripe customer ID as distinctId: Pre-existing issue —
subscription_createdandinvoice_paidwebhook handlers usesubscription.customer(Stripe customer ID) as the PostHog distinctId rather than theposthog_person_distinct_idfrom metadata. This means those events won't be linked to the correct PostHog person unless the Stripe data source resolves the mapping. [LOW]
Other completed criteria
- No PII placed in event properties or metadata — only the PostHog distinct ID is used
- Metadata key
posthog_person_distinct_idfollows the PostHog convention for Stripe revenue analytics linking
Reviewed by wizard workbench PR evaluator
This pull request was closed.
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:
cc5471bApp:
stripe/stripe-saas-demoApp directory:
apps/stripe/stripe-saas-demoWorkbench branch:
wizard-ci-cc5471b-stripe-stripe-saas-demoWizard branch:
mainContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-10-28T17:12:41.172Z
Duration: 194.5s
YARA Scanner