Skip to content

[CI] (e2f7ab0) stripe/stripe-next-js-saas-starter#2430

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-e2f7ab0-stripe-stripe-next-js-saas-starter
Closed

[CI] (e2f7ab0) stripe/stripe-next-js-saas-starter#2430
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-e2f7ab0-stripe-stripe-next-js-saas-starter

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: stripe/stripe-next-js-saas-starter
App directory: apps/stripe/stripe-next-js-saas-starter
Workbench branch: wizard-ci-e2f7ab0-stripe-stripe-next-js-saas-starter
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-06T22:11:03.650Z
Duration: 125.8s

YARA Scanner

✓ 31 tool calls scanned, 0 violations detected

No violations: ✓ 31 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Author

Now let me produce the evaluation report.


PR Evaluation Report

Summary

This is a revenue-analytics wizard PR that threads the PostHog distinct ID (posthog_person_distinct_id) into Stripe checkout session and subscription metadata, enabling PostHog to correlate revenue data with identified users. The changes are minimal, focused, and correctly modify the three files involved in the checkout flow.

Files changed Lines added Lines removed
4 +54 -6

Confidence score: 5/5 🧙

  • No error tracking (e.g., captureException, error boundary) is set up in the app — this is a pre-existing gap, not introduced by this PR. [MEDIUM]
  • No reverse proxy is configured for the Next.js app, meaning client-side PostHog requests may be blocked by ad blockers — pre-existing gap. [MEDIUM]
  • In lib/payments/actions.ts, String(user?.id) could produce the string "undefined" if user is null, which would be stored as the Stripe metadata distinct ID, bypassing the fallback in createCheckoutSession. [LOW]

File changes

Filename Score Description
app/(login)/actions.ts 5/5 Threads posthogDistinctId from authenticated user into checkout session calls for both sign-in and sign-up redirect flows
lib/payments/actions.ts 4/5 Passes posthogDistinctId to checkout session; minor risk with String(user?.id) producing "undefined"
lib/payments/stripe.ts 5/5 Adds posthog_person_distinct_id metadata to both checkout session and subscription, and sets client_reference_id to the distinct ID
posthog-revenue-report.md 4/5 Clear summary of changes and manual verification steps

App sanity check ✅

Criteria Result Description
App builds and runs Yes Changes are additive — adds an optional parameter and metadata fields; no breaking changes
Preserves existing env vars & configs Yes No existing env vars or configs modified; only new metadata fields added to Stripe calls
No syntax or type errors Yes TypeScript is valid; posthogDistinctId is correctly typed as string | undefined
Correct imports/exports Yes No new imports needed; changes use existing function signatures
Minimal, focused changes Yes Only modifies what is necessary to thread distinct ID into Stripe metadata
Pre-existing issues .env.example does not document PostHog env vars (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN, NEXT_PUBLIC_POSTHOG_HOST, POSTHOG_PROJECT_ID) These were added by a prior integration, not by this PR

Issues

  • Optional chaining risk in checkoutAction: String(user?.id) in lib/payments/actions.ts produces "undefined" (a truthy string) if user is null. Since createCheckoutSession checks posthogDistinctId ?? user.id.toString(), the truthy "undefined" string bypasses the fallback. Use user?.id?.toString() or guard against null before calling. [LOW]

Other completed criteria

  • All changes relate to PostHog revenue analytics integration
  • Correct files modified for the checkout flow (stripe.ts, both actions.ts files)
  • Code follows existing codebase patterns (TypeScript types, function signatures, formatting)
  • No unnecessary modifications or scope creep

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog-js (^1.369.0) and posthog-node (^5.29.2) in package.json (pre-existing)
PostHog client initialized Yes Server-side client initialized in lib/posthog-server.ts with flushAt: 1 and flushInterval: 0 (pre-existing, correct for Next.js server functions)
capture() Yes Multiple capture calls exist in lib/payments/actions.ts (e.g., checkout_initiated, customer_portal_opened) and app/(login)/actions.ts (e.g., user_signed_in, user_signed_up) — all pre-existing
identify() Yes posthog.identify() called in sign-in/sign-up flows using String(user.id) — real database user IDs, not fabricated values
Error tracking No No captureException, error boundary, or exception autocapture configured (pre-existing gap)
Reverse proxy No No reverse proxy configured for this Next.js app (pre-existing gap)

Issues

  • No error tracking configured: No captureException() calls or error boundaries are set up. This is a pre-existing gap not introduced by this PR, but means exceptions in the checkout flow won't be captured. [MEDIUM]
  • No reverse proxy: Client-side PostHog requests go directly to us.i.posthog.com and may be blocked by ad blockers. This is a pre-existing gap. [MEDIUM]

Other completed criteria

  • API key loaded from process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN (not hardcoded)
  • Host correctly configured via process.env.NEXT_PUBLIC_POSTHOG_HOST pointing to https://us.i.posthog.com
  • Distinct IDs use real database user IDs (String(user.id)) for consistent correlation between PostHog and Stripe
  • Stripe metadata includes posthog_person_distinct_id on both checkout session and subscription objects

PostHog insights and events ✅

Filename PostHog events Description
lib/payments/stripe.ts Stripe metadata: posthog_person_distinct_id Adds PostHog distinct ID to Stripe checkout session metadata and subscription metadata, enabling PostHog revenue analytics to correlate payments with users
lib/payments/actions.ts checkout_initiated (pre-existing) Captures checkout initiation with team_id and price_id properties
app/(login)/actions.ts user_signed_in, user_signed_up (pre-existing) Captures auth events with user identification; threads distinct ID to checkout on redirect

Issues

No issues specific to event quality in this PR.

Other completed criteria

  • Events represent real user actions (checkout, sign-in, sign-up)
  • Events enable product insights (revenue funnel from sign-up → checkout)
  • Events include relevant properties (team_id, price_id, plan name)
  • No PII in event properties (email/name only in identify person properties)
  • Event names are descriptive snake_case (checkout_initiated, user_signed_in, etc.)

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