Skip to content

[CI] (22322bc) django/django3-saas - #3636

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-22322bc-django-django3-saas
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-22322bc-django-django3-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 22322bc
App: django/django3-saas
App directory: apps/django/django3-saas
Workbench branch: wizard-ci-22322bc-django-django3-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-08-28T19:13:07.632Z
Duration: 492.3s

YARA Scanner

✓ 185 tool calls scanned, 0 violations detected

No violations: ✓ 185 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a Django 3 SaaS application by adding the posthog SDK, initializing it via AppConfig.ready(), adding the PosthogContextMiddleware, connecting a user_logged_in signal for identity, and instrumenting views across accounts, billing, and dashboard with meaningful event captures.

Files changed Lines added Lines removed
7 +140 -2

Confidence score: 5/5 🧙

  • Person properties include PII fields beyond email: The set() call in the login signal sends username, company_name, name, and email as person properties. While set() is the correct method for person properties (not capture properties), sending username alongside name and email is somewhat redundant. This is acceptable but could be trimmed. [LOW]
  • Noop client fallback pattern: The _NoopPosthogClient is a reasonable graceful-degradation pattern, but only implements capture(). If any code path accidentally calls another method on it when PostHog is unconfigured, it would raise AttributeError. The signal is only connected when the real client is initialized, so this is safe in practice. [LOW]

File changes

Filename Score Description
accounts/apps.py 5/5 New file: initializes PostHog via Posthog() constructor in AppConfig.ready(), registers atexit shutdown, connects user_logged_in signal for identity, sets POSTHOG_MW_CLIENT
accounts/views.py 4/5 Adds capture calls for login, logout, registration, and settings update
billing/views.py 5/5 Comprehensive billing event instrumentation with enriched properties; webhook handlers correctly pass explicit distinct_id
config/settings.py 5/5 Adds env var settings, updates INSTALLED_APPS to use AccountsConfig, adds PosthogContextMiddleware after AuthenticationMiddleware
dashboard/views.py 4/5 Adds project CRUD event captures
.env.example 5/5 Documents POSTHOG_PROJECT_TOKEN and POSTHOG_HOST
requirements.txt 5/5 Adds posthog dependency

App sanity check ✅

Criteria Result Description
App builds and runs Yes No syntax errors; all imports resolve correctly
Preserves existing env vars & configs Yes Existing settings, env vars, and app logic are preserved; only additions for PostHog
No syntax or type errors Yes All code is syntactically valid Python/Django
Correct imports/exports Yes from accounts.apps import posthog_client resolves correctly due to Django's startup order
Minimal, focused changes Yes All changes directly support PostHog integration
Pre-existing issues None No pre-existing issues observed

Issues

No issues.

Other completed criteria

  • Environment variables documented in .env.example
  • Build configuration valid (requirements.txt correctly includes posthog)
  • INSTALLED_APPS correctly updated to use explicit AccountsConfig

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog added to requirements.txt
PostHog client initialized Yes Posthog() constructor in AccountsConfig.ready() with enable_exception_autocapture=True; atexit.register(posthog_client.shutdown) ensures flush on exit
capture() Yes 13 meaningful capture calls across accounts, billing, and dashboard views
identify() N/A Server-only app; middleware + user_logged_in signal handle identity correctly
Error tracking Yes enable_exception_autocapture=True on client init; middleware captures exceptions by default
Reverse proxy N/A Server-only app

Issues

No issues.

Other completed criteria

  • API key loaded from POSTHOG_PROJECT_TOKEN environment variable via Django settings
  • Host correctly configured from POSTHOG_HOST environment variable
  • PosthogContextMiddleware placed after AuthenticationMiddleware as documented
  • POSTHOG_MW_CLIENT setting correctly passes the instance-based client to the middleware (verified in SDK source)
  • user_logged_in signal correctly calls identify_context() to fix the ambient context during login requests, per Django docs
  • Person properties set via posthog_client.set() (correct method — Python SDK has no identify())
  • atexit.register(posthog_client.shutdown) ensures event flush on process exit

PostHog insights and events ✅

Filename PostHog events Description
accounts/views.py user_logged_in, user_logged_out, user_registered, account_settings_updated Core auth lifecycle events with login_method/registration_method properties
billing/views.py subscription_checkout_started, subscription_started, subscription_plan_changed, subscription_canceled, subscription_payment_failed Full billing funnel with billing_interval and payment_provider properties
dashboard/views.py project_created, project_updated, project_deleted Project CRUD events with is_active property
accounts/apps.py capturedException (via autocapture) Exception autocapture enabled; person properties set on login via set()

Issues

No issues.

Other completed criteria

  • Events represent real user actions mapping to actual product flows (auth → subscription → project management)
  • Events enable product insights: registration-to-subscription funnel, churn analysis via subscription_canceled, payment failure tracking
  • Events include relevant properties (billing_interval, payment_provider, login_method, is_active)
  • No PII in event properties dicts — person data correctly placed in set() call
  • Event names follow consistent snake_case [noun]_[verb] 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