Skip to content

[CI] (9f92c68) angular/angular-saas - #2520

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-9f92c68-angular-angular-saas

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: angular/angular-saas
App directory: apps/angular/angular-saas
Workbench branch: wizard-ci-9f92c68-angular-angular-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-08T16:49:37.202Z
Duration: 532.2s

YARA Scanner

✓ 88 tool calls scanned, 0 violations detected

No violations: ✓ 88 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. Let me produce the evaluation report.


PR Evaluation Report

Summary

This PR integrates PostHog into an Angular SaaS application by creating a PostHogService singleton with SSR-safe proxy pattern, adding posthog-js to dependencies, instrumenting 12 meaningful events across login, logout, billing, settings, and project/team management flows, and identifying users on login with posthog.reset() on logout.

Files changed Lines added Lines removed
19 +163 -2

Confidence score: 4/5 👍

  • Incorrect PostHog host fallback: Environment files use https://us.posthog.com instead of the correct ingest endpoint https://us.i.posthog.com. While the .env file has the correct host, the hardcoded fallback is wrong and will be used when env vars are missing. [CRITICAL]
  • Missing NgZone.runOutsideAngular(): The Angular docs explicitly recommend initializing PostHog outside Angular's zone to avoid excessive change detection cycles, especially with session recording. The PostHogService does not use NgZone at all. [MEDIUM]
  • Missing defaults config option: The PostHog Angular docs recommend passing defaults: '2026-05-30' to posthog.init(). This is omitted. [MEDIUM]
  • No reverse proxy configured: For a client-only Angular app, a reverse proxy is recommended to prevent ad blockers from intercepting PostHog requests. [MEDIUM]
  • Identify not called on page refresh: The wizard itself acknowledges this — identify() is only called on login form submit, not when the app loads for an already-authenticated user. Returning users operate under anonymous distinct IDs until they log out and back in. [MEDIUM]

File changes

Filename Score Description
src/app/services/posthog.service.ts 3/5 New PostHog service with SSR-safe proxy pattern, but missing NgZone usage
src/environments/environment.ts 3/5 Adds posthogKey/posthogHost from env vars, but incorrect fallback host
src/environments/environment.prod.ts 3/5 Same incorrect fallback host
src/app/app.component.ts 3/5 Initializes PostHog in ngOnInit, missing defaults option
src/app/auth/login/login.component.ts 4/5 Proper identify + capture on login
src/app/auth/logout/logout.component.ts 5/5 Correctly captures logout event and calls reset()
package.json 5/5 posthog-js added to dependencies
src/env.d.ts 5/5 TypeScript declarations for env vars
src/app/pages/billing/billing.component.ts 5/5 Captures billing_page_viewed with current plan
src/app/pages/dashboard/components/quick-actions/quick-actions.component.ts 5/5 Captures quick_action_clicked with action context
Other component files 5/5 Well-placed capture calls with relevant properties

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; service, imports, and types are valid
Preserves existing env vars & configs Yes Existing environment config preserved, PostHog fields added
No syntax or type errors Yes TypeScript types are correct, env.d.ts properly declares import.meta.env
Correct imports/exports Yes All imports use correct path aliases (@app/services/posthog.service)
Minimal, focused changes Yes All changes directly relate to PostHog integration
Pre-existing issues None —

Issues

  • Incorrect fallback host in environment files: Both environment.ts and environment.prod.ts use 'https://us.posthog.com' as the fallback. This should be 'https://us.i.posthog.com' (the ingest endpoint). When env vars are missing, events will be sent to the wrong host. [CRITICAL]
  • No .env.example file: While .env exists with the correct values and .gitignore excludes it, there is no .env.example to document required variables for other developers. The wizard report itself flags this as a TODO. [LOW]

Other completed criteria

  • .gitignore updated to exclude .env file
  • posthog-js added to package.json dependencies
  • env.d.ts provides TypeScript type declarations for PostHog environment variables

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js: ^1.398.6 added to package.json dependencies
PostHog client initialized No Initialized via PostHogService.init() called in AppComponent.ngOnInit(), but missing defaults config option and not using NgZone.runOutsideAngular() as recommended by Angular docs
capture() Yes 12 capture calls across login, logout, billing, settings, project creation, team management
identify() Yes Called on login with res.id as distinct_id and email/username as person properties; reset() called on logout
Error tracking Yes capture_exceptions: true passed to posthog.init() options
Reverse proxy No No reverse proxy configured; client-only app would benefit from proxy to avoid ad blocker interception

Issues

  • Missing NgZone.runOutsideAngular(): The PostHog Angular documentation explicitly recommends initializing PostHog outside Angular's change detection zone: this.ngZone.runOutsideAngular(() => { posthog.init(...) }). Without this, session recording's DOM mutation observers can trigger excessive Angular change detection cycles, causing performance issues. The PostHogService should inject NgZone and wrap the posthog.init() call. [MEDIUM]
  • Missing defaults configuration: The posthog.init() call should include defaults: '2026-05-30' as shown in the Angular docs to use recommended default configuration values. [MEDIUM]
  • Identify not called for returning users: posthog.identify() is only called on login form submission. Users who reload the page while already authenticated will generate events under anonymous distinct IDs. The app should call identify() on app load when the user is already authenticated (e.g., check CredentialsService.isAuthenticated() in AppComponent.ngOnInit()). [MEDIUM]
  • No reverse proxy: A reverse proxy is recommended for client-side PostHog integrations to ensure events aren't blocked by ad blockers. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable NG_APP_POSTHOG_PROJECT_TOKEN, not hardcoded
  • SSR-safe implementation using isPlatformBrowser() check and Proxy pattern for graceful no-op on server
  • posthog.reset() correctly called on logout to unlink future events

PostHog insights and events ✅

Filename PostHog events Description
login.component.ts user_logged_in Captures login with username property; also calls identify(res.id, {username, email})
logout.component.ts user_logged_out Captures logout and calls posthog.reset()
billing.component.ts billing_page_viewed Tracks billing page views with current plan — top of upgrade funnel
quick-actions.component.ts quick_action_clicked Captures dashboard quick action clicks with action_id and label
profile.component.ts profile_updated Fires on profile save
account-settings.component.ts account_settings_saved Fires when account settings are saved
security-settings.component.ts two_factor_authentication_toggled, session_revoked Tracks 2FA toggle state and session revocation with device info
notification-settings.component.ts notification_preferences_saved Captures all notification preference values
preferences-settings.component.ts preferences_saved Captures all UI preference values (dark mode, timezone, etc.)
create-project-modal.component.ts project_created Tracks project creation with status
add-member-modal.component.ts team_member_added Tracks member addition with role
app.component.ts captureException (via capture_exceptions: true) Automatic exception capture enabled at init

Issues

No event quality issues found.

Other completed criteria

  • Events represent real user actions across the full product lifecycle (auth, settings, billing, project management)
  • Events enable product insights: login-to-project-creation funnel, billing engagement, feature adoption tracking
  • Events include relevant contextual properties (plan type, action IDs, preference values, 2FA state)
  • No PII in capture() properties — email and username are correctly placed in identify() person properties
  • Consistent snake_case naming convention across all events

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