Skip to content

[CI] (cc5471b) stripe/stripe-next-js-saas-starter - #4804

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

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

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: stripe/stripe-next-js-saas-starter
App directory: apps/stripe/stripe-next-js-saas-starter
Workbench branch: wizard-ci-cc5471b-stripe-stripe-next-js-saas-starter
Wizard branch: main
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-28T17:14:23.450Z
Duration: 223.6s

YARA Scanner

✓ 35 tool calls scanned, 0 violations detected

No violations: ✓ 35 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. The base app already has a full PostHog integration (posthog-js + posthog-node, instrumentation-client.ts, identify/reset in layout, reverse proxy via Next.js rewrites). This PR from the revenue-analytics wizard only adds Stripe metadata for revenue tracking.


PR Evaluation Report

Summary

This revenue-analytics wizard PR adds posthog_person_distinct_id metadata to Stripe Checkout Session and Subscription objects in the existing createCheckoutSession function. The changes are minimal and correctly scoped — the base app already has a complete PostHog integration, so the wizard only needed to wire up the Stripe ↔ PostHog user linkage. A posthog-revenue-report.md documentation file was also created.

Files changed Lines added Lines removed
2 +35 -2

Confidence score: 5/5 🧙

  • No new env vars are introduced by this PR, but .env.example still lacks the pre-existing PostHog env vars (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN, NEXT_PUBLIC_POSTHOG_HOST) used by instrumentation-client.ts — this is a pre-existing gap, not introduced by this PR [LOW]

File changes

Filename Score Description
lib/payments/stripe.ts 5/5 Adds posthog_person_distinct_id metadata to both the Checkout Session and subscription_data, using String(user.id) as the distinct ID — consistent with the existing posthog.identify(String(user.id)) call in the app's layout.
posthog-revenue-report.md 4/5 Clear documentation of changes, verification steps, and manual next steps. Minor nit: lists .env.local as created but it's not committed.

App sanity check ✅

Criteria Result Description
App builds and runs Yes TypeScript compilation passes; full build fails on missing POSTGRES_URL which is a pre-existing issue
Preserves existing env vars & configs Yes No existing configs modified beyond the targeted Stripe metadata additions
No syntax or type errors Yes Valid TypeScript; String(user.id) produces a string compatible with Stripe metadata
Correct imports/exports Yes No new imports needed — change is entirely within existing function scope
Minimal, focused changes Yes Only 9 lines of functional code changed, all directly related to revenue analytics metadata
Pre-existing issues POSTGRES_URL not configured locally; .env.example doesn't document PostHog env vars used by instrumentation-client.ts

Issues

  • No issues introduced by this PR

Other completed criteria

  • Environment variables used by this PR's changes (user.id, BASE_URL) are pre-existing and documented
  • Build configuration unchanged and valid

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 instrumentation-client.ts calls posthog.init() with env vars and correct config (pre-existing)
capture() Yes Autocapture enabled by default; layout has identify/reset patterns (pre-existing)
identify() Yes app/(dashboard)/layout.tsx calls posthog.identify(String(user.id)) — matches the posthog_person_distinct_id value used in this PR
Error tracking Yes capture_exceptions: true in posthog.init config (pre-existing)
Reverse proxy Yes next.config.ts rewrites /ingest/* → us.i.posthog.com and /ingest/static/* → us-assets.i.posthog.com (pre-existing)

Issues

  • No issues introduced by this PR

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable, not hardcoded
  • Host correctly configured via reverse proxy (/ingest → https://us.i.posthog.com)
  • Distinct ID consistency: String(user.id) used in both posthog.identify() and posthog_person_distinct_id metadata — this is critical for revenue analytics to correctly link Stripe customers to PostHog persons
  • client_reference_id reused for the same posthogDistinctId value, maintaining backward compatibility

PostHog insights and events ✅

Filename PostHog events Description
lib/payments/stripe.ts Stripe metadata: posthog_person_distinct_id Attaches PostHog distinct ID to Checkout Session metadata and Subscription metadata, enabling PostHog revenue analytics to correlate Stripe subscription data with PostHog person profiles

Issues

  • No issues

Other completed criteria

  • Metadata key posthog_person_distinct_id follows PostHog's expected naming convention for revenue analytics
  • Distinct ID uses real auth context (user.id), not fabricated values
  • No PII in metadata — only a numeric user ID
  • Metadata applied to both Checkout Session and Subscription, ensuring revenue tracking works for both initial purchase and ongoing subscription lifecycle events

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