Skip to content

[CI] (624abe2) sveltekit/CMSaasStarter - #4472

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-624abe2-sveltekit-CMSaasStarter

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 624abe2
App: sveltekit/CMSaasStarter
App directory: apps/sveltekit/CMSaasStarter
Workbench branch: wizard-ci-624abe2-sveltekit-CMSaasStarter
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-08T09:30:31.771Z
Duration: 486.7s

YARA Scanner

✓ 213 tool calls scanned, 0 violations detected

No violations: ✓ 213 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a SvelteKit SaaS starter app (CMSaasStarter) with both client-side (posthog-js) and server-side (posthog-node) SDKs. It adds user identification via Supabase auth, client-side error tracking, server-side event captures for key SaaS lifecycle events (billing, checkout, account management), and an OpenTelemetry-based log forwarding system. The svelte.config.js is correctly updated with paths.relative: false for session replay compatibility.

Files changed Lines added Lines removed
11 +258 -5

Confidence score: 4/5 👍

  • No reverse proxy configured: The client-side posthog-js integration lacks a reverse proxy, meaning events are likely to be intercepted by ad blockers. [MEDIUM]
  • Missing defaults config option: The posthog.init() call in hooks.client.ts omits the recommended defaults date parameter, which may result in suboptimal default configuration. [MEDIUM]
  • Invalid enableExceptionAutocapture option on posthog-node: The server-side PostHog client passes enableExceptionAutocapture: true, which is a posthog-js option, not a posthog-node option. It will be silently ignored. [LOW]

File changes

Filename Score Description
src/hooks.client.ts 4/5 New file: client-side PostHog init with env validation and error boundary via handleError. Missing defaults option.
src/lib/server/posthog.ts 4/5 New file: server-side singleton with correct flushAt: 1 and flushInterval: 0. Invalid enableExceptionAutocapture option.
src/lib/server/posthog-logs.ts 3/5 New file: OpenTelemetry log forwarding to PostHog. Adds 5 heavy dependencies for a tangential feature.
src/routes/(admin)/account/+layout.svelte 5/5 Identifies users via Supabase user.id, handles re-identification on auth state change, properly guards with reset.
src/routes/(admin)/account/sign_out/+page.svelte 5/5 Correctly captures user_signed_out event and calls posthog.reset() before signing out.
src/routes/(admin)/account/api/+page.server.ts 5/5 Server-side captures for email subscription, email change, password update, account deletion, and profile save.
src/routes/(admin)/account/(menu)/billing/manage/+page.server.ts 5/5 Server-side capture for billing portal access with proper user.id distinct ID.
src/routes/(admin)/account/subscribe/[slug]/+page.server.ts 5/5 Server-side capture for checkout with plan price ID property.
svelte.config.js 5/5 Correctly sets paths.relative: false for PostHog session replay SSR compatibility.
.env.example 5/5 Documents both PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST.
package.json 4/5 Adds posthog-js, posthog-node, and 5 OpenTelemetry packages.

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors or missing dependencies; all imports resolve to valid SvelteKit aliases
Preserves existing env vars & configs Yes Existing Supabase and Stripe config untouched; auth state change handler refactored but logic preserved
No syntax or type errors Yes All TypeScript and Svelte syntax is valid
Correct imports/exports Yes /static/public, /server/*, and /* imports are all valid SvelteKit patterns
Minimal, focused changes No The OpenTelemetry logs integration adds 5 new heavy dependencies and 72 lines for a feature tangential to core PostHog integration
Pre-existing issues None —

Issues

  • OpenTelemetry logs scope creep: The posthog-logs.ts file adds 5 @opentelemetry/* dependencies and a 72-line log forwarding system. This is well beyond a basic PostHog integration and adds significant dependency weight. A simpler approach would use posthog.capture() for these lifecycle events (which the PR already does alongside the logs). [MEDIUM]
  • Invalid posthog-node option: enableExceptionAutocapture: true in src/lib/server/posthog.ts is a posthog-js browser option, not valid for posthog-node. It will be silently ignored but indicates confusion between SDK APIs. [LOW]

Other completed criteria

  • Environment variables documented in .env.example
  • Build configuration valid — package.json dependencies are properly structured
  • svelte.config.js paths correctly configured for session replay

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.435.6 and posthog-node@^5.55.0 added to dependencies
PostHog client initialized Yes Client: hooks.client.ts init() function. Server: singleton pattern with flushAt: 1, flushInterval: 0 per SvelteKit docs
capture() Yes 8 distinct server-side captures + 1 client-side capture (user_signed_out)
identify() Yes posthog.identify(user.id, { email }) in +layout.svelte using stable Supabase user ID
Error tracking Yes Client-side handleError hook with posthog.captureException(error)
Reverse proxy No No reverse proxy configured for client-side posthog-js

Issues

  • No reverse proxy: The client-side PostHog integration sends events directly to us.i.posthog.com without a reverse proxy. SvelteKit supports rewrites that could proxy PostHog requests to avoid ad blocker interception. [MEDIUM]
  • Missing defaults config: The posthog.init() call should include defaults: '2026-05-30' per PostHog docs to ensure optimal default configuration. [MEDIUM]
  • No server-side error tracking: The hooks.server.ts file is not modified to add a handleError hook for server-side exception capture with posthog-node. Only client-side errors are tracked. [LOW]

Other completed criteria

  • API key loaded from PUBLIC_POSTHOG_PROJECT_TOKEN environment variable with validation
  • API host loaded from PUBLIC_POSTHOG_HOST environment variable
  • posthog.reset() correctly called on sign-out
  • Identify handles re-authentication with reset before re-identify
  • paths.relative: false set in svelte.config.js for session replay SSR compatibility
  • Server-side captures all use await posthog?.flush() to ensure events are sent before request ends

PostHog insights and events ✅

Filename PostHog events Description
+layout.svelte identify User identification on mount and auth state change using Supabase user.id
sign_out/+page.svelte user_signed_out, reset Captures sign-out event and resets PostHog identity
billing/manage/+page.server.ts billing_portal_opened Server-side capture when user opens Stripe billing portal
subscribe/[slug]/+page.server.ts checkout_started Server-side capture with plan_price_id property when subscription checkout begins
api/+page.server.ts email_subscription_updated, email_change_requested, password_updated, account_deleted, profile_saved Server-side captures for all account management actions with contextual properties
hooks.client.ts captureException Client-side error boundary capturing unhandled errors

Issues

  • None — events are well-structured and cover key SaaS lifecycle actions.

Other completed criteria

  • Events represent real user actions mapped to actual SaaS product flows
  • Events enable product insights — can build signup → checkout funnel, track billing engagement, measure account management activity
  • Events include relevant properties (plan_price_id, is_subscribed, recovery_flow, is_new_profile)
  • No PII in capture properties — email is only passed via identify() person properties
  • Event names use consistent snake_case convention with descriptive action names

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