Skip to content

[CI] (0e81558) angular/angular-saas - #4241

Closed
wizard-ci-bot[bot] wants to merge 2 commits into
mainfrom
wizard-ci-0e81558-angular-angular-saas
Closed

wizard-ci-bot[bot] wants to merge 2 commits into
mainfrom
wizard-ci-0e81558-angular-angular-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 0e81558
App: angular/angular-saas
App directory: apps/angular/angular-saas
Workbench branch: wizard-ci-0e81558-angular-angular-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-09-29T08:22:26.318Z
Duration: 521.6s

YARA Scanner

✓ 263 tool calls scanned, 0 violations detected

No violations: ✓ 263 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Author

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


PR Evaluation Report

Summary

This PR integrates PostHog into an Angular SaaS application using posthog-js. It adds a PostHogService singleton for initialization, a custom ErrorHandler for exception capture, a PostHogLogService (which misuses the SDK's internal logger instead of capture()), user identification on login and app load, reset() on logout, and multiple custom event captures across settings, profile, project, and team member flows.

Files changed Lines added Lines removed
20 +219 -8

Confidence score: 5/5 🧙

  • The PostHogLogService misuses posthog.logger?.info?.(...) — the SDK's internal debug logger — instead of posthog.capture(). These calls will not send any events to PostHog; they only print to the browser console when debug mode is enabled. [CRITICAL]
  • PostHog is initialized without NgZone.runOutsideAngular(), which the Angular docs explicitly recommend to avoid unnecessary change detection cycles, especially with session recording. [MEDIUM]
  • No reverse proxy is configured for the client-side posthog-js SDK. [MEDIUM]

File changes

Filename Score Description
posthog.service.ts 3/5 Core PostHog service — good SSR guard and Proxy fallback, but missing NgZone.runOutsideAngular() and defaults config
posthog-error-handler.service.ts 5/5 Proper Angular ErrorHandler implementation with ngOriginalError unwrapping
posthog-log.service.ts 1/5 Misuses posthog.logger?.info?() (internal debug logger) instead of posthog.capture() — events never reach PostHog
app.component.ts 4/5 Initializes PostHog and identifies on load; good pattern
app.config.ts 5/5 Correctly provides PostHogErrorHandler as the global ErrorHandler
authentication.service.ts 4/5 Proper identify on login, capture on login/logout, reset on logout
environment.ts / environment.prod.ts 3/5 References env['NG_APP_POSTHOG_PROJECT_TOKEN'] but .env.ts doesn't contain these keys — depends on external build injection
.env.example 5/5 Documents required env vars
package.json 5/5 posthog-js added correctly
Various component files 4/5 Good event captures across settings, profile, project, and member flows

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; all imports resolve within Angular's DI system
Preserves existing env vars & configs Yes Existing environment configs preserved; only PostHog keys added
No syntax or type errors Yes TypeScript is valid; satisfies keyword correctly used
Correct imports/exports Yes All imports use correct Angular path aliases and package names
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues .env.ts only contains npm_package_version The env object doesn't have PostHog keys by default; relies on external build tooling (e.g., @AvidlyMedia/ng-app-env or similar) to inject NG_APP_* env vars at build time

Issues

  • Missing NgZone.runOutsideAngular(): The PostHog docs for Angular v17+ explicitly recommend initializing PostHog outside Angular's zone to reduce change detection cycles, especially important for session recording. The PostHogService calls posthog.init() directly without this wrapper. [MEDIUM]

Other completed criteria

  • All changes are relevant to PostHog integration
  • Correct files modified for Angular framework (services, app config, environment files)
  • No unnecessary modifications — refactoring _credentialsService to inject() pattern is minor but consistent with the rest of the codebase
  • .env added to .gitignore to prevent secrets from being committed
  • .env.example documents required environment variables

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.434.17 added to package.json
PostHog client initialized Yes posthog.init() called in PostHogService with API key and host from environment variables, guarded by isPlatformBrowser()
capture() Yes Multiple meaningful posthog.capture() calls across login, logout, profile, settings, project, and member flows
identify() Yes Called on login and on app load if credentials exist; uses credentials.id (stable auth ID) with person properties
Error tracking Yes Both capture_exceptions config (unhandled errors/rejections) and custom ErrorHandler with captureException()
Reverse proxy No No reverse proxy configured; client-side posthog-js sends directly to us.i.posthog.com

Issues

  • PostHogLogService misuses internal logger: posthog.logger?.info?('project_created', {...}) calls PostHog's internal debug logger, not the capture API. These "events" will never appear in PostHog — they only print to the console when posthog.debug(true) is active. Should use posthog.capture('project_created', {...}) instead. This affects project_created, project_deleted, and team_member_added events in data.service.ts. [CRITICAL]
  • No reverse proxy: For client-side posthog-js, a reverse proxy is recommended to avoid ad blocker interception. No Next.js rewrites, Vercel rewrites, or other proxy mechanism is configured. [MEDIUM]
  • Missing defaults config: The posthog.init() call does not include the defaults configuration option recommended in the PostHog docs. [LOW]

Other completed criteria

  • API key loaded from environment variable, not hardcoded
  • API host correctly configured via environment variable pointing to us.i.posthog.com
  • posthog.reset() correctly called on logout
  • Identify called on app load for returning users and on login
  • credentials.id used as distinct_id — proper stable auth ID, not email
  • Person properties (email, name, role) correctly passed via identify(), not in capture() properties

PostHog insights and events ⚠️

Filename PostHog events Description
authentication.service.ts user_logged_in, user_logged_out Auth flow events for funnel analysis
profile.component.ts profile_updated Tracks profile save actions
account-settings.component.ts account_settings_saved Tracks account settings changes
notification-settings.component.ts notification_preferences_saved Tracks notification prefs with enabled count
preferences-settings.component.ts preferences_saved Tracks UI preferences with dark mode, compact view, landing page
security-settings.component.ts two_factor_authentication_toggled, session_revoked Security actions with enabled state and scope
add-member-modal.component.ts team_member_added Team member addition with role
create-project-modal.component.ts project_created Project creation with status
posthog-error-handler.service.ts captureException Unhandled Angular exceptions
posthog-log.service.ts ❌ project_created, project_deleted, team_member_added via logger (BROKEN) Uses posthog.logger?.info?() — these never reach PostHog

Issues

  • Broken events via logger: Three events (project_created, project_deleted, team_member_added) in PostHogLogService use the SDK's internal debug logger instead of capture(). These will never be sent to PostHog. The same events are partially duplicated in the modal components via proper capture() calls, but project_deleted has no working capture at all. [CRITICAL]
  • Duplicate event names: project_created and team_member_added are captured both in modal components (correctly, via capture()) and in DataService (incorrectly, via logger). If the logger calls were fixed, events would be double-counted. [MEDIUM]

Other completed criteria

  • Events represent real user actions (login, logout, settings changes, project CRUD, member management)
  • Events enable product insights — can build login funnel, settings adoption, project creation trends
  • Events include relevant properties (role, status, enabled counts, scope)
  • No PII in capture properties — email/name correctly placed in identify() person properties only
  • 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