Skip to content

[CI] (8dccaac) stripe/stripe-saas-demo - #2378

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-8dccaac-stripe-stripe-saas-demo
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-8dccaac-stripe-stripe-saas-demo

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 8dccaac
App: stripe/stripe-saas-demo
App directory: apps/stripe/stripe-saas-demo
Workbench branch: wizard-ci-8dccaac-stripe-stripe-saas-demo
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-03T01:06:34.161Z
Duration: 212.7s

YARA Scanner

✓ 22 tool calls scanned, 0 violations detected

No violations: ✓ 22 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Author

Now I have enough context to evaluate this PR. Let me write the review.


PR Evaluation Report

Summary

This PR adds posthog_person_distinct_id metadata to Stripe Customer, Checkout Session (subscription_data), and Subscription objects in a Stripe SaaS demo backend. The purpose is to link Stripe revenue data to PostHog person profiles for the revenue analytics feature. A report file is also added documenting the changes.

Files changed Lines added Lines removed
4 +100 -5

Confidence score: 4/5 👍

  • Inconsistent distinct_id fallback chains: checkout.ts falls back to posthogDistinctId || customerEmail || "TODO_POSTHOG_DISTINCT_ID", customers.ts uses posthogDistinctId || email, and subscriptions.ts uses user?.posthogDistinctId ?? "TODO_POSTHOG_DISTINCT_ID" with no email fallback. The subscriptions route will produce a literal "TODO_POSTHOG_DISTINCT_ID" string in Stripe metadata when posthogDistinctId is absent, creating broken linkage in PostHog. [MEDIUM]
  • No PostHog capture events for revenue actions: The revenue-analytics wizard adds metadata but does not capture any PostHog events (e.g., subscription_created, checkout_started, payment_received). This limits the ability to build revenue funnels or correlate Stripe actions with product behavior in PostHog beyond the data warehouse sync. [MEDIUM]
  • No error tracking added: No error tracking was set up by this PR. [MEDIUM]

File changes

Filename Score Description
backend/routes/checkout.ts 4/5 Adds getUser import, resolves posthogDistinctId, adds subscription_data.metadata with fallback chain
backend/routes/customers.ts 4/5 Adds posthog_person_distinct_id to customer metadata with email fallback
backend/routes/subscriptions.ts 3/5 Refactors user lookup, adds metadata but with weak fallback (no email, just TODO placeholder)
posthog-revenue-report.md 4/5 Clear documentation of changes and manual steps needed

App sanity check ✅

Criteria Result Description
App builds and runs Yes Changes are syntactically valid TypeScript, no breaking changes
Preserves existing env vars & configs Yes No env vars or configs modified; existing functionality preserved
No syntax or type errors Yes All changes are valid TypeScript with correct property access patterns
Correct imports/exports Yes getUser import from ../users is correct and the module exports it
Minimal, focused changes Yes Only adds metadata to Stripe objects and minor refactor in subscriptions.ts
Pre-existing issues The frontend uses raw email as PostHog distinct_id (posthog.identify(email, ...)), which is a fragile pattern but was not introduced by this PR

Issues

  • Inconsistent fallback for posthog_person_distinct_id: In subscriptions.ts, when user?.posthogDistinctId is undefined, the fallback is the literal string "TODO_POSTHOG_DISTINCT_ID" with no email fallback, unlike customers.ts and checkout.ts which fall back to email. This inconsistency means subscriptions created without a stored posthogDistinctId will have broken PostHog linkage. [MEDIUM]

Other completed criteria

  • All changes are directly related to PostHog revenue analytics integration
  • Correct files modified for Stripe metadata addition
  • Code follows existing patterns (optional chaining, ternary for user lookup)
  • No build config changes needed

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-node (backend) and posthog-js (frontend) already present in package.json — pre-existing, not added by this PR
PostHog client initialized Yes Backend posthog client already initialized in backend/posthog.ts; frontend in frontend/src/posthog.ts — pre-existing
capture() No No capture() calls added by this PR for revenue-related events
identify() N/A Server-side changes only; identify already handled in frontend (pre-existing)
Error tracking No No error tracking set up
Reverse proxy N/A Server-side changes only

Issues

  • No revenue event captures: The PR only adds metadata to Stripe objects but does not capture any PostHog events for revenue-related actions like subscription creation, checkout initiation, or payment completion. While the data warehouse sync will import Stripe data, explicit capture events would enable richer funnels and real-time analytics. [MEDIUM]
  • No error tracking: No exception tracking was added for Stripe API failures or other server-side errors. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable (pre-existing in POSTHOG_API_KEY)
  • API host correctly configured (pre-existing, defaults to https://us.i.posthog.com)
  • PostHog SDK correctly installed in both frontend and backend packages

PostHog insights and events ⚠️

Filename PostHog events Description
backend/routes/checkout.ts None (metadata only) Adds posthog_person_distinct_id to Stripe checkout session subscription_data metadata for revenue linkage
backend/routes/customers.ts None (metadata only) Adds posthog_person_distinct_id to Stripe customer metadata
backend/routes/subscriptions.ts None (metadata only) Adds posthog_person_distinct_id to Stripe subscription metadata

Issues

  • No PostHog events captured: The PR adds zero posthog.capture() calls. Revenue-related events such as checkout_started, subscription_created, or customer_created with enriched properties (plan, amount, currency) would enable product insights and funnel analysis beyond what the Stripe data warehouse sync provides. [MEDIUM]
  • TODO_POSTHOG_DISTINCT_ID placeholder as distinct_id: When the user's posthogDistinctId cannot be resolved, the literal string "TODO_POSTHOG_DISTINCT_ID" is stored in Stripe metadata. PostHog will attempt to match this to a person profile, potentially creating a garbage person record or silently failing to link revenue data. This should at minimum be omitted (don't set the metadata key) rather than set to a placeholder. [MEDIUM]

Other completed criteria

  • Metadata key posthog_person_distinct_id follows the correct PostHog convention for Stripe revenue analytics
  • Documentation report clearly explains the changes and required manual steps

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