Repository navigation
[CI] (0ae2102) django/django3-saas - #1213
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
|
Now I have enough context. Let me produce the evaluation. PR Evaluation ReportSummaryThis PR integrates PostHog into a Django 3 SaaS application. It initializes the PostHog SDK in
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | All syntax is valid, imports resolve, no breaking changes |
| Preserves existing env vars & configs | Yes | All existing settings preserved; only PostHog additions made |
| No syntax or type errors | Yes | All Python code is syntactically valid |
| Correct imports/exports | Yes | All imports (posthog, new_context, identify_context, capture, tag) are valid module-level imports from the PostHog Python SDK |
| Minimal, focused changes | Yes | Only PostHog-related additions; no unrelated refactors |
| Pre-existing issues | None | No pre-existing issues detected |
Issues
.env.examplenot updated: The.env.examplefile does not includePOSTHOG_PROJECT_TOKENorPOSTHOG_HOST. The.envfile was updated but is not committed in the PR. Developers cloning the repo won't discover the required env vars. Add them to.env.example. [MEDIUM]
Other completed criteria
- App config correctly registered as
accounts.apps.AccountsConfiginINSTALLED_APPS PosthogContextMiddlewarecorrectly placed at end of middleware listposthogadded torequirements.txt- Build configuration remains valid
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog added to requirements.txt |
| PostHog client initialized | Yes | Initialized in AppConfig.ready() using module-level posthog.api_key and posthog.host. However, uses module-level config instead of recommended Posthog() constructor. |
| capture() | Yes | 12 meaningful capture() calls across accounts, billing, and dashboard views |
| identify() | N/A | Server-only Django app |
| Error tracking | No | posthog.capture_exception(e) is used for Stripe errors, but enable_exception_autocapture=True is not set (impossible with module-level init). The Django middleware handles exception capture by default, but the SDK-level autocapture is missing. The capture_exception() calls in billing also don't pass distinct_id, relying on context — but they are called outside a new_context() block. |
| Reverse proxy | N/A | Server-only Django app |
Issues
- Module-level init instead of Posthog() constructor:
apps.pyusesposthog.api_keyandposthog.hostmodule-level assignments. The framework rules require thePosthog()class constructor, which also enablesenable_exception_autocapture=True. The Django docs show the module-level pattern, but the Python SDK rules explicitly prefer instance-based init. [MEDIUM] - Missing
enable_exception_autocapture=True: Exception autocapture is not enabled because the module-level init pattern doesn't support this parameter. The middleware does capture exceptions by default, but uncaught exceptions outside request contexts won't be tracked. [MEDIUM] capture_exception()outside context in billing: Inbilling/views.py,posthog.capture_exception(e)is called outside anew_context()block (in theexceptclause), meaning there's noidentify_contextset for these exception events. They won't be associated with the user. Should be inside the context block or a new context should wrap the try/except. [LOW]
Other completed criteria
- API key loaded from environment variable via
settings.POSTHOG_PROJECT_TOKEN - Host correctly configured via
settings.POSTHOG_HOSTwith defaulthttps://us.i.posthog.com PosthogContextMiddlewareadded to middleware for automatic session/distinct ID extraction- Context API (
new_context(),identify_context()) used correctly throughout identify_context(str(user.id))uses real user IDs from Django auth
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
accounts/views.py |
user_logged_in, user_logged_out, user_registered, profile_settings_updated |
Auth lifecycle events with login/registration method properties |
billing/views.py |
subscription_started, plan_changed, subscription_canceled, checkout_completed, payment_failed, capturedException |
Full subscription lifecycle with plan properties; exception capture on Stripe errors |
dashboard/views.py |
project_created, project_updated, project_deleted |
Core product CRUD events with project properties |
Issues
project_deletedmissing properties: Theproject_deletedevent is captured without any properties (noproject_id). Other project events includeproject_idandis_active. [LOW]- PII in context tags:
tag('username', user.username)inaccounts/views.pyadds the username to all events in that context. Whiletag()sets context properties (not direct event properties), these still propagate to event data. This is borderline — usernames are semi-PII. [LOW]
Other completed criteria
- Events represent real user actions mapping to actual product flows (auth, billing, project management)
- Events enable product insights: registration → subscription funnel, churn tracking, plan change breakdown
- Events include relevant contextual properties (plan_name, plan_slug, plan_interval, via_stripe, login_method, project_id)
- Event names use consistent
snake_caseconvention with descriptive[noun]_[verb]format - No direct PII (emails, names, phones) in
capture()event properties
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: wizard-pr
Trigger ID:
0ae2102App:
django/django3-saasApp directory:
apps/django/django3-saasWorkbench branch:
wizard-ci-0ae2102-django-django3-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-04-15T19:03:52.320Z
Duration: 316.4s