[CI] (1776c51) fastapi/fastapi3-ai-saas#2714
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a FastAPI AI SaaS application. It adds a shared PostHog client module, utility helpers for context-scoped event capture and user identification, and instruments 14 events across auth, generation, API key management, usage, and settings routes. The implementation uses the instance-based
Confidence score: 4/5 👍
File changes
App sanity check ✅
Issues
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog>=7.22.1 added to requirements.txt |
| PostHog client initialized | Yes | Instance-based Posthog() constructor in posthog_client.py with enable_exception_autocapture=True, atexit.register(posthog_client.shutdown), and lifespan shutdown |
| capture() | Yes | 14 meaningful capture() calls across all route files via the capture_user_event helper |
| identify() | N/A | Server-only app; uses posthog_client.set() correctly to set person properties (email, credits, is_active) on signup/login/email-update |
| Error tracking | Yes | enable_exception_autocapture=True in client constructor; capture_exception helper available in posthog_utils.py |
| Reverse proxy | N/A | Server-only app — reverse proxy not applicable |
Issues
None.
Other completed criteria
- API key loaded from environment variable via Pydantic Settings (
posthog_project_token), not hardcoded - Host correctly configured via
posthog_hostsetting, defaulting tohttps://us.i.posthog.com - Shutdown registered both via
atexitand FastAPI lifespan teardown — belt-and-suspenders approach is good - Context API used correctly:
new_context(client=posthog_client)withidentify_context(str(user.id))for request-scoped tracking distinct_idusesstr(user.id)— real database IDs, not fabricated values
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
app/routers/auth.py |
signup_completed, login_succeeded, logout_completed |
Auth lifecycle with method, credits balance, and active status |
app/routers/pages.py |
dashboard_viewed |
Dashboard load with generation counts, credits, API key count |
app/routers/generate.py |
content_generated, generation_blocked_insufficient_credits, credits_viewed |
Core product action with type, credits used/remaining, prompt/result length |
app/routers/api_keys.py |
api_key_created, api_key_revoked, api_key_creation_blocked_limit |
API key lifecycle with active counts |
app/routers/usage.py |
usage_viewed |
Usage page view with date range and generation counts |
app/routers/settings.py |
settings_viewed, email_updated, password_changed |
Account settings actions; email_updated tracks domain changes |
app/posthog_utils.py |
capture_user_exception (helper) |
Exception capture helper using capture_exception with user context |
Issues
new_password_lengthleaks password metadata: Thepassword_changedevent includesnew_password_length, which reveals information about user password strength. This is a security-sensitive property that should be removed. [MEDIUM]
Other completed criteria
- Events represent real user actions mapping to actual product flows (signup → generation → API key management)
- Events enable product insights — signup-to-generation funnel, credit depletion trends, API key churn are all buildable
- Events include rich contextual properties (generation_type, credits_used, credits_remaining, active_key_count, etc.)
- No PII in event properties — email is set via
posthog_client.set()on person profiles, not incapture()properties. Email domains (not full emails) are tracked inemail_updated. - Event names are descriptive and consistently use
snake_casewith[noun]_[verb]pattern
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:
1776c51App:
fastapi/fastapi3-ai-saasApp directory:
apps/fastapi/fastapi3-ai-saasWorkbench branch:
wizard-ci-1776c51-fastapi-fastapi3-ai-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-10T23:22:22.370Z
Duration: 620.8s
YARA Scanner