Skip to content

[CI] (38ef7e6) angular/angular-saas - #2590

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-angular-angular-saas

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: angular/angular-saas
App directory: apps/angular/angular-saas
Workbench branch: wizard-ci-38ef7e6-angular-angular-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:08:59.826Z
Duration: 631.8s

YARA Scanner

✓ 85 tool calls scanned, 0 violations detected

No violations: ✓ 85 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into an Angular SaaS application by creating a PosthogService singleton with SSR-safety guards, initializing PostHog in app.component.ts, adding user identification on login and page refresh, capturing 10 custom events across authentication, billing, settings, and team management flows, and enabling automatic exception capture.

Files changed Lines added Lines removed
17 +172 -1

Confidence score: 4/5 👍

  • Missing NgZone.runOutsideAngular: PostHog is initialized inside the Angular zone, which can cause excessive change detection cycles, especially with session recording enabled. The Angular docs explicitly recommend initializing PostHog outside the Angular zone. [MEDIUM]
  • username sent as event property in user_logged_in: The username is passed in the capture() properties dict for user_logged_in. If username is PII (e.g., a real name or email), it should only be in identify() person properties, not in event properties. [MEDIUM]
  • No reverse proxy configured: No reverse proxy is set up, which means client-side tracking requests may be blocked by ad blockers. [MEDIUM]
  • Missing defaults config option: The posthog.init() call lacks the defaults configuration option recommended in the current PostHog docs. [LOW]

File changes

Filename Score Description
src/app/@core/services/posthog.service.ts 4/5 New PostHog wrapper service with SSR guards using isPlatformBrowser and a Proxy fallback for server-side safety
src/app/app.component.ts 3/5 Initializes PostHog and re-identifies authenticated users on page load; missing NgZone
src/app/auth/login/login.component.ts 3/5 Identifies user on login and captures user_logged_in event; username in event properties is questionable
src/app/auth/logout/logout.component.ts 5/5 Captures user_logged_out and calls reset() correctly
src/app/pages/billing/billing.component.ts 4/5 Adds selectPlan method capturing billing_plan_selected with plan IDs
src/app/pages/profile/profile.component.ts 4/5 Captures profile_updated on save
src/app/pages/settings/.../account-settings.component.ts 4/5 Captures account_settings_saved
src/app/pages/settings/.../notification-settings.component.ts 5/5 Captures notification_preferences_saved with notification state properties
src/app/pages/settings/.../security-settings.component.ts 5/5 Captures two_factor_auth_toggled and session_revoked with relevant properties
src/app/shared/components/add-member-modal/add-member-modal.component.ts 5/5 Captures member_added with role
src/app/shared/components/create-project-modal/create-project-modal.component.ts 5/5 Captures project_created with status
src/environments/environment.ts & environment.prod.ts 4/5 Adds posthogKey and posthogHost from env vars with sensible defaults
src/environments/.env.ts 4/5 Adds env variable placeholders
package.json 5/5 Adds posthog-js dependency
.gitignore 5/5 Adds .env to gitignore
posthog-setup-report.md 5/5 Comprehensive setup report with event inventory and next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes All syntax is valid, imports use existing path aliases (@core, @app, @env), and the service is properly injectable
Preserves existing env vars & configs Yes Existing environment configs extended without modifying existing properties
No syntax or type errors Yes All TypeScript is syntactically correct; PostHogConfig type import is valid
Correct imports/exports Yes All imports resolve correctly using the project's path aliases
Minimal, focused changes Yes Changes are strictly PostHog-related with no unrelated refactors
Pre-existing issues None No pre-existing issues observed

Issues

  • Missing NgZone.runOutsideAngular for PostHog init: Per Angular PostHog docs, initializing PostHog inside the Angular zone causes unnecessary change detection cycles, especially with session recording. The PosthogService should inject NgZone and wrap posthog.init() in ngZone.runOutsideAngular(). [MEDIUM]

Other completed criteria

  • Environment variables documented via .env.ts placeholders and setup report checklist
  • Build configuration valid — posthog-js added correctly to dependencies
  • .env added to .gitignore to prevent secret leakage

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.399.0 added to package.json
PostHog client initialized Yes Initialized via PosthogService.init() in app.component.ts with api_host and capture_exceptions; missing defaults option and NgZone
capture() Yes 10 meaningful capture calls across auth, billing, settings, and team management
identify() Yes identify(user.id, { username }) called on login and on page refresh for returning users
Error tracking Yes capture_exceptions: true in init config enables automatic exception capture; manual captureException() in login error handler
Reverse proxy No No reverse proxy configured; client-side requests will be sent directly to us.i.posthog.com

Issues

  • No reverse proxy: No reverse proxy is configured for the client-side PostHog SDK. Requests to us.i.posthog.com may be blocked by ad blockers, reducing data completeness. [MEDIUM]
  • Missing defaults config: The posthog.init() call does not include the defaults option (e.g., defaults: '2026-05-30'), which is recommended in current PostHog Angular docs to ensure consistent default configuration. [LOW]

Other completed criteria

  • API key loaded from environment variable (NG_APP_POSTHOG_PROJECT_TOKEN), not hardcoded
  • API host correctly configured with fallback to https://us.i.posthog.com
  • posthog.reset() called on logout to unlink future events
  • Re-identification on page refresh for returning users
  • identify() uses user.id (a real user identifier from credentials), not a fabricated value

PostHog insights and events ⚠️

Filename PostHog events Description
login.component.ts user_logged_in, captureException Captures login success with username and manually captures login errors
logout.component.ts user_logged_out Captures logout and resets PostHog identity
profile.component.ts profile_updated Captures profile save action
billing.component.ts billing_plan_selected Captures plan selection with current and previous plan IDs
account-settings.component.ts account_settings_saved Captures account settings save
notification-settings.component.ts notification_preferences_saved Captures notification preferences with all toggle states
security-settings.component.ts two_factor_auth_toggled, session_revoked Captures 2FA toggle state and session revocation with device info
create-project-modal.component.ts project_created Captures project creation with status
add-member-modal.component.ts member_added Captures team member addition with role
app.component.ts identify Re-identifies authenticated users on page load with capture_exceptions: true for automatic error tracking

Issues

  • username in user_logged_in event properties: The username field is passed as an event property in the capture('user_logged_in', { username }) call. If username contains PII (e.g., real name or email), it should only be set via identify() person properties, not in event properties. It is already correctly passed in the identify() call on the same line. [MEDIUM]

Other completed criteria

  • Events represent real user actions across the full product lifecycle (auth, billing, settings, team management)
  • Events enable product insights — login/logout for retention, billing_plan_selected for conversion funnels, project_created for activation
  • Most events include relevant contextual properties (plan_id, previous_plan_id, member_role, enabled state, device, notification toggles)
  • Event names are descriptive, consistent, and use 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