Skip to content

[CI] (0ae2102) sveltekit/CMSaasStarter - #1246

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-0ae2102-sveltekit-CMSaasStarter

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Apr 15, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 0ae2102
App: sveltekit/CMSaasStarter
App directory: apps/sveltekit/CMSaasStarter
Workbench branch: wizard-ci-0ae2102-sveltekit-CMSaasStarter
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-04-15T19:47:04.131Z
Duration: 551.7s

@wizard-ci-bot

wizard-ci-bot Bot commented Apr 15, 2026

Copy link
Copy Markdown
Author

Now I have all the information I need for a thorough evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog analytics into a SvelteKit SaaS starter app, adding both client-side (posthog-js) and server-side (posthog-node) SDKs. It instruments 12 business events across authentication, billing, account management, and contact flows, with a reverse proxy, error tracking on both client and server, user identification, and the required paths.relative: false SSR fix.

Files changed Lines added Lines removed
14 +291 -8

Confidence score: 4/5 👍

  • PII in event properties: Multiple server-side capture() calls include user_email directly in event properties (billing, checkout, account deletion). This should use `` person properties instead. [MEDIUM]
  • Email used as distinct_id: contact_us_submitted uses raw email as the distinctId, which creates fragmented person profiles and leaks PII into the distinct ID field. A session-based or anonymous ID should be used instead. [MEDIUM]
  • Server error tracking uses hardcoded distinctId: "server": The handleError in hooks.server.ts uses a static string "server" as the distinct ID, which doesn't use captureException from posthog-node and instead manually captures a server_error event. This won't integrate with PostHog's error tracking product properly. [MEDIUM]
  • .env.example not updated: The PostHog env vars (PUBLIC_POSTHOG_PROJECT_TOKEN, PUBLIC_POSTHOG_HOST) are only in .env but not documented in .env.example. [MEDIUM]
  • **used incorrectly in server-side capture**: In `profile_created`/`profile_updated`, is nested inside properties of a posthog-node capture call. For the Node SDK, person properties should be set via `` at the top level of properties, which is what the code does — but it wraps PII (full name, email) in event properties rather than using identify(). [LOW]

File changes

Filename Score Description
package.json 5/5 Correctly adds posthog-js and posthog-node to dependencies
src/hooks.client.ts 5/5 Clean client-side init with reverse proxy, error capture, defaults config
src/hooks.server.ts 4/5 Good reverse proxy and error handler, but error handler uses manual capture instead of captureException
src/lib/server/posthog.ts 4/5 Singleton pattern, but flushAt: 1, flushInterval: 0 means no batching — each event causes an HTTP request
src/routes/.../billing/manage/+page.server.ts 3/5 PII (user_email) in event properties
src/routes/.../api/+page.server.ts 4/5 Good variety of events; account_deleted has PII in properties
src/routes/.../sign_out/+page.svelte 5/5 Captures sign-out and calls reset() correctly
src/routes/.../subscribe/[slug]/+page.server.ts 3/5 PII (user_email) in event properties
src/routes/.../contact_us/+page.server.ts 2/5 Uses raw email as distinctId — creates fragmented profiles
src/routes/.../sign_in/+page.svelte 5/5 Proper identify + capture on auth state change
src/routes/.../sign_up/+page.svelte 5/5 Proper identify + capture on signup
src/routes/.../pricing_module.svelte 5/5 Clean plan_selected event with relevant properties
svelte.config.js 5/5 Correctly sets paths.relative to false for SSR replay
posthog-setup-report.md — Documentation only

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors, valid TypeScript, proper SvelteKit patterns
Preserves existing env vars & configs Yes Existing supabase and stripe configs untouched
No syntax or type errors Yes All files use correct SvelteKit types and patterns
Correct imports/exports Yes posthog-js used client-side, posthog-node used server-side — correct separation
Minimal, focused changes Yes All changes relate to PostHog integration; small refactors (destructuring data.supabase) are minor
Pre-existing issues None Base app appears functional

Issues

  • .env.example not updated with PostHog variables: The new env vars PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST only exist in .env (which is typically gitignored) and are not documented in .env.example. Developers cloning the repo won't know these variables are needed. [MEDIUM]

Other completed criteria

  • Build configuration is valid — package.json has correct dependency entries
  • No unrelated modifications to existing code beyond necessary PostHog integration points
  • Code quality matches existing codebase patterns (TypeScript, SvelteKit conventions)

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.369.0 and posthog-node@^5.29.2 added to dependencies
PostHog client initialized Yes Client init in hooks.client.ts using init() lifecycle hook with defaults: "2026-01-30", env var for token, reverse proxy host. Server singleton in /server/posthog.ts
capture() Yes 12 meaningful capture calls across client and server
identify() Yes Called on sign-in and sign-up with session.user.id and email as person property. reset() called on sign-out
Error tracking Yes Client: capture_exceptions: true in init + captureException() in handleError. Server: manual error capture (not using posthog-node's captureException but functional)
Reverse proxy Yes Full reverse proxy implementation in hooks.server.ts routing /ingest to us.i.posthog.com and /ingest/static/ to us-assets.i.posthog.com

Issues

  • Server error tracking uses manual capture instead of captureException: The server handleError manually captures a server_error event with distinctId: "server" instead of using posthog-node's error tracking patterns. This won't integrate with PostHog's Error Tracking product. [MEDIUM]
  • Redundant getPostHogClient() calls: Each server-side action calls getPostHogClient() locally (sometimes with unique variable names like posthogPw, posthogDel, posthogProfile). While the singleton pattern means this works, the variable naming is inconsistent. [LOW]

Other completed criteria

  • API key loaded from PUBLIC_POSTHOG_PROJECT_TOKEN environment variable — not hardcoded
  • API host configured via PUBLIC_POSTHOG_HOST env var for server and /ingest reverse proxy for client
  • paths.relative: false correctly set in svelte.config.js for SSR replay compatibility
  • ui_host correctly set to https://us.posthog.com to allow toolbar/survey access through proxy

PostHog insights and events ⚠️

Filename PostHog events Description
sign_in/+page.svelte user_signed_in Captures auth provider; includes identify() with user ID
sign_up/+page.svelte user_signed_up Captures auth provider; includes identify() with user ID
sign_out/+page.svelte user_signed_out Captures sign-out with reset() call
pricing_module.svelte plan_selected Captures plan_id and plan_name on click
contact_us/+page.server.ts contact_us_submitted Uses email as distinctId (problematic); boolean properties for field presence
subscribe/[slug]/+page.server.ts checkout_session_started Captures price_id; includes user_email in properties (PII)
billing/manage/+page.server.ts billing_portal_accessed Captures billing portal access; includes user_email (PII)
api/+page.server.ts profile_created, profile_updated, account_deleted, password_changed, email_subscription_toggled Rich set of account management events; some include PII
hooks.client.ts captureException Auto-captures client-side exceptions
hooks.server.ts server_error Manual server error capture

Issues

  • PII in event properties: user_email appears as a direct event property in billing_portal_accessed, checkout_session_started, and account_deleted. Per PostHog best practices, email should only appear in person properties via `` or identify(), not in `capture()` event properties. [MEDIUM]
  • Email as distinct_id in contact_us_submitted: Using raw email as distinctId leaks PII and creates fragmented person profiles for unauthenticated users. An anonymous server-generated ID or request-level ID would be better. [MEDIUM]
  • **profile_created/profile_updated nests correctly** but includes PII (full_name, email) — this is acceptable since is the person properties mechanism, though full_name in person properties is borderline. [LOW]

Other completed criteria

  • Events represent real user actions mapping to actual SaaS product flows (signup, login, checkout, billing)
  • Events enable product insights — a clear funnel can be built: sign_up → plan_selected → checkout_session_started
  • Events include relevant contextual properties (plan_id, provider, via_recovery, subscribed status)
  • Event names are descriptive and follow consistent snake_case convention

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