Skip to content

[CI] (624abe2) django/django3-saas - #4452

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 624abe2
App: django/django3-saas
App directory: apps/django/django3-saas
Workbench branch: wizard-ci-624abe2-django-django3-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-08T09:06:47.814Z
Duration: 426.4s

YARA Scanner

✓ 192 tool calls scanned, 0 violations detected

No violations: ✓ 192 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Author

Now I have everything I need to evaluate. Let me produce the review.


PR Evaluation Report

Summary

This PR integrates PostHog into a Django 3 SaaS application. It adds the PostHog Python SDK, initializes it via an AppConfig.ready() hook, adds the PosthogContextMiddleware, sets up a user_logged_in signal for identity resolution, and captures events across accounts, billing, and dashboard views. It also adds an OpenTelemetry log export pipeline to PostHog, which is beyond the scope of a basic integration.

Files changed Lines added Lines removed
10 +275 -1

Confidence score: 4/5 👍

  • OpenTelemetry log export is scope creep: posthog_logs.py sets up OTel log export with 3 extra dependencies (opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-otlp). This is not part of standard PostHog analytics integration and adds unnecessary complexity. [MEDIUM]
  • ImproperlyConfigured in DEBUG mode is aggressive: ConfigConfig.ready() raises ImproperlyConfigured if PostHog env vars are missing in DEBUG mode, which will crash the dev server for developers who haven't configured PostHog yet. A warning log would be more appropriate. [MEDIUM]

File changes

Filename Score Description
config/posthog.py 5/5 Clean PostHog client initialization with Posthog() constructor, enable_exception_autocapture=True, and atexit.register(shutdown)
config/apps.py 4/5 Initializes PostHog in AppConfig.ready() — correct pattern, but ImproperlyConfigured in DEBUG is aggressive
config/settings.py 5/5 Adds env vars, ConfigConfig to INSTALLED_APPS, and PosthogContextMiddleware after AuthenticationMiddleware
config/signals.py 5/5 Correct user_logged_in signal with identify_context() and client.set() for person properties
accounts/views.py 5/5 Captures login, logout, registration, and settings events with safe properties
billing/views.py 5/5 Rich billing events with plan_slug, billing_provider, plan_interval properties
dashboard/views.py 4/5 Good CRUD events but also uses posthog_logger (OTel scope creep)
config/posthog_logs.py 3/5 OTel log export — functional but unnecessary for basic PostHog integration
.env.example 5/5 Documents POSTHOG_API_KEY and POSTHOG_HOST
requirements.txt 4/5 Adds posthog correctly, but also 3 OTel dependencies for the log pipeline

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes All syntax is valid, imports resolve, middleware and app config are correctly wired
Preserves existing env vars & configs Yes Existing settings, env vars, and app logic are untouched
No syntax or type errors Yes All changed files have correct Python syntax
Correct imports/exports Yes from posthog import Posthog, identify_context, middleware path are all correct
Minimal, focused changes No OTel log export pipeline (posthog_logs.py + 3 dependencies) is beyond basic PostHog integration scope
Pre-existing issues None Base app is clean

Issues

  • OpenTelemetry scope creep: posthog_logs.py adds a full OTel log export pipeline with BatchLogRecordProcessor, OTLPLogExporter, and LoggerProvider, plus 3 new dependencies. This is not required for basic PostHog analytics and adds operational complexity. Remove posthog_logs.py, its import in apps.py, the posthog_logger usage in dashboard/views.py, and the 3 OTel dependencies from requirements.txt. [MEDIUM]
  • ImproperlyConfigured in DEBUG: ConfigConfig.ready() raises ImproperlyConfigured when PostHog env vars are missing in DEBUG mode, which crashes the dev server. Consider using warnings.warn() or logging.warning() instead, and silently returning as already done for production. [MEDIUM]

Other completed criteria

  • Environment variables documented in .env.example
  • Build configuration valid — requirements.txt is parseable and posthog is included
  • config.apps.ConfigConfig correctly added to INSTALLED_APPS
  • PosthogContextMiddleware placed after AuthenticationMiddleware per Django docs

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog added to requirements.txt
PostHog client initialized Yes Posthog() constructor in config/posthog.py with enable_exception_autocapture=True; called from AppConfig.ready()
capture() Yes 12+ capture calls across accounts, billing, and dashboard views
identify() N/A Server-only app
Error tracking Yes enable_exception_autocapture=True on client + PosthogContextMiddleware captures view exceptions
Reverse proxy N/A Server-only app

Issues

No PostHog implementation issues found.

Other completed criteria

  • API key loaded from os.environ.get('POSTHOG_API_KEY') — not hardcoded
  • Host loaded from os.environ.get('POSTHOG_HOST') — correctly configured
  • atexit.register(posthog_client.shutdown) ensures events are flushed on exit
  • user_logged_in signal correctly calls identify_context(str(user.pk)) to fix the ambient context for login requests
  • Person properties (email, username, name, company_name) set via client.set() — correct location for PII
  • Middleware reads authenticated user's pk as distinct_id fallback — documented pattern

PostHog insights and events ✅

Filename PostHog events Description
accounts/views.py user_logged_in, user_logged_out, user_registered, account_settings_updated Auth lifecycle events with has_company_name property
billing/views.py subscription_checkout_started, subscription_activated, subscription_checkout_completed, subscription_plan_changed, subscription_canceled Full subscription funnel with plan_slug, billing_provider, plan_interval
dashboard/views.py project_created, project_updated, project_deleted CRUD events with has_description, is_active, was_active
config/signals.py Person properties via client.set() Sets email, username, name, company_name on person profile at login

Issues

No event quality issues found.

Other completed criteria

  • Events represent real user actions mapping to actual product flows (registration → subscription → project management)
  • Events enable product insights — full subscription funnel from checkout_started → activated → plan_changed → canceled
  • Events include relevant contextual properties (plan_slug, billing_provider, has_description, etc.)
  • No PII in capture() properties — email and name are correctly placed in client.set() person properties
  • Event names are descriptive, snake_case, and follow [object]_[verb] convention consistently

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