Skip to content

[CI] (38ef7e6) django/django3-saas - #2588

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

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-django-django3-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: django/django3-saas
App directory: apps/django/django3-saas
Workbench branch: wizard-ci-38ef7e6-django-django3-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:06:57.717Z
Duration: 491.9s

YARA Scanner

✓ 49 tool calls scanned, 0 violations detected

No violations: ✓ 49 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 a Django 3 SaaS application by adding the Python SDK, initializing it in AppConfig.ready(), adding the PosthogContextMiddleware, and instrumenting 12 meaningful events across accounts, billing, and dashboard views.

Files changed Lines added Lines removed
7 +167 -1

Confidence score: 4/5 👍

  • Module-level initialization instead of instance-based API: The PR uses posthog.api_key / posthog.host module-level configuration instead of the recommended Posthog() class constructor, which means enable_exception_autocapture=True cannot be passed. [MEDIUM]
  • No .env.example updated: The PR creates .env (not committed) but does not update .env.example or equivalent to document POSTHOG_PROJECT_TOKEN and POSTHOG_HOST for collaborators. [MEDIUM]

File changes

Filename Score Description
accounts/apps.py 4/5 PostHog initialization in AppConfig.ready() with atexit shutdown — uses module-level API instead of instance-based
accounts/views.py 4/5 Login, logout, registration, and profile update events with proper context/identify patterns
billing/views.py 5/5 Comprehensive billing events (checkout, subscription, plan change, cancel) with rich properties
config/settings.py 5/5 Middleware added correctly after AuthenticationMiddleware, env vars configured
dashboard/views.py 4/5 Project CRUD events captured with context
requirements.txt 5/5 posthog dependency added
posthog-setup-report.md 5/5 Documentation of changes and next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors, valid imports, dependency added
Preserves existing env vars & configs Yes Existing settings preserved, only PostHog additions made
No syntax or type errors Yes All code is syntactically correct
Correct imports/exports Yes All imports from posthog are valid module-level functions
Minimal, focused changes Yes Only PostHog-related changes, no unrelated modifications
Pre-existing issues None N/A

Issues

  • No .env.example documentation: POSTHOG_PROJECT_TOKEN and POSTHOG_HOST are not documented in .env.example or equivalent file for collaborators. The report mentions .env was created but it's not committed. [MEDIUM]

Other completed criteria

  • Build configuration is valid — posthog added to requirements.txt
  • INSTALLED_APPS correctly updated from 'accounts' to 'accounts.apps.AccountsConfig'
  • Middleware placed after AuthenticationMiddleware as recommended

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog added to requirements.txt
PostHog client initialized Yes Initialized in AccountsConfig.ready() with API key and host from env vars, atexit shutdown registered
capture() Yes 12 meaningful capture calls across accounts, billing, and dashboard views
identify() N/A Server-only Django app
Error tracking No No enable_exception_autocapture=True configured. The module-level init (posthog.api_key = ...) doesn't support this parameter — requires instance-based Posthog() constructor
Reverse proxy N/A Server-only app

Issues

  • Module-level init prevents exception autocapture: The PR uses posthog.api_key = settings.POSTHOG_PROJECT_TOKEN module-level configuration. The enable_exception_autocapture=True parameter is only available on the Posthog() class constructor. While the PosthogContextMiddleware captures view exceptions by default, uncaught exceptions outside of request handling won't be auto-captured. Should use posthog = Posthog(api_key, host=host, enable_exception_autocapture=True) instead. [MEDIUM]

Other completed criteria

  • API key loaded from POSTHOG_PROJECT_TOKEN environment variable, not hardcoded
  • Host correctly configured with sensible default https://us.i.posthog.com
  • PosthogContextMiddleware added to MIDDLEWARE for automatic request context
  • atexit.register(posthog.shutdown) ensures events are flushed on exit
  • Context API used correctly with new_context() + identify_context() pattern
  • distinct_id values come from request.user.id (real auth context)

PostHog insights and events ✅

Filename PostHog events Description
accounts/views.py user_logged_in, user_logged_out, user_registered, profile_updated Core auth lifecycle events with login method and registration properties
billing/views.py checkout_initiated, subscription_started, checkout_completed, subscription_plan_changed, subscription_canceled Full billing funnel: initiation → completion → changes → cancellation with plan details
dashboard/views.py project_created, project_updated, project_deleted Project CRUD lifecycle tracking

Issues

No issues.

Other completed criteria

  • Events represent real user actions mapping to actual product flows (auth, billing, project management)
  • Events enable product insights — supports registration→subscription funnel, churn analysis, project activity trends
  • Events include relevant properties (plan_slug, plan_interval, demo_mode, login_method, etc.)
  • No PII in event properties — username and is_staff are set via tag() (context mechanism), not in capture properties
  • Event names are descriptive and use 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