Skip to content

[CI] (38ef7e6) sveltekit/CMSaasStarter - #2612

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-sveltekit-CMSaasStarter

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 38ef7e6
App: sveltekit/CMSaasStarter
App directory: apps/sveltekit/CMSaasStarter
Workbench branch: wizard-ci-38ef7e6-sveltekit-CMSaasStarter
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:44:51.763Z
Duration: 618.5s

YARA Scanner

✓ 60 tool calls scanned, 0 violations detected

No violations: ✓ 60 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

Now I have enough context to produce the evaluation.


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 includes a reverse proxy, user identification via Supabase auth, error tracking on both client and server, and 11 custom events covering sign-in, sign-up, sign-out, profile management, subscription checkout, and contact form submission.

Files changed Lines added Lines removed
13 +260 -3

Confidence score: 4/5 👍

  • .env.example is not updated with PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST — the wizard's own report even lists this as a TODO, meaning collaborators won't know which env vars to set [MEDIUM]
  • contact_us_submitted uses distinctId: "anonymous" — a hardcoded string that merges all anonymous contact submissions into a single person profile, fragmenting analytics [MEDIUM]
  • Server-side handleError uses distinctId: "server" and captures a manual server_error event instead of using posthog.captureException() from posthog-node, so errors won't appear properly in PostHog's Error Tracking product [MEDIUM]

File changes

Filename Score Description
package.json 5/5 Adds posthog-js and posthog-node dependencies
src/hooks.client.ts 4/5 New file: initializes posthog-js via SvelteKit init() hook with reverse proxy and error tracking
src/hooks.server.ts 4/5 Adds reverse proxy handler and server-side error capture; error handler uses hardcoded distinctId
src/lib/server/posthog.ts 5/5 Server-side PostHog singleton with immediate flush settings
svelte.config.js 5/5 Adds paths.relative: false for session replay SSR compatibility
src/routes/(admin)/account/+layout.svelte 5/5 Identifies returning users on every admin page load
src/routes/(marketing)/login/sign_in/+page.svelte 5/5 Identifies user and captures user_signed_in on auth state change
src/routes/(marketing)/login/sign_up/+page.svelte 5/5 Identifies user and captures user_signed_up on auth state change
src/routes/(admin)/account/sign_out/+page.svelte 5/5 Captures user_signed_out and calls posthog.reset()
src/routes/(admin)/account/api/+page.server.ts 5/5 Captures 6 server-side events for profile/account actions
src/routes/(admin)/account/subscribe/[slug]/+page.server.ts 5/5 Captures subscription_checkout_started with plan ID
src/routes/(marketing)/contact_us/+page.server.ts 3/5 Captures contact_us_submitted but uses hardcoded distinctId: "anonymous"
posthog-setup-report.md 5/5 Comprehensive setup report documenting all changes

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 preserved; sequence() extended without breaking existing handles
No syntax or type errors Yes All TypeScript is valid; @ts-expect-error properly annotated for duplex option
Correct imports/exports Yes All imports from posthog-js, posthog-node, /static/public, /server/posthog are correct
Minimal, focused changes Yes All changes are PostHog-related
Pre-existing issues None

Issues

  • .env.example not updated: PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are required by the integration but not documented in .env.example. The wizard's own report acknowledges this as a TODO. [MEDIUM]

Other completed criteria

  • Build configuration is valid — package.json dependencies added correctly
  • Existing Supabase auth flow and Stripe integration preserved
  • svelte.config.js modification is additive and non-breaking

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.396.5 and posthog-node@^5.39.4 added to package.json
PostHog client initialized Yes Client: posthog.init() in hooks.client.ts via SvelteKit init() hook. Server: singleton pattern in /server/posthog.ts with flushAt: 1, flushInterval: 0
capture() Yes 11 custom events across client and server files
identify() Yes Uses session.user.id (Supabase auth) on sign-in, sign-up, and admin layout load; calls posthog.reset() on sign-out
Error tracking Yes Client: capture_exceptions: true in init + handleError with captureException(). Server: handleError captures errors (though not via captureException())
Reverse proxy Yes /ingest proxy in hooks.server.ts correctly routes /ingest/static/* and /ingest/array/* to us-assets.i.posthog.com and other paths to us.i.posthog.com

Issues

  • Server-side error tracking uses manual capture instead of captureException(): The server handleError captures a server_error event with posthog.capture() instead of using posthog.captureException() from posthog-node. Errors won't appear in PostHog's Error Tracking product. [MEDIUM]
  • Hardcoded distinctId: "server" in error handler: All server errors are attributed to a single "server" person profile, making per-user error correlation impossible on the server side. [LOW]

Other completed criteria

  • API key loaded from PUBLIC_POSTHOG_PROJECT_TOKEN env var (not hardcoded)
  • Host correctly configured — client uses /ingest reverse proxy, server uses PUBLIC_POSTHOG_HOST
  • paths.relative: false set in svelte.config.js for session replay SSR compatibility (per framework rules)
  • posthog.reset() called on sign-out to unlink future events
  • Identify uses real Supabase user IDs, not fabricated values

PostHog insights and events ✅

Filename PostHog events Description
hooks.client.ts captureException Client-side error tracking via capture_exceptions: true and handleError
hooks.server.ts server_error Server-side error capture in handleError
sign_in/+page.svelte user_signed_in Captured on Supabase SIGNED_IN auth event with { method: "email" }
sign_up/+page.svelte user_signed_up Captured on Supabase SIGNED_IN auth event with { method: "email" }
sign_out/+page.svelte user_signed_out Captured before posthog.reset() on sign-out
api/+page.server.ts profile_created, profile_updated, password_changed, email_changed, account_deleted, email_subscription_toggled Server-side events with relevant properties (company_name, has_website, unsubscribed)
subscribe/[slug]/+page.server.ts subscription_checkout_started Captured with { plan_id } property when Stripe checkout begins
contact_us/+page.server.ts contact_us_submitted Captured with { has_company, has_phone } — uses hardcoded distinctId: "anonymous"

Issues

  • contact_us_submitted uses distinctId: "anonymous": This hardcoded string merges all anonymous contact form submissions into a single PostHog person. If the user is authenticated, the session user ID should be used instead. If unauthenticated, consider generating a unique ID or using posthog.capture() client-side where PostHog's anonymous ID is available. [MEDIUM]

Other completed criteria

  • Events represent real user actions across the full user lifecycle (signup → profile → subscription → sign-out)
  • Events enable product insights — can build a signup-to-subscription funnel
  • Events include contextual properties (method, plan_id, company_name, has_website, unsubscribed)
  • No PII in event properties — company_name is business data, not personal; emails/names are not included in capture properties
  • Event names are consistently snake_case and descriptive

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