Skip to content

[CI] (9f92c68) sveltekit/CMSaasStarter - #2560

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-9f92c68-sveltekit-CMSaasStarter
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-9f92c68-sveltekit-CMSaasStarter

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 9f92c68
App: sveltekit/CMSaasStarter
App directory: apps/sveltekit/CMSaasStarter
Workbench branch: wizard-ci-9f92c68-sveltekit-CMSaasStarter
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-08T17:20:42.827Z
Duration: 636.8s

YARA Scanner

✓ 72 tool calls scanned, 0 violations detected

No violations: ✓ 72 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a SvelteKit CMSaasStarter app with both client-side (posthog-js) and server-side (posthog-node) SDKs. It adds client initialization via hooks.client.ts, a server-side singleton, a reverse proxy through /ingest, user identification on sign-in/sign-up, posthog.reset() on sign-out, error tracking on both client and server, and 12 meaningful event captures across authentication, billing, profile, and contact flows.

Files changed Lines added Lines removed
13 +244 -5

Confidence score: 4/5 👍

  • Fabricated distinctId values: Server-side events use hardcoded "server" and "anonymous" as distinctId instead of real user/session identifiers, which creates orphaned events that can't be tied back to real users. [MEDIUM]
  • .env.example not updated: PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are not added to .env.example, so collaborators won't know which env vars to set. [MEDIUM]

File changes

Filename Score Description
package.json 5/5 Adds posthog-js and posthog-node to dependencies
src/hooks.client.ts 5/5 Client-side PostHog init via SvelteKit init() with error tracking
src/hooks.server.ts 4/5 Reverse proxy + server error handler; error handler uses fabricated distinctId: "server"
src/lib/server/posthog.ts 5/5 Clean server-side PostHog singleton with immediate flush settings
svelte.config.js 5/5 Sets paths.relative: false for session replay SSR compatibility
src/routes/(marketing)/login/sign_in/+page.svelte 5/5 Identifies user and captures sign-in event
src/routes/(marketing)/login/sign_up/+page.svelte 5/5 Identifies user and captures sign-up event
src/routes/(admin)/account/sign_out/+page.svelte 5/5 Captures sign-out and calls posthog.reset()
src/routes/(admin)/account/api/+page.server.ts 5/5 Captures profile, password, email, delete, and subscription events
src/routes/(admin)/account/subscribe/[slug]/+page.server.ts 5/5 Captures subscription checkout with plan_id
src/routes/(admin)/account/(menu)/billing/manage/+page.server.ts 5/5 Captures billing portal access
src/routes/(marketing)/contact_us/+page.server.ts 3/5 Uses fabricated distinctId: "anonymous"
posthog-setup-report.md 5/5 Comprehensive setup report with next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; all imports resolve correctly for SvelteKit
Preserves existing env vars & configs Yes Existing Supabase, Stripe configs untouched; only PostHog additions made
No syntax or type errors Yes All TypeScript/Svelte syntax is valid
Correct imports/exports Yes /static/public, /server/posthog, posthog-js, posthog-node all correct
Minimal, focused changes Yes All changes directly related to PostHog integration
Pre-existing issues None Base app appears functional

Issues

  • .env.example not updated: PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are required environment variables but are not documented in .env.example. Collaborators and CI won't know to set them. Add these variables to .env.example. [MEDIUM]

Other completed criteria

  • Build configuration is valid — package.json additions are well-formed
  • svelte.config.js changes are minimal and correctly structured
  • Existing sequence() hook chain properly extended with posthogProxy

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.396.4 and posthog-node@^5.39.2 in package.json dependencies
PostHog client initialized Yes Client initialized in hooks.client.ts via SvelteKit's init() export with capture_exceptions: true and defaults: "2026-01-30". Server singleton created in /server/posthog.ts with flushAt: 1, flushInterval: 0.
capture() Yes 12 distinct events captured across client and server
identify() Yes posthog.identify(session.user.id, { email }) on sign-in and sign-up; posthog.reset() on sign-out
Error tracking Yes Client: capture_exceptions: true + handleError with captureException(). Server: handleError captures server_error events.
Reverse proxy Yes /ingest proxy in hooks.server.ts correctly routes /ingest/static/* and /ingest/array/* to us-assets.i.posthog.com and all other /ingest/* to us.i.posthog.com

Issues

  • Fabricated distinctId in server error handler: handleError uses distinctId: "server" — a hardcoded string that creates orphaned events not tied to any real user. Consider extracting the user ID from the request context or cookies, or omitting the capture if no user context is available. [MEDIUM]
  • Fabricated distinctId in contact form: contact_form_submitted uses distinctId: "anonymous" instead of deriving an ID from the PostHog cookie or session. This means all contact form submissions appear as the same "user." [MEDIUM]

Other completed criteria

  • API key loaded from PUBLIC_POSTHOG_PROJECT_TOKEN environment variable (not hardcoded)
  • Host correctly configured through reverse proxy /ingest → us.i.posthog.com
  • paths.relative: false set in svelte.config.js for session replay SSR compatibility (SvelteKit-specific requirement)
  • ui_host correctly set to https://us.posthog.com alongside the proxy api_host
  • Server-side singleton pattern avoids creating new clients per request

PostHog insights and events ✅

Filename PostHog events Description
sign_in/+page.svelte user_signed_in Fires on successful sign-in with provider property; also calls identify()
sign_up/+page.svelte user_signed_up Fires on successful sign-up with provider property; also calls identify()
sign_out/+page.svelte user_signed_out Fires on sign-out; calls posthog.reset() to unlink the user
api/+page.server.ts profile_created, profile_updated, password_changed, email_change_requested, account_deleted, email_subscription_toggled Server-side events covering all account management actions with user IDs from auth session
subscribe/[slug]/+page.server.ts subscription_checkout_started Captures Stripe checkout initiation with plan_id
billing/manage/+page.server.ts billing_portal_accessed Captures when user opens Stripe billing portal
contact_us/+page.server.ts contact_form_submitted Captures contact form submissions with has_company, has_phone metadata
hooks.client.ts captureException Client-side error boundary captures exceptions
hooks.server.ts server_error Server-side error handler captures unhandled errors

Issues

  • No critical or medium issues with event quality.

Other completed criteria

  • Events represent real user actions across the full product lifecycle (signup → subscription → account management → churn)
  • Events enable product insights — can build signup-to-subscription funnels, retention, and churn analysis
  • Events include relevant properties (provider, plan_id, has_company, unsubscribed status, company_name)
  • No PII in capture() properties — email is only passed via identify() as person properties
  • Event names are descriptive, consistent snake_case (user_signed_in, subscription_checkout_started, billing_portal_accessed)

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